File tree Expand file tree Collapse file tree 2 files changed +33
-5
lines changed
preprocessing/tabular_data Expand file tree Collapse file tree 2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 4646 " import subprocess\n " ,
4747 " import pkg_resources\n " ,
4848 " \n " ,
49+ " def get_sagemaker_version():\n " ,
50+ " \" Return the version of 'sagemaker' in your kernel or -1 if 'sagemaker' is not installed\"\n " ,
51+ " for i in pkg_resources.working_set:\n " ,
52+ " if i.key == \" sagemaker\" :\n " ,
53+ " return \" %s==%s\" % (i.key, i.version)\n " ,
54+ " return -1\n " ,
55+ " \n " ,
56+ " # Store original 'sagemaker' version\n " ,
57+ " sagemaker_version = get_sagemaker_version()\n " ,
58+ " \n " ,
4959 " # Install any missing dependencies\n " ,
50- " !{sys.executable} -m pip install -qU 'matplotlib' 'numpy' 'pandas' ' plotly' 'sagemaker>=2.0.0' 'sklearn '\n " ,
60+ " !{sys.executable} -m pip install -qU 'plotly' 'sagemaker>=2.0.0'\n " ,
5161 " \n " ,
5262 " import numpy as np\n " ,
5363 " import pandas as pd\n " ,
239249 " %store Y_train\n " ,
240250 " %store Y_test\n " ,
241251 " %store Y_val\n " ,
242- " %store choosen_data_set"
252+ " %store choosen_data_set\n " ,
253+ " %store sagemaker_version"
243254 ]
244255 }
245256 ],
246257 "metadata" : {
247- "instance_type" : " ml.t3.medium" ,
248258 "kernelspec" : {
249259 "display_name" : " Python 3 (Data Science)" ,
250260 "language" : " python" ,
Original file line number Diff line number Diff line change 4444 "outputs" : [],
4545 "source" : [
4646 " import os\n " ,
47+ " import sys\n " ,
4748 " import plotly.express as px\n " ,
4849 " import plotly.offline as pyo\n " ,
4950 " import plotly.graph_objs as go\n " ,
9293 " %store -r Y_train\n " ,
9394 " %store -r Y_test\n " ,
9495 " %store -r Y_val\n " ,
95- " %store -r choosen_data_set"
96+ " %store -r choosen_data_set\n " ,
97+ " %store -r sagemaker_version"
9698 ]
9799 },
98100 {
269271 "source" : [
270272 " sagemaker.s3.S3Downloader.download(s3_uri=list_of_trained_models[-1], local_path='./')"
271273 ]
274+ },
275+ {
276+ "cell_type" : " markdown" ,
277+ "metadata" : {},
278+ "source" : [
279+ " Below we safe guard your kernel environment by installing your original sagemaker version."
280+ ]
281+ },
282+ {
283+ "cell_type" : " code" ,
284+ "execution_count" : null ,
285+ "metadata" : {},
286+ "outputs" : [],
287+ "source" : [
288+ " if not sagemaker_version is None:\n " ,
289+ " !{sys.executable} -m pip install -qU sagemaker_version"
290+ ]
272291 }
273292 ],
274293 "metadata" : {
275- "instance_type" : " ml.t3.medium" ,
276294 "kernelspec" : {
277295 "display_name" : " Python 3 (Data Science)" ,
278296 "language" : " python" ,
You can’t perform that action at this time.
0 commit comments