{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":20182,"databundleVersionId":1117628,"sourceType":"competition"}],"dockerImageVersionId":31234,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"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\n\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))\n\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","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:12.728544Z","iopub.execute_input":"2026-01-15T17:09:12.728792Z","iopub.status.idle":"2026-01-15T17:09:13.005801Z","shell.execute_reply.started":"2026-01-15T17:09:12.728764Z","shell.execute_reply":"2026-01-15T17:09:13.005123Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Libraries Importing ","metadata":{}},{"cell_type":"code","source":"import random\nimport matplotlib.pyplot as plt\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import Ridge\nfrom sklearn.metrics import mean_squared_error, r2_score\nfrom sklearn.preprocessing import StandardScaler\nimport tensorflow as tf\nfrom tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import Conv1D, MaxPooling1D, Flatten, Dense, Dropout, GlobalAveragePooling1D, BatchNormalization\nfrom tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau\nfrom tensorflow.keras.regularizers import l2","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:13.006871Z","iopub.execute_input":"2026-01-15T17:09:13.007337Z","iopub.status.idle":"2026-01-15T17:09:16.363802Z","shell.execute_reply.started":"2026-01-15T17:09:13.007301Z","shell.execute_reply":"2026-01-15T17:09:16.363224Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Set Random seeds\nSEED = 42\n\nos.environ[\"PYTHONHASHSEED\"] = str(SEED)\nrandom.seed(SEED)\nnp.random.seed(SEED)\ntf.random.set_seed(SEED)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.365586Z","iopub.execute_input":"2026-01-15T17:09:16.366033Z","iopub.status.idle":"2026-01-15T17:09:16.369940Z","shell.execute_reply.started":"2026-01-15T17:09:16.366009Z","shell.execute_reply":"2026-01-15T17:09:16.369318Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Exploring Datasets","metadata":{}},{"cell_type":"code","source":"#preview info file\nwith open ('/kaggle/input/gene-expression-prediction-cs1850-final/info.py','r') as f:\n    print(f.read())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.370596Z","iopub.execute_input":"2026-01-15T17:09:16.370802Z","iopub.status.idle":"2026-01-15T17:09:16.381700Z","shell.execute_reply.started":"2026-01-15T17:09:16.370782Z","shell.execute_reply":"2026-01-15T17:09:16.381018Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Load training dataset\ntrain_data = np.load('/kaggle/input/gene-expression-prediction-cs1850-final/train.npz',allow_pickle=True)\nlen(train_data.files)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.382718Z","iopub.execute_input":"2026-01-15T17:09:16.382969Z","iopub.status.idle":"2026-01-15T17:09:16.396431Z","shell.execute_reply.started":"2026-01-15T17:09:16.382950Z","shell.execute_reply":"2026-01-15T17:09:16.395901Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Load testing dataset\neval_data = np.load('/kaggle/input/gene-expression-prediction-cs1850-final/eval.npz',allow_pickle=True)\nlen(eval_data.files)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.397120Z","iopub.execute_input":"2026-01-15T17:09:16.397391Z","iopub.status.idle":"2026-01-15T17:09:16.402430Z","shell.execute_reply.started":"2026-01-15T17:09:16.397364Z","shell.execute_reply":"2026-01-15T17:09:16.401781Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Explore the training data\ntrain_data.files[:5]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.403181Z","iopub.execute_input":"2026-01-15T17:09:16.403428Z","iopub.status.idle":"2026-01-15T17:09:16.414218Z","shell.execute_reply.started":"2026-01-15T17:09:16.403397Z","shell.execute_reply":"2026-01-15T17:09:16.413578Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#select one cell type and check its shape\nE065 = train_data['E065']\nE065.shape","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.415099Z","iopub.execute_input":"2026-01-15T17:09:16.415448Z","iopub.status.idle":"2026-01-15T17:09:16.575269Z","shell.execute_reply.started":"2026-01-15T17:09:16.415419Z","shell.execute_reply":"2026-01-15T17:09:16.574510Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#preview the 1st gene, second bin, all columns of E065 cell type\nE065[0,1,:]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.576275Z","iopub.execute_input":"2026-01-15T17:09:16.576517Z","iopub.status.idle":"2026-01-15T17:09:16.582358Z","shell.execute_reply.started":"2026-01-15T17:09:16.576495Z","shell.execute_reply":"2026-01-15T17:09:16.581462Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"- **First column:** gene ID\n- **Second-sixth columns:** histone modification measurements\n- **Seventh column:** gene expression","metadata":{}},{"cell_type":"code","source":"# Gene ID is constant across bins\nprint(np.unique(E065[0, :, 0]))\n\n# Expression value is constant across bins\nprint(np.unique(E065[0, :, 6]))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.583183Z","iopub.execute_input":"2026-01-15T17:09:16.583400Z","iopub.status.idle":"2026-01-15T17:09:16.596076Z","shell.execute_reply.started":"2026-01-15T17:09:16.583381Z","shell.execute_reply":"2026-01-15T17:09:16.595476Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Separate target and features\nhistone_features = E065[:,:,1:6]\nExpression = E065[:,:,6]\nprint(histone_features.shape)\nprint(Expression.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.597035Z","iopub.execute_input":"2026-01-15T17:09:16.597306Z","iopub.status.idle":"2026-01-15T17:09:16.606719Z","shell.execute_reply.started":"2026-01-15T17:09:16.597280Z","shell.execute_reply":"2026-01-15T17:09:16.605943Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"- 16000 genes\n- 100 bins\n- 5 histone markers","metadata":{}},{"cell_type":"code","source":"# Keys to npzfile of train & eval\ntrain_cells = ['E065', 'E004', 'E066', 'E005', 'E012', 'E027', 'E053', 'E013', 'E028', 'E061', 'E109', 'E120',\n               'E062', 'E037', 'E038', 'E024', 'E105', 'E011', 'E106', 'E082', 'E097', 'E116', 'E098', 'E058', \n'E117', 'E059', 'E070', 'E118', 'E085', 'E104', 'E119', 'E006', 'E127', 'E047', 'E094', 'E007', 'E054', 'E128',\n               'E095', 'E055', 'E114', 'E100', 'E056', 'E016', 'E122', 'E057', 'E123', 'E079', 'E003', 'E050']\n\neval_cells = ['E065', 'E004', 'E066', 'E005', 'E012', 'E027', 'E053', 'E013', 'E028', 'E061', 'E109', 'E120', \n              'E062', 'E037', 'E038', 'E024', 'E071', 'E105', 'E087', 'E011', 'E106', 'E096', 'E082', 'E097', \n'E116', 'E098', 'E058', 'E117', 'E084', 'E059', 'E070', 'E118', 'E085', 'E104', 'E119', 'E006', 'E112', 'E127',\n              'E047', 'E094', 'E007', 'E054', 'E113', 'E128', 'E095', 'E055', 'E114', 'E100', 'E056', 'E016', 'E122',\n              'E057', 'E123', 'E079', 'E003', 'E050']","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.607624Z","iopub.execute_input":"2026-01-15T17:09:16.607903Z","iopub.status.idle":"2026-01-15T17:09:16.618447Z","shell.execute_reply.started":"2026-01-15T17:09:16.607864Z","shell.execute_reply":"2026-01-15T17:09:16.617783Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Combine Train Data to use information from all cells\ntrain_inputs = [] # histone mark data (X)\ntrain_outputs = [] # expression value (y)\nfor cell in train_cells:\n    cell_data = train_data[cell]\n    hm_data = cell_data[:,:,1:6]\n    hm_flat = hm_data.reshape(hm_data.shape[0], -1)\n    exp_values = cell_data[:,0,6]\n    train_inputs.append(hm_flat)\n    train_outputs.append(exp_values)\n\ntrain_inputs = np.concatenate(train_inputs, axis=0)\ntrain_outputs = np.concatenate(train_outputs, axis=0)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:16.619351Z","iopub.execute_input":"2026-01-15T17:09:16.619797Z","iopub.status.idle":"2026-01-15T17:09:25.595526Z","shell.execute_reply.started":"2026-01-15T17:09:16.619768Z","shell.execute_reply":"2026-01-15T17:09:25.594544Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(train_inputs.shape)\nprint(train_outputs.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:25.598534Z","iopub.execute_input":"2026-01-15T17:09:25.598825Z","iopub.status.idle":"2026-01-15T17:09:25.602927Z","shell.execute_reply.started":"2026-01-15T17:09:25.598801Z","shell.execute_reply":"2026-01-15T17:09:25.602148Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Prepare Eval inputs in a similar way\neval_inputs = []\nfor cell in eval_cells:\n    cell_data = eval_data[cell]\n    hm_data = cell_data[:,:,1:6]\n    eval_inputs.append(hm_data)\n\neval_inputs = np.concatenate(eval_inputs, axis=0)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:25.603818Z","iopub.execute_input":"2026-01-15T17:09:25.604180Z","iopub.status.idle":"2026-01-15T17:09:27.569704Z","shell.execute_reply.started":"2026-01-15T17:09:25.604158Z","shell.execute_reply":"2026-01-15T17:09:27.568850Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(eval_inputs.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:27.570624Z","iopub.execute_input":"2026-01-15T17:09:27.570877Z","iopub.status.idle":"2026-01-15T17:09:27.574798Z","shell.execute_reply.started":"2026-01-15T17:09:27.570848Z","shell.execute_reply":"2026-01-15T17:09:27.574153Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#explore the expression values statistically\n\nprint(\"Mean:\", np.mean(train_outputs))\nprint(\"Std:\", np.std(train_outputs))\nprint(\"Min:\", np.min(train_outputs))\nprint(\"Max:\", np.max(train_outputs))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:27.575681Z","iopub.execute_input":"2026-01-15T17:09:27.575926Z","iopub.status.idle":"2026-01-15T17:09:27.591324Z","shell.execute_reply.started":"2026-01-15T17:09:27.575899Z","shell.execute_reply":"2026-01-15T17:09:27.590621Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# visualize the distribution\nplt.hist(train_outputs, bins=100)\nplt.xlabel(\"Expression value\")\nplt.ylabel(\"Frequency\")\nplt.title(\"Distribution of normalized gene expression\")\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:27.592121Z","iopub.execute_input":"2026-01-15T17:09:27.592346Z","iopub.status.idle":"2026-01-15T17:09:27.806870Z","shell.execute_reply.started":"2026-01-15T17:09:27.592327Z","shell.execute_reply":"2026-01-15T17:09:27.806171Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Model Building","metadata":{}},{"cell_type":"markdown","source":"### Baseline Model","metadata":{}},{"cell_type":"code","source":"# Train/validation split\nX_train, X_val, y_train, y_val = train_test_split(train_inputs,train_outputs,test_size=0.2, random_state=42)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:27.807773Z","iopub.execute_input":"2026-01-15T17:09:27.808157Z","iopub.status.idle":"2026-01-15T17:09:28.371363Z","shell.execute_reply.started":"2026-01-15T17:09:27.808114Z","shell.execute_reply":"2026-01-15T17:09:28.370771Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(X_train.shape)\nprint(X_val.shape)\nprint(y_train.shape)\nprint(y_val.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:28.372228Z","iopub.execute_input":"2026-01-15T17:09:28.372501Z","iopub.status.idle":"2026-01-15T17:09:28.376841Z","shell.execute_reply.started":"2026-01-15T17:09:28.372479Z","shell.execute_reply":"2026-01-15T17:09:28.376035Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"model = Ridge(alpha=1.0)\n\nmodel.fit(X_train, y_train)\n\ny_pred = model.predict(X_val)\n\nmse = mean_squared_error(y_val, y_pred)\nr2 = r2_score(y_val, y_pred)\n\nprint(\"MSE:\", mse)\nprint(\"R²:\", r2)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:28.377636Z","iopub.execute_input":"2026-01-15T17:09:28.377842Z","iopub.status.idle":"2026-01-15T17:09:30.909598Z","shell.execute_reply.started":"2026-01-15T17:09:28.377822Z","shell.execute_reply":"2026-01-15T17:09:30.906737Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Build 1D CNN model","metadata":{}},{"cell_type":"code","source":"#converting the training data shape back to its original shape\nX = train_inputs.reshape(800000, 100, 5)\n#converting the evaluation data shape back to its original shape\ny = train_outputs","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:30.910536Z","iopub.execute_input":"2026-01-15T17:09:30.913430Z","iopub.status.idle":"2026-01-15T17:09:30.917016Z","shell.execute_reply.started":"2026-01-15T17:09:30.913399Z","shell.execute_reply":"2026-01-15T17:09:30.916357Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#train/validate split\nX_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.2, random_state=42)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:30.917791Z","iopub.execute_input":"2026-01-15T17:09:30.918036Z","iopub.status.idle":"2026-01-15T17:09:31.530086Z","shell.execute_reply.started":"2026-01-15T17:09:30.918011Z","shell.execute_reply":"2026-01-15T17:09:31.529490Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#scaling the target\nscaler = StandardScaler()\ny_train_scaled = scaler.fit_transform(y_train.reshape(-1, 1)).ravel()\ny_val_scaled = scaler.transform(y_val.reshape(-1, 1)).ravel()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:31.530982Z","iopub.execute_input":"2026-01-15T17:09:31.531220Z","iopub.status.idle":"2026-01-15T17:09:31.542499Z","shell.execute_reply.started":"2026-01-15T17:09:31.531198Z","shell.execute_reply":"2026-01-15T17:09:31.541799Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Cov1D structure\nfrom tensorflow.keras.layers import SpatialDropout1D, Bidirectional, LSTM, Flatten,Activation\n\nmodel = Sequential([\n    # Initial extraction with Spatial Dropout\n    Conv1D(64, kernel_size=5, padding=\"same\", input_shape=(100, 5)),\n    BatchNormalization(),\n    Activation('relu'),\n    SpatialDropout1D(0.2),\n\n    # Dilation to capture wider context\n    Conv1D(128, kernel_size=3, padding=\"same\", dilation_rate=2),\n    BatchNormalization(),\n    Activation('relu'),\n    MaxPooling1D(pool_size=2),\n\n    # Hybrid step: Capture temporal dependencies\n    Bidirectional(LSTM(64, return_sequences=False)),\n\n    Dense(128, activation='relu'),\n    Dropout(0.4),\n    Dense(1, activation='linear')\n])\n\nmodel.compile(\n    optimizer = tf.keras.optimizers.Adam(learning_rate=1e-3),\n    loss = 'mse',\n    metrics = ['mse']\n)\n\nmodel.summary()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:31.543466Z","iopub.execute_input":"2026-01-15T17:09:31.543752Z","iopub.status.idle":"2026-01-15T17:09:32.763509Z","shell.execute_reply.started":"2026-01-15T17:09:31.543720Z","shell.execute_reply":"2026-01-15T17:09:32.762945Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"early_stop = EarlyStopping(monitor='val_loss', patience=5,   restore_best_weights=True)\n\nReducedlr = ReduceLROnPlateau(monitor=\"val_loss\", factor=0.5, patience=2, min_lr=1e-5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:09:32.764319Z","iopub.execute_input":"2026-01-15T17:09:32.764638Z","iopub.status.idle":"2026-01-15T17:09:32.768401Z","shell.execute_reply.started":"2026-01-15T17:09:32.764616Z","shell.execute_reply":"2026-01-15T17:09:32.767705Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#train \nhistory = model.fit( X_train, y_train_scaled, validation_data=(X_val, y_val_scaled),\n    epochs=50,batch_size= 128, verbose=1,callbacks=[early_stop,Reducedlr])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:10:02.232389Z","iopub.execute_input":"2026-01-15T17:10:02.232961Z","iopub.status.idle":"2026-01-15T17:37:10.526414Z","shell.execute_reply.started":"2026-01-15T17:10:02.232933Z","shell.execute_reply":"2026-01-15T17:37:10.525540Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# evaluate \ny_val_pred = model.predict(X_val).ravel()\n\nmse = mean_squared_error(y_val_scaled, y_val_pred)\nr2 = r2_score(y_val_scaled, y_val_pred)\n\nprint(f\"MSE: {mse:.3f}\")\nprint(f\"R²: {r2:.3f}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:37:10.527743Z","iopub.execute_input":"2026-01-15T17:37:10.528037Z","iopub.status.idle":"2026-01-15T17:37:28.513629Z","shell.execute_reply.started":"2026-01-15T17:37:10.528012Z","shell.execute_reply":"2026-01-15T17:37:28.512761Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Prediction and Submission","metadata":{}},{"cell_type":"code","source":"#preview submission format\nsub = pd.read_csv('/kaggle/input/gene-expression-prediction-cs1850-final/sample_submission.csv')\nsub.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:38:07.926646Z","iopub.execute_input":"2026-01-15T17:38:07.927524Z","iopub.status.idle":"2026-01-15T17:38:08.149652Z","shell.execute_reply.started":"2026-01-15T17:38:07.927480Z","shell.execute_reply":"2026-01-15T17:38:08.149032Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"sub.shape","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:38:08.157321Z","iopub.execute_input":"2026-01-15T17:38:08.157556Z","iopub.status.idle":"2026-01-15T17:38:08.162440Z","shell.execute_reply.started":"2026-01-15T17:38:08.157534Z","shell.execute_reply":"2026-01-15T17:38:08.161689Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Making Predictions using the testing dataset\ny_eval_pred = model.predict(eval_inputs).squeeze()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:38:08.337484Z","iopub.execute_input":"2026-01-15T17:38:08.338085Z","iopub.status.idle":"2026-01-15T17:38:28.371938Z","shell.execute_reply.started":"2026-01-15T17:38:08.338063Z","shell.execute_reply":"2026-01-15T17:38:28.371051Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Reformating the prediction to resample the submission format\ncell_list = []\ngene_list = []\n\nfor cell in eval_cells:\n    cell_data = eval_data[cell]\n    n_genes = cell_data.shape[0]\n    \n    cell_list.extend([cell] * n_genes)\n    gene_list.extend(cell_data[:, 0, 0].astype(int))\n\nids = [f\"{cell}_{gene}\" for cell, gene in zip(cell_list, gene_list)]\n\nsubmission = pd.DataFrame({\n    \"id\": ids,\n    \"expression\": y_eval_pred\n})\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:38:28.373382Z","iopub.execute_input":"2026-01-15T17:38:28.373792Z","iopub.status.idle":"2026-01-15T17:38:30.094300Z","shell.execute_reply.started":"2026-01-15T17:38:28.373759Z","shell.execute_reply":"2026-01-15T17:38:30.093484Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#Importing to CSV\nsubmission.to_csv(\"submission.csv\", index=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:38:30.095328Z","iopub.execute_input":"2026-01-15T17:38:30.095708Z","iopub.status.idle":"2026-01-15T17:38:30.364753Z","shell.execute_reply.started":"2026-01-15T17:38:30.095675Z","shell.execute_reply":"2026-01-15T17:38:30.364164Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"pd.read_csv('/kaggle/working/submission.csv').head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-15T17:38:30.365999Z","iopub.execute_input":"2026-01-15T17:38:30.366269Z","iopub.status.idle":"2026-01-15T17:38:30.466842Z","shell.execute_reply.started":"2026-01-15T17:38:30.366230Z","shell.execute_reply":"2026-01-15T17:38:30.466071Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}