{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.11","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":29653,"databundleVersionId":2420395,"sourceType":"competition"}],"dockerImageVersionId":31040,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"## import os\nimport torch\nimport torch.nn as nn\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib\nimport pydicom as dicom\nimport cv2\nimport ast\n\nimport warnings\nwarnings.filterwarnings(\"ignore\")","metadata":{"execution":{"iopub.status.busy":"2026-07-04T09:22:58.697598Z","iopub.execute_input":"2026-07-04T09:22:58.697963Z"}}},{"cell_type":"code","source":"import os\nimport torch\nimport torch.nn as nn\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib\nimport pydicom as dicom\nimport cv2\nimport ast\n\nimport warnings\nwarnings.filterwarnings(\"ignore\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:36:55.432810Z","iopub.execute_input":"2026-07-10T13:36:55.433030Z","iopub.status.idle":"2026-07-10T13:37:01.692315Z","shell.execute_reply.started":"2026-07-10T13:36:55.433011Z","shell.execute_reply":"2026-07-10T13:37:01.691283Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"path = '/kaggle/input/rsna-miccai-brain-tumor-radiogenomic-classification/'\nos.listdir(path)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:01.693966Z","iopub.execute_input":"2026-07-10T13:37:01.694422Z","iopub.status.idle":"2026-07-10T13:37:01.702289Z","shell.execute_reply.started":"2026-07-10T13:37:01.694397Z","shell.execute_reply":"2026-07-10T13:37:01.701363Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"path = '/kaggle/input/rsna-miccai-brain-tumor-radiogenomic-classification/'\nos.listdir(path)\ntrain_data = pd.read_csv(path+'train_labels.csv')\nsamp_subm = pd.read_csv(path+'sample_submission.csv')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:01.703222Z","iopub.execute_input":"2026-07-10T13:37:01.703590Z","iopub.status.idle":"2026-07-10T13:37:01.844478Z","shell.execute_reply.started":"2026-07-10T13:37:01.703563Z","shell.execute_reply":"2026-07-10T13:37:01.843745Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print('Samples train:', len(train_data))\nprint('Samples test:', len(samp_subm))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:01.845271Z","iopub.execute_input":"2026-07-10T13:37:01.845550Z","iopub.status.idle":"2026-07-10T13:37:01.850738Z","shell.execute_reply.started":"2026-07-10T13:37:01.845523Z","shell.execute_reply":"2026-07-10T13:37:01.849840Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train_data.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:01.851635Z","iopub.execute_input":"2026-07-10T13:37:01.851896Z","iopub.status.idle":"2026-07-10T13:37:01.884632Z","shell.execute_reply.started":"2026-07-10T13:37:01.851869Z","shell.execute_reply":"2026-07-10T13:37:01.883798Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train_data[\"MGMT_value\"].value_counts().head(2).plot(kind = 'pie', autopct='%1.1f%%', figsize=(8, 8)).legend()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:01.885458Z","iopub.execute_input":"2026-07-10T13:37:01.885748Z","iopub.status.idle":"2026-07-10T13:37:02.300618Z","shell.execute_reply.started":"2026-07-10T13:37:01.885721Z","shell.execute_reply":"2026-07-10T13:37:02.299722Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train_data[\"MGMT_value\"].value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:02.302956Z","iopub.execute_input":"2026-07-10T13:37:02.303238Z","iopub.status.idle":"2026-07-10T13:37:02.309820Z","shell.execute_reply.started":"2026-07-10T13:37:02.303216Z","shell.execute_reply":"2026-07-10T13:37:02.308914Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"samp_subm.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:02.310832Z","iopub.execute_input":"2026-07-10T13:37:02.311197Z","iopub.status.idle":"2026-07-10T13:37:02.328589Z","shell.execute_reply.started":"2026-07-10T13:37:02.311175Z","shell.execute_reply":"2026-07-10T13:37:02.327714Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"folder = str(train_data.loc[0, 'BraTS21ID']).zfill(5)\nfolder","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:02.329567Z","iopub.execute_input":"2026-07-10T13:37:02.330159Z","iopub.status.idle":"2026-07-10T13:37:02.344975Z","shell.execute_reply.started":"2026-07-10T13:37:02.330130Z","shell.execute_reply":"2026-07-10T13:37:02.344263Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"os.listdir(path+'train/'+folder)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:02.345822Z","iopub.execute_input":"2026-07-10T13:37:02.346130Z","iopub.status.idle":"2026-07-10T13:37:02.365876Z","shell.execute_reply.started":"2026-07-10T13:37:02.346105Z","shell.execute_reply":"2026-07-10T13:37:02.364871Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print('Number of FLAIR images:', len(os.listdir(path+'train/'+folder+'/'+'FLAIR')))\nprint('Number of T1w images:', len(os.listdir(path+'train/'+folder+'/'+'T1w')))\nprint('Number of T1wCE images:', len(os.listdir(path+'train/'+folder+'/'+'T1wCE')))\nprint('Number of T2w images:', len(os.listdir(path+'train/'+folder+'/'+'T2w')))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:02.366760Z","iopub.execute_input":"2026-07-10T13:37:02.367025Z","iopub.status.idle":"2026-07-10T13:37:02.412452Z","shell.execute_reply.started":"2026-07-10T13:37:02.367001Z","shell.execute_reply":"2026-07-10T13:37:02.411703Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"path_file = ''.join([path, 'train/', folder, '/', 'FLAIR/'])\nimage = os.listdir(path_file)[0]\ndata_file = dicom.dcmread(path_file+image)\nimg = data_file.pixel_array\nprint('Image shape:', img.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:02.413281Z","iopub.execute_input":"2026-07-10T13:37:02.413921Z","iopub.status.idle":"2026-07-10T13:37:02.436812Z","shell.execute_reply.started":"2026-07-10T13:37:02.413894Z","shell.execute_reply":"2026-07-10T13:37:02.435949Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Flair Image\ndef plot_examples(row = 0, cat = 'FLAIR'): \n    folder = str(train_data.loc[row, 'BraTS21ID']).zfill(5)\n    path_file = ''.join([path, 'train/', folder, '/', cat, '/'])\n    images = os.listdir(path_file)\n    \n    fig, axs = plt.subplots(1, 5, figsize=(30, 30))\n    fig.subplots_adjust(hspace = .2, wspace=.2)\n    axs = axs.ravel()\n    \n    for num in range(5):\n        data_file = dicom.dcmread(path_file+images[num])\n        img = data_file.pixel_array\n        axs[num].imshow(img, cmap='gray')\n        axs[num].set_title(cat+' '+images[num])\n        axs[num].set_xticklabels([])\n        axs[num].set_yticklabels([])\n        \nrow = 0\nplot_examples(row = row, cat = 'FLAIR')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:02.437545Z","iopub.execute_input":"2026-07-10T13:37:02.437832Z","iopub.status.idle":"2026-07-10T13:37:03.237524Z","shell.execute_reply.started":"2026-07-10T13:37:02.437812Z","shell.execute_reply":"2026-07-10T13:37:03.236286Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#T1w Images\nplot_examples(row = row, cat = 'T1w')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:03.238542Z","iopub.execute_input":"2026-07-10T13:37:03.238815Z","iopub.status.idle":"2026-07-10T13:37:04.035329Z","shell.execute_reply.started":"2026-07-10T13:37:03.238796Z","shell.execute_reply":"2026-07-10T13:37:04.034507Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#T1wCE Images\nplot_examples(row = row, cat = 'T1wCE')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:04.036390Z","iopub.execute_input":"2026-07-10T13:37:04.036889Z","iopub.status.idle":"2026-07-10T13:37:04.802724Z","shell.execute_reply.started":"2026-07-10T13:37:04.036862Z","shell.execute_reply":"2026-07-10T13:37:04.801799Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#T2w Images\nplot_examples(row = row, cat = 'T2w')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:04.803794Z","iopub.execute_input":"2026-07-10T13:37:04.804377Z","iopub.status.idle":"2026-07-10T13:37:05.580027Z","shell.execute_reply.started":"2026-07-10T13:37:04.804345Z","shell.execute_reply":"2026-07-10T13:37:05.579221Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\nimport numpy as np\nimport pandas as pd\nimport pydicom\nimport tensorflow as tf\nfrom tensorflow.keras import layers, models\nfrom sklearn.model_selection import train_test_split\nimport cv2\nimport matplotlib.pyplot as plt\nfrom sklearn.metrics import classification_report, confusion_matrix, roc_curve, auc\n\npath = '/kaggle/input/rsna-miccai-brain-tumor-radiogenomic-classification/'\ntrain_labels = pd.read_csv(path + 'train_labels.csv')\n\nIMG_SIZE = 128\nBATCH_SIZE = 32\nEPOCHS = 15\nMODALITY = 'FLAIR' \n\ndef load_dicom_image(filepath, img_size=IMG_SIZE):\n    dicom = pydicom.dcmread(filepath)\n    img = dicom.pixel_array.astype(float)\n    img = (img - img.min()) / (img.max() - img.min())\n    img = (img * 255).astype(np.uint8)\n    img = cv2.resize(img, (img_size, img_size))\n    img = np.stack([img]*3, axis=-1)\n    return img\n\ndef load_patient_data(patient_id, num_slices=16):\n    patient_path = os.path.join(path, 'train', str(patient_id).zfill(5), MODALITY)\n    slices = []\n    if not os.path.exists(patient_path):\n        print(f\"Data tidak ditemukan untuk pasien {patient_id}\")\n        return None\n    dicom_files = sorted([f for f in os.listdir(patient_path) if f.endswith('.dcm')])\n    if not dicom_files:\n        print(f\"Tidak ada file DICOM untuk pasien {patient_id}\")\n        return None\n    step = max(1, len(dicom_files) // num_slices)\n    selected_files = dicom_files[::step][:num_slices]\n    for filename in selected_files:\n        img_path = os.path.join(patient_path, filename)\n        img = load_dicom_image(img_path)\n        slices.append(img)\n    while len(slices) < num_slices:\n        slices.append(slices[-1].copy())\n    return np.array(slices)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:05.580919Z","iopub.execute_input":"2026-07-10T13:37:05.581153Z","iopub.status.idle":"2026-07-10T13:37:22.422492Z","shell.execute_reply.started":"2026-07-10T13:37:05.581135Z","shell.execute_reply":"2026-07-10T13:37:22.421648Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"X = []\ny = []\n\nprint(\"Memuat data training...\")\nfor idx, row in train_labels.iterrows():\n    patient_id = row['BraTS21ID']\n    label = row['MGMT_value']\n    patient_data = load_patient_data(patient_id)\n    if patient_data is not None:\n        X.append(patient_data)\n        y.append(label)\n\nX = np.array(X, dtype=np.float32)\ny = np.array(y, dtype=np.float32)\n\nprint(f\"Total data yang dimuat: {len(X)} sampel\")\nprint(f\"Distribusi kelas: {np.sum(y == 1)} positif, {np.sum(y == 0)} negatif\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:37:22.423436Z","iopub.execute_input":"2026-07-10T13:37:22.423741Z","iopub.status.idle":"2026-07-10T13:38:46.595347Z","shell.execute_reply.started":"2026-07-10T13:37:22.423719Z","shell.execute_reply":"2026-07-10T13:38:46.594559Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"X_train, X_temp, y_train, y_temp = train_test_split(\n    X, y, test_size=0.4, random_state=42, stratify=y\n)\nX_val, X_test, y_val, y_test = train_test_split(\n    X_temp, y_temp, test_size=0.5, random_state=42, stratify=y_temp\n)\n\nprint(\"\\nDistribusi dataset:\")\nprint(f\"Training:   {len(X_train)} sampel\")\nprint(f\"Validation: {len(X_val)} sampel\")\nprint(f\"Test:       {len(X_test)} sampel\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:38:46.596299Z","iopub.execute_input":"2026-07-10T13:38:46.596621Z","iopub.status.idle":"2026-07-10T13:38:47.511089Z","shell.execute_reply.started":"2026-07-10T13:38:46.596597Z","shell.execute_reply":"2026-07-10T13:38:47.510176Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def build_3d_cnn(input_shape, num_classes):\n    model = models.Sequential([\n        layers.Conv3D(16, (3, 3, 3), activation='relu', padding='same', input_shape=input_shape),\n        layers.BatchNormalization(),\n        layers.MaxPooling3D((2, 2, 2)),\n        layers.Dropout(0.2),\n\n        layers.Conv3D(32, (3, 3, 3), activation='relu', padding='same'),\n        layers.BatchNormalization(),\n        layers.MaxPooling3D((2, 2, 2)),\n        layers.Dropout(0.3),\n\n        layers.Conv3D(64, (3, 3, 3), activation='relu', padding='same'),\n        layers.BatchNormalization(),\n        layers.MaxPooling3D((2, 2, 2)),\n        layers.Dropout(0.4),\n\n        layers.GlobalAveragePooling3D(),\n        layers.Dense(128, activation='relu'),\n        layers.Dropout(0.5),\n        layers.Dense(num_classes, activation='sigmoid')\n    ])\n    return model","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:38:47.511976Z","iopub.execute_input":"2026-07-10T13:38:47.512236Z","iopub.status.idle":"2026-07-10T13:38:47.518928Z","shell.execute_reply.started":"2026-07-10T13:38:47.512217Z","shell.execute_reply":"2026-07-10T13:38:47.517972Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"input_shape = (X_train.shape[1], X_train.shape[2], X_train.shape[3], X_train.shape[4])\nprint(f\"\\nInput shape: {input_shape}\")\nmodel = build_3d_cnn(input_shape, num_classes=1)\nmodel.summary()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:38:47.519783Z","iopub.execute_input":"2026-07-10T13:38:47.520048Z","iopub.status.idle":"2026-07-10T13:38:47.713990Z","shell.execute_reply.started":"2026-07-10T13:38:47.520029Z","shell.execute_reply":"2026-07-10T13:38:47.713112Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"model.compile(\n    optimizer=tf.keras.optimizers.Adam(learning_rate=0.001),\n    loss='binary_crossentropy',\n    metrics=['accuracy', tf.keras.metrics.AUC(name='auc')]\n)\n\ncallbacks = [\n    tf.keras.callbacks.EarlyStopping(\n        patience=5, monitor='val_auc', mode='max',\n        restore_best_weights=True, verbose=1\n    ),\n    tf.keras.callbacks.ReduceLROnPlateau(\n        monitor='val_loss', factor=0.2, patience=3,\n        min_lr=1e-6, verbose=1\n    ),\n    tf.keras.callbacks.ModelCheckpoint(\n        filepath='best_model.h5', save_best_only=True,\n        monitor='val_auc', mode='max', verbose=1\n    )\n]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:38:47.717549Z","iopub.execute_input":"2026-07-10T13:38:47.717849Z","iopub.status.idle":"2026-07-10T13:38:47.745775Z","shell.execute_reply.started":"2026-07-10T13:38:47.717826Z","shell.execute_reply":"2026-07-10T13:38:47.744878Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Training\nprint(\"\\nMemulai training...\")\nhistory = model.fit(\n    X_train, y_train,\n    validation_data=(X_val, y_val),\n    batch_size=BATCH_SIZE,\n    epochs=EPOCHS,\n    callbacks=callbacks\n)\n\n# Plot history training\ndef plot_history(history):\n    plt.figure(figsize=(12, 5))\n    \n    # Plot loss\n    plt.subplot(1, 2, 1)\n    plt.plot(history.history['loss'], label='Training Loss')\n    plt.plot(history.history['val_loss'], label='Validation Loss')\n    plt.title('Training and Validation Loss')\n    plt.xlabel('Epoch')\n    plt.ylabel('Loss')\n    plt.legend()\n    \n    # Plot AUC\n    plt.subplot(1, 2, 2)\n    plt.plot(history.history['auc'], label='Training AUC')\n    plt.plot(history.history['val_auc'], label='Validation AUC')\n    plt.title('Training and Validation AUC')\n    plt.xlabel('Epoch')\n    plt.ylabel('AUC')\n    plt.legend()\n    \n    plt.tight_layout()\n    plt.savefig('training_history.png')\n    plt.show()\n\nplot_history(history)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T13:38:47.746785Z","iopub.execute_input":"2026-07-10T13:38:47.747299Z","iopub.status.idle":"2026-07-10T14:24:23.592542Z","shell.execute_reply.started":"2026-07-10T13:38:47.747276Z","shell.execute_reply":"2026-07-10T14:24:23.591419Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Evaluasi pada validation set\nprint(\"\\nEvaluasi pada validation set:\")\nval_loss, val_acc, val_auc = model.evaluate(X_val, y_val)\nprint(f\"Validation Loss: {val_loss:.4f}\")\nprint(f\"Validation Accuracy: {val_acc:.4f}\")\nprint(f\"Validation AUC: {val_auc:.4f}\")\n\n# Evaluasi pada test set\nprint(\"\\nEvaluasi pada test set:\")\ntest_loss, test_acc, test_auc = model.evaluate(X_test, y_test)\nprint(f\"Test Loss: {test_loss:.4f}\")\nprint(f\"Test Accuracy: {test_acc:.4f}\")\nprint(f\"Test AUC: {test_auc:.4f}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T14:24:23.593824Z","iopub.execute_input":"2026-07-10T14:24:23.594131Z","iopub.status.idle":"2026-07-10T14:24:48.514025Z","shell.execute_reply.started":"2026-07-10T14:24:23.594108Z","shell.execute_reply":"2026-07-10T14:24:48.513172Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Prediksi pada test set\ny_pred_prob = model.predict(X_test).flatten()\ny_pred = (y_pred_prob > 0.5).astype(int)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T14:24:48.515041Z","iopub.execute_input":"2026-07-10T14:24:48.515611Z","iopub.status.idle":"2026-07-10T14:25:09.497111Z","shell.execute_reply.started":"2026-07-10T14:24:48.515583Z","shell.execute_reply":"2026-07-10T14:25:09.496178Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Classification report\nprint(\"\\nClassification Report:\")\nprint(classification_report(y_test, y_pred))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T14:25:09.498093Z","iopub.execute_input":"2026-07-10T14:25:09.498805Z","iopub.status.idle":"2026-07-10T14:25:09.512406Z","shell.execute_reply.started":"2026-07-10T14:25:09.498777Z","shell.execute_reply":"2026-07-10T14:25:09.511590Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Confusion matrix\nconf_matrix = confusion_matrix(y_test, y_pred)\nprint(\"\\nConfusion Matrix:\")\nprint(conf_matrix)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T14:25:09.513515Z","iopub.execute_input":"2026-07-10T14:25:09.514012Z","iopub.status.idle":"2026-07-10T14:25:09.528661Z","shell.execute_reply.started":"2026-07-10T14:25:09.513984Z","shell.execute_reply":"2026-07-10T14:25:09.527659Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Plot ROC curve\nfpr, tpr, thresholds = roc_curve(y_test, y_pred_prob)\nroc_auc = auc(fpr, tpr)\n\nplt.figure()\nplt.plot(fpr, tpr, color='darkorange', lw=2, label=f'ROC curve (area = {roc_auc:.2f})')\nplt.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')\nplt.xlim([0.0, 1.0])\nplt.ylim([0.0, 1.05])\nplt.xlabel('False Positive Rate')\nplt.ylabel('True Positive Rate')\nplt.title('Receiver Operating Characteristic')\nplt.legend(loc=\"lower right\")\nplt.savefig('roc_curve.png')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T14:25:09.530464Z","iopub.execute_input":"2026-07-10T14:25:09.530949Z","iopub.status.idle":"2026-07-10T14:25:09.827975Z","shell.execute_reply.started":"2026-07-10T14:25:09.530916Z","shell.execute_reply":"2026-07-10T14:25:09.827015Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Simpan model akhir\nmodel.save('final_model.h5')\nprint(\"\\nModel akhir disimpan sebagai 'final_model.h5'\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-10T14:25:09.828956Z","iopub.execute_input":"2026-07-10T14:25:09.829237Z","iopub.status.idle":"2026-07-10T14:25:09.894742Z","shell.execute_reply.started":"2026-07-10T14:25:09.829217Z","shell.execute_reply":"2026-07-10T14:25:09.893820Z"}},"outputs":[],"execution_count":null}]}