Created
June 8, 2022 11:23
-
-
Save nsakki55/4f9f9d1d296b2e7fad722ed3f07adf07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "bdc0dd0b", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from time import gmtime, strftime\n", | |
"\n", | |
"from sagemaker.sklearn.estimator import SKLearn\n", | |
"\n", | |
"job_name = \"third-party-library-script-ctr-prediction-\" + strftime(\"%Y%m%d-%H-%M-%S\", gmtime())\n", | |
"\n", | |
"output_location = f\"s3://{bucket}/{prefix}/output\"\n", | |
"\n", | |
"hyperparameters = {\"max_alpha\": 0.002}\n", | |
"enable_local_mode_training=False\n", | |
"\n", | |
"if enable_local_mode_training:\n", | |
" train_instance_type = \"local\"\n", | |
" inputs = {\"train\": f\"file://{train_file}\", \"validation\": f\"file://{validation_file}\", \"test\": f\"file://{test_file}\"}\n", | |
"else:\n", | |
" train_instance_type = \"ml.m5.large\"\n", | |
" inputs = {\"train\": s3_train_data, \"validation\": s3_validation_data, \"test\": s3_test_data}\n", | |
"\n", | |
"estimator_parameters = {\n", | |
" \"entry_point\": \"third_party_library_scirpt_mode.py\",\n", | |
" \"source_dir\": \"third_party_library\",\n", | |
" \"framework_version\": \"0.23-1\",\n", | |
" \"py_version\": \"py3\",\n", | |
" \"instance_type\": train_instance_type,\n", | |
" \"instance_count\": 1,\n", | |
" \"hyperparameters\": hyperparameters,\n", | |
" \"output_path\": output_location,\n", | |
" \"role\": role,\n", | |
" \"base_job_name\": job_name,\n", | |
"}\n", | |
"\n", | |
"estimator = SKLearn(**estimator_parameters)\n", | |
"estimator.fit(inputs)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.8.6" | |
}, | |
"varInspector": { | |
"cols": { | |
"lenName": 16, | |
"lenType": 16, | |
"lenVar": 40 | |
}, | |
"kernels_config": { | |
"python": { | |
"delete_cmd_postfix": "", | |
"delete_cmd_prefix": "del ", | |
"library": "var_list.py", | |
"varRefreshCmd": "print(var_dic_list())" | |
}, | |
"r": { | |
"delete_cmd_postfix": ") ", | |
"delete_cmd_prefix": "rm(", | |
"library": "var_list.r", | |
"varRefreshCmd": "cat(var_dic_list()) " | |
} | |
}, | |
"types_to_exclude": [ | |
"module", | |
"function", | |
"builtin_function_or_method", | |
"instance", | |
"_Feature" | |
], | |
"window_display": false | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment