{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\nfrom IPython.display import clear_output\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\nclear_output()\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session\nimport gc, os, glob, random\nfrom os import path\nfrom pathlib import Path\n# make data\nimport polars as pl\nimport pandas as pd\npd.set_option('display.max_columns', None); # pd.set_option('display.max_rows', None)\nimport numpy as np\nfrom tqdm.auto import tqdm\nimport ydata_profiling as pdp","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-06-20T12:08:47.688275Z","iopub.execute_input":"2023-06-20T12:08:47.688913Z","iopub.status.idle":"2023-06-20T12:08:52.519560Z","shell.execute_reply.started":"2023-06-20T12:08:47.688878Z","shell.execute_reply":"2023-06-20T12:08:52.518231Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tdcsfog_path = glob.glob(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/tdcsfog/*.csv\")\ntdcsfog_metadata=pd.read_csv('../input/tlvmc-parkinsons-freezing-gait-prediction/tdcsfog_metadata.csv')\ndf_tdcsfog = pd.read_csv(\"/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/test/tdcsfog/003f117e14.csv\")\n\n# =====================================\n# load data & concat\n# =====================================\ndf_list = []\nfor idx, path in tqdm(enumerate(tdcsfog_path)):\n    df = pl.read_csv(path)\n    filename = os.path.basename(path).split(\".cs\")[0]\n    tmp = pl.DataFrame(\n        {\n            \"idx\": [idx]*len(df),\n            \"ID\": [filename]*len(df),\n            \"len_df\": len(df),\n        }\n    )\n    df = pl.concat([df, tmp], how=\"horizontal\")\n    df_list.append(df)\n    \ndf_tdcsfog = pl.concat(df_list)","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:08:52.521714Z","iopub.execute_input":"2023-06-20T12:08:52.522049Z","iopub.status.idle":"2023-06-20T12:09:06.305011Z","shell.execute_reply.started":"2023-06-20T12:08:52.522019Z","shell.execute_reply":"2023-06-20T12:09:06.304011Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.DataFrame(df_tdcsfog, columns = df_tdcsfog.columns)\ndf['class'] = np.array(df['Walking'] | df['StartHesitation'] | df['Turn'],dtype = int)","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:12:50.832066Z","iopub.execute_input":"2023-06-20T12:12:50.832870Z","iopub.status.idle":"2023-06-20T12:12:58.776344Z","shell.execute_reply.started":"2023-06-20T12:12:50.832838Z","shell.execute_reply":"2023-06-20T12:12:58.775271Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[['fog','normal']] = pd.get_dummies(df['class'], prefix='class')","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:12:58.778412Z","iopub.execute_input":"2023-06-20T12:12:58.778803Z","iopub.status.idle":"2023-06-20T12:12:59.021233Z","shell.execute_reply.started":"2023-06-20T12:12:58.778767Z","shell.execute_reply":"2023-06-20T12:12:59.020261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\n\ndef normalize_data(dataset):\n    # Compute the mean and standard deviation of the dataset\n    mean = tf.reduce_mean(dataset, axis=0)\n    std = tf.math.reduce_std(dataset, axis=0)\n    \n    # Normalize the dataset\n    normalized_dataset = (dataset - mean) / std\n    \n    return normalized_dataset\ndf[['AccV','AccML','AccAP']] = normalize_data(np.asarray(df[['AccV','AccML','AccAP']] , dtype = np.float32))","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:13:53.281641Z","iopub.execute_input":"2023-06-20T12:13:53.281983Z","iopub.status.idle":"2023-06-20T12:13:57.689512Z","shell.execute_reply.started":"2023-06-20T12:13:53.281956Z","shell.execute_reply":"2023-06-20T12:13:57.688499Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\ndf[['AccV','AccML','AccAP']][0:128].plot()","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:14:00.099282Z","iopub.execute_input":"2023-06-20T12:14:00.099633Z","iopub.status.idle":"2023-06-20T12:14:00.484183Z","shell.execute_reply.started":"2023-06-20T12:14:00.099605Z","shell.execute_reply":"2023-06-20T12:14:00.483079Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:10:52.594793Z","iopub.execute_input":"2023-06-20T12:10:52.596479Z","iopub.status.idle":"2023-06-20T12:10:52.612715Z","shell.execute_reply.started":"2023-06-20T12:10:52.596441Z","shell.execute_reply":"2023-06-20T12:10:52.611363Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_win = []\ny_win = []\n\nx = df[['AccV','AccML','AccAP']]\ny = df[['fog','normal']]\n\nfor i in range(0,len(df)-len(df)%256,128):\n    x_win.append(x[i:i+256])\n    y_win.append(y[i:i+256])\n    \nx_win.pop()\ny_win.pop()\nx_win = np.asarray(x_win,dtype = np.float32)\ny_win = np.asarray(y_win,dtype = int)","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:26:43.059162Z","iopub.execute_input":"2023-06-20T12:26:43.059922Z","iopub.status.idle":"2023-06-20T12:26:50.128038Z","shell.execute_reply.started":"2023-06-20T12:26:43.059888Z","shell.execute_reply":"2023-06-20T12:26:50.126981Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from scipy import stats\ny_win_s2l = []\nfor i in y_win:\n    y_win_s2l.append(stats.mode(i)[0][0])\ny_win_s2l = np.asarray(y_win_s2l,dtype = int)","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:26:51.509452Z","iopub.execute_input":"2023-06-20T12:26:51.509956Z","iopub.status.idle":"2023-06-20T12:26:59.424549Z","shell.execute_reply.started":"2023-06-20T12:26:51.509915Z","shell.execute_reply":"2023-06-20T12:26:59.423578Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_win_s2l.shape","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:51:41.852263Z","iopub.execute_input":"2023-06-20T13:51:41.852701Z","iopub.status.idle":"2023-06-20T13:51:41.860187Z","shell.execute_reply.started":"2023-06-20T13:51:41.852670Z","shell.execute_reply":"2023-06-20T13:51:41.859263Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sum(y_win_s2l[:, 1])/len(y_win_s2l) , sum(y_win_s2l[:, 1])*55175/len(y_win_s2l) , 55175","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:52:15.028902Z","iopub.execute_input":"2023-06-20T13:52:15.029274Z","iopub.status.idle":"2023-06-20T13:52:15.057115Z","shell.execute_reply.started":"2023-06-20T13:52:15.029245Z","shell.execute_reply":"2023-06-20T13:52:15.056139Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Importing Layers\nfrom tensorflow.keras import Sequential\nfrom tensorflow.keras.layers import LSTM,Dropout,Dense,BatchNormalization,Input,Bidirectional,Conv1D,MaxPooling1D,Flatten\nfrom tensorflow.keras import regularizers\nfrom sklearn.model_selection import train_test_split","metadata":{"execution":{"iopub.status.busy":"2023-06-20T12:26:59.426342Z","iopub.execute_input":"2023-06-20T12:26:59.426784Z","iopub.status.idle":"2023-06-20T12:26:59.542611Z","shell.execute_reply.started":"2023-06-20T12:26:59.426751Z","shell.execute_reply":"2023-06-20T12:26:59.541663Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Callbacks\nfrom keras.utils import tf_utils\nclass ModelCheckpoint_tweaked(tf.keras.callbacks.ModelCheckpoint):\n    def __init__(self,\n                   filepath,\n                   monitor='val_loss',\n                   verbose=0,\n                   save_best_only=False,\n                   save_weights_only=False,\n                   mode='auto',\n                   save_freq='epoch',\n                   options=None,\n                   **kwargs):\n        \n        #Change tf_utils source package.\n        from tensorflow.python.keras.utils import tf_utils\n        \n        super(ModelCheckpoint_tweaked, self).__init__(filepath,\n                   monitor,\n                   verbose,\n                   save_best_only,\n                   save_weights_only,\n                   mode,\n                   save_freq,\n                   options,\n                   **kwargs)\nrlr = tf.keras.callbacks.ReduceLROnPlateau(monitor=\"val_accuracy\",factor=0.5,patience=10,)\nearlystop = tf.keras.callbacks.EarlyStopping(monitor='accuracy', patience=5)\ncheckpointer = ModelCheckpoint_tweaked(filepath='best.hdf5', verbose=0, save_best_only=True)\ncsv_logger = tf.keras.callbacks.CSVLogger(\"model_history_log.csv\", append=True)","metadata":{"execution":{"iopub.status.busy":"2023-06-20T15:11:24.753944Z","iopub.execute_input":"2023-06-20T15:11:24.754435Z","iopub.status.idle":"2023-06-20T15:11:24.764455Z","shell.execute_reply.started":"2023-06-20T15:11:24.754403Z","shell.execute_reply":"2023-06-20T15:11:24.763459Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train, x_test, y_train, y_test = train_test_split(x_win, y_win_s2l, test_size=0.30, shuffle = False)\nx_test, x_val, y_test, y_val = train_test_split(x_test, y_test, test_size=0.50, shuffle = False)\n# model = tf.keras.models.load_model('./best.hdf5')\nmodel = Sequential([\n    LSTM(100, activation='relu', kernel_regularizer=regularizers.L1L2(l1=1e-5, l2=1e-4), bias_regularizer=regularizers.L2(1e-4), input_shape=(256,3), return_sequences = True ),\n    Dropout(0.2),\n    LSTM(100, activation='relu', kernel_regularizer=regularizers.L1L2(l1=1e-5, l2=1e-4), bias_regularizer=regularizers.L2(1e-4)),\n    Dropout(0.2),\n    Dense(2, activation = 'softmax') \n])\n\nmodel.compile(  optimizer = tf.keras.optimizers.Adam(learning_rate = 1e-5, clipvalue=0.5),\n                loss='categorical_crossentropy', \n                metrics=['accuracy'],\n                )\n\nmodel.summary()","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:15:41.652660Z","iopub.execute_input":"2023-06-20T13:15:41.653030Z","iopub.status.idle":"2023-06-20T13:15:41.945291Z","shell.execute_reply.started":"2023-06-20T13:15:41.653000Z","shell.execute_reply":"2023-06-20T13:15:41.944545Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.fit(x_train, y_train, batch_size = 256, epochs = 200, callbacks = [rlr,earlystop,checkpointer,csv_logger],validation_data=(x_val,y_val))","metadata":{"execution":{"iopub.status.busy":"2023-06-20T15:11:37.806271Z","iopub.execute_input":"2023-06-20T15:11:37.806996Z","iopub.status.idle":"2023-06-20T15:21:20.150549Z","shell.execute_reply.started":"2023-06-20T15:11:37.806965Z","shell.execute_reply":"2023-06-20T15:21:20.148112Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"x_train.shape","metadata":{"execution":{"iopub.status.busy":"2023-06-19T20:48:31.762860Z","iopub.execute_input":"2023-06-19T20:48:31.763285Z","iopub.status.idle":"2023-06-19T20:48:31.779154Z","shell.execute_reply.started":"2023-06-19T20:48:31.763247Z","shell.execute_reply":"2023-06-19T20:48:31.777964Z"}}},{"cell_type":"code","source":"model.evaluate(x_test,y_test)\n\ny_pred = model.predict(x_test)","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:39:52.015870Z","iopub.execute_input":"2023-06-20T13:39:52.016690Z","iopub.status.idle":"2023-06-20T13:41:14.687675Z","shell.execute_reply.started":"2023-06-20T13:39:52.016637Z","shell.execute_reply":"2023-06-20T13:41:14.686703Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nplt.plot(y_test[:,1][0:1000])\npred = np.round(y_pred[:,1][0:1000])\nplt.plot(pred)#[5000:10000]","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:41:57.810618Z","iopub.execute_input":"2023-06-20T13:41:57.810978Z","iopub.status.idle":"2023-06-20T13:41:58.086632Z","shell.execute_reply.started":"2023-06-20T13:41:57.810949Z","shell.execute_reply":"2023-06-20T13:41:58.084544Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_win_aug = []\ny_win_s2l_aug = []\nfor i in range(len(y_win_s2l)):\n    x_win_aug.append(x_win[i])\n    y_win_s2l_aug.append(y_win_s2l[i])\n    \n    if y_win_s2l[i,1]==1:\n        x_win_aug.append(x_win[i])\n        y_win_s2l_aug.append(y_win_s2l[i])\nx_win_aug = np.asarray(x_win_aug,dtype = int)\ny_win_s2l_aug = np.asarray(y_win_s2l_aug,dtype = int)","metadata":{"execution":{"iopub.status.busy":"2023-06-20T14:07:01.137248Z","iopub.execute_input":"2023-06-20T14:07:01.137677Z","iopub.status.idle":"2023-06-20T14:07:01.635434Z","shell.execute_reply.started":"2023-06-20T14:07:01.137644Z","shell.execute_reply":"2023-06-20T14:07:01.634473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_win_aug.shape,y_win_s2l_aug.shape","metadata":{"execution":{"iopub.status.busy":"2023-06-20T14:07:17.331934Z","iopub.execute_input":"2023-06-20T14:07:17.332360Z","iopub.status.idle":"2023-06-20T14:07:17.340942Z","shell.execute_reply.started":"2023-06-20T14:07:17.332326Z","shell.execute_reply":"2023-06-20T14:07:17.339976Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sum(y_win_s2l_aug[:, 1])/len(y_win_s2l_aug) , sum(y_win_s2l[:, 1])*93213/len(y_win_s2l_aug) , 93213","metadata":{"execution":{"iopub.status.busy":"2023-06-20T14:07:21.123677Z","iopub.execute_input":"2023-06-20T14:07:21.124105Z","iopub.status.idle":"2023-06-20T14:07:21.153274Z","shell.execute_reply.started":"2023-06-20T14:07:21.124075Z","shell.execute_reply":"2023-06-20T14:07:21.152256Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train, x_test, y_train, y_test = train_test_split(x_win_aug, y_win_s2l_aug, test_size=0.30, shuffle = False)\nx_test, x_val, y_test, y_val = train_test_split(x_test, y_test, test_size=0.50, shuffle = False)\n# model = tf.keras.models.load_model('./best.hdf5')\nmodel_aug = Sequential([\n    LSTM(100, activation='relu', kernel_regularizer=regularizers.L1L2(l1=1e-5, l2=1e-4), bias_regularizer=regularizers.L2(1e-4), input_shape=(256,3), return_sequences = True ),\n    Dropout(0.2),\n    LSTM(100, activation='relu', kernel_regularizer=regularizers.L1L2(l1=1e-5, l2=1e-4), bias_regularizer=regularizers.L2(1e-4)),\n    Dropout(0.2),\n    Dense(2, activation = 'softmax') \n])\n\nmodel_aug.compile(  optimizer = tf.keras.optimizers.Adam(learning_rate = 1e-6, clipvalue=0.5),\n                loss='categorical_crossentropy', \n                metrics=['accuracy'],\n                )\n\nmodel_aug.summary()","metadata":{"execution":{"iopub.status.busy":"2023-06-20T15:46:28.446925Z","iopub.execute_input":"2023-06-20T15:46:28.447317Z","iopub.status.idle":"2023-06-20T15:46:29.556997Z","shell.execute_reply.started":"2023-06-20T15:46:28.447287Z","shell.execute_reply":"2023-06-20T15:46:29.556265Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model_aug.fit(x_train, y_train, batch_size = 256, epochs = 200, callbacks = [rlr,earlystop,checkpointer,csv_logger],validation_data=(x_val,y_val))","metadata":{"execution":{"iopub.status.busy":"2023-06-20T15:46:30.895088Z","iopub.execute_input":"2023-06-20T15:46:30.895849Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_win.shape, y_win_s2l.shape","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:57:19.304753Z","iopub.execute_input":"2023-06-20T13:57:19.305239Z","iopub.status.idle":"2023-06-20T13:57:19.313750Z","shell.execute_reply.started":"2023-06-20T13:57:19.305175Z","shell.execute_reply":"2023-06-20T13:57:19.312705Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_win_s2l","metadata":{"execution":{"iopub.status.busy":"2023-06-20T14:02:36.713234Z","iopub.execute_input":"2023-06-20T14:02:36.714168Z","iopub.status.idle":"2023-06-20T14:02:36.722589Z","shell.execute_reply.started":"2023-06-20T14:02:36.714126Z","shell.execute_reply":"2023-06-20T14:02:36.721284Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nx_train, x_test, y_train, y_test = train_test_split(x_win, y_win, test_size=0.20, shuffle = False)\nmodel_s2s = Sequential([\n    LSTM(100, return_sequences = True, activation='relu', kernel_regularizer=regularizers.L1L2(l1=1e-5, l2=1e-4), bias_regularizer=regularizers.L2(1e-4), input_shape=(256,3)),\n    Dropout(0.2),\n    LSTM(100, return_sequences = True, activation='relu', kernel_regularizer=regularizers.L1L2(l1=1e-5, l2=1e-4), bias_regularizer=regularizers.L2(1e-4)),\n    Dropout(0.2),\n    Dense(2, activation = 'softmax') \n])\n\nmodel_s2s.compile(  optimizer = tf.keras.optimizers.Adam(learning_rate = 1e-6),#clipvalue=1.0),\n                loss='categorical_crossentropy', \n                metrics=['accuracy'],\n                )","metadata":{"execution":{"iopub.status.busy":"2023-06-19T23:07:38.842303Z","iopub.execute_input":"2023-06-19T23:07:38.842679Z","iopub.status.idle":"2023-06-19T23:07:38.854899Z","shell.execute_reply.started":"2023-06-19T23:07:38.842643Z","shell.execute_reply":"2023-06-19T23:07:38.853986Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# y_train = np.asarray(y_train).astype('int').reshape((-1,1))\n# y_test = np.asarray(y_test).astype('int').reshape((-1,1))\n\n# model = Sequential([\n#     Conv1D(filters=64, kernel_size=3, activation='relu',input_shape=(1500,3)),\n    \n#     Conv1D(filters=64, kernel_size=3, activation='relu'),\n#     Dropout(0.5),\n#     MaxPooling1D(pool_size=2),\n#     Flatten(),\n    \n#     Dense(1,activation = 'sigmoid')\n# ])\n\n# model.compile(  optimizer = tf.keras.optimizers.Adam(learning_rate = .1),#clipvalue=1.0),\n#                 loss='binary_crossentropy', \n#                 metrics=['accuracy'],\n#                 )\n\n# history = model.fit(x_train, y_train, batch_size = 1024, epochs = 50, callbacks = [rlr,earlystop,checkpointer,csv_logger])","metadata":{"execution":{"iopub.status.busy":"2023-06-19T23:07:38.856364Z","iopub.execute_input":"2023-06-19T23:07:38.856777Z","iopub.status.idle":"2023-06-19T23:07:38.864474Z","shell.execute_reply.started":"2023-06-19T23:07:38.856737Z","shell.execute_reply":"2023-06-19T23:07:38.863084Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import confusion_matrix\n\nconfusion_matrix(y_test[:,0], np.round(y_pred[:,0]))","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:45:22.827228Z","iopub.execute_input":"2023-06-20T13:45:22.827873Z","iopub.status.idle":"2023-06-20T13:45:22.849096Z","shell.execute_reply.started":"2023-06-20T13:45:22.827832Z","shell.execute_reply":"2023-06-20T13:45:22.848063Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nimport subprocess\nfrom IPython.display import FileLink, display\n\ndef download_file(path, download_file_name):\n    os.chdir('/kaggle/working/')\n    zip_name = f\"/kaggle/working/{download_file_name}.zip\"\n    command = f\"zip {zip_name} {path} -r\"\n    result = subprocess.run(command, shell=True, capture_output=True, text=True)\n    if result.returncode != 0:\n        print(\"Unable to run zip command!\")\n        print(result.stderr)\n        return\n    display(FileLink(f'{download_file_name}.zip'))","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:42:39.680666Z","iopub.execute_input":"2023-06-20T13:42:39.681044Z","iopub.status.idle":"2023-06-20T13:42:39.688118Z","shell.execute_reply.started":"2023-06-20T13:42:39.681015Z","shell.execute_reply":"2023-06-20T13:42:39.687157Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.save('/model_s2l')","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:42:40.475188Z","iopub.execute_input":"2023-06-20T13:42:40.475608Z","iopub.status.idle":"2023-06-20T13:42:44.662658Z","shell.execute_reply.started":"2023-06-20T13:42:40.475579Z","shell.execute_reply":"2023-06-20T13:42:44.661646Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"download_file('/model_s2l', 'model_s2l')","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:42:44.665107Z","iopub.execute_input":"2023-06-20T13:42:44.665466Z","iopub.status.idle":"2023-06-20T13:42:44.787057Z","shell.execute_reply.started":"2023-06-20T13:42:44.665435Z","shell.execute_reply":"2023-06-20T13:42:44.786093Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"download_file('/kaggle/working/model_history_log.csv','model_history_log_s2l')","metadata":{"execution":{"iopub.status.busy":"2023-06-20T13:42:45.013897Z","iopub.execute_input":"2023-06-20T13:42:45.014245Z","iopub.status.idle":"2023-06-20T13:42:45.026195Z","shell.execute_reply.started":"2023-06-20T13:42:45.014213Z","shell.execute_reply":"2023-06-20T13:42:45.025105Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history_log = pd.read_csv('/kaggle/working/model_history_log.csv')","metadata":{"execution":{"iopub.status.busy":"2023-06-19T23:12:27.654002Z","iopub.status.idle":"2023-06-19T23:12:27.654961Z","shell.execute_reply.started":"2023-06-19T23:12:27.654668Z","shell.execute_reply":"2023-06-19T23:12:27.654695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history_log['accuracy'].plot()","metadata":{"execution":{"iopub.status.busy":"2023-06-19T23:12:27.656585Z","iopub.status.idle":"2023-06-19T23:12:27.657126Z","shell.execute_reply.started":"2023-06-19T23:12:27.656846Z","shell.execute_reply":"2023-06-19T23:12:27.656886Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}