{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":96164,"databundleVersionId":12993472,"sourceType":"competition"}],"dockerImageVersionId":31089,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd \nimport numpy as np\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.cross_decomposition import PLSRegression as PLS","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:50:56.035902Z","iopub.execute_input":"2026-08-03T05:50:56.036349Z","iopub.status.idle":"2026-08-03T05:50:59.140909Z","shell.execute_reply.started":"2026-08-03T05:50:56.036319Z","shell.execute_reply":"2026-08-03T05:50:59.139683Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train = pd.read_parquet(\"/kaggle/input/drw-crypto-market-prediction/train.parquet\")\ntest = pd.read_parquet(\"/kaggle/input/drw-crypto-market-prediction/test.parquet\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:50:59.143375Z","iopub.execute_input":"2026-08-03T05:50:59.144162Z","iopub.status.idle":"2026-08-03T05:51:39.363366Z","shell.execute_reply.started":"2026-08-03T05:50:59.144118Z","shell.execute_reply":"2026-08-03T05:51:39.362087Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"num=9\ndef transform_df(df, n=num):\n    x=[i for i in df.columns if i not in [\"label\"]]#\"bid_qty\",\"ask_qty\", \"buy_qty\",\"sell_qty\", \"volume\", \n    temp=df[x]\n    pls=PLS(n_components=n)\n    xpls=pls.fit_transform(temp, df[\"label\"])\n    df1=pd.DataFrame()\n    df1[[f\"c{i}\" for i in range(1, n+1)]]=xpls[0]\n    df1=pd.concat([df1, df.reset_index()[[\"bid_qty\",\"ask_qty\", \"buy_qty\",\"sell_qty\", \"volume\",\"label\"]]], axis=1)\n    return df1, pls\n    \ndef transform_test(df, pls, n=num):\n    x=[i for i in df.columns if i not in [\"label\"]]\n    temp=df[x]\n    xpls=pls.transform(temp)\n    print(xpls)\n    df1=pd.DataFrame()\n    df1[[f\"c{i}\" for i in range(1, n+1)]]=xpls\n    df1=pd.concat([df1, df.reset_index()[[\"bid_qty\",\"ask_qty\", \"sell_qty\", \"buy_qty\",\"volume\"]]], axis=1)\n    return df1","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:51:39.365039Z","iopub.execute_input":"2026-08-03T05:51:39.365546Z","iopub.status.idle":"2026-08-03T05:51:39.375864Z","shell.execute_reply.started":"2026-08-03T05:51:39.365502Z","shell.execute_reply":"2026-08-03T05:51:39.374140Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:51:39.378663Z","iopub.execute_input":"2026-08-03T05:51:39.379016Z","iopub.status.idle":"2026-08-03T05:51:39.434792Z","shell.execute_reply.started":"2026-08-03T05:51:39.378958Z","shell.execute_reply":"2026-08-03T05:51:39.433631Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"temp, pls=transform_df(train, n=num)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:51:39.436114Z","iopub.execute_input":"2026-08-03T05:51:39.437010Z","iopub.status.idle":"2026-08-03T05:53:27.443273Z","shell.execute_reply.started":"2026-08-03T05:51:39.436972Z","shell.execute_reply":"2026-08-03T05:53:27.441572Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def vip_score(pls_model, X):\n    \"\"\"\n    Compute Variable Importance in Projection (VIP) scores\n    for a fitted sklearn PLSRegression model.\n    \n    Parameters\n    ----------\n    pls_model : fitted sklearn.cross_decomposition.PLSRegression\n    X : array-like, the training X data used to fit the model\n    \n    Returns\n    -------\n    vip : ndarray of shape (p,)\n        VIP score for each predictor variable\n    \"\"\"\n    t = pls_model.x_scores_       # (n_samples, n_components)\n    w = pls_model.x_weights_       # (p_features, n_components)\n    q = pls_model.y_loadings_      # (n_targets, n_components) -> use q[0] if single target\n    \n    p, A = w.shape\n    \n    # SSY explained by each component: SSY_a = q_a^2 * sum(t_a^2)\n    q_sq = np.sum(q**2, axis=0)          # sum over targets if multi-output\n    ssy = q_sq * np.sum(t**2, axis=0)    # shape (A,)\n    total_ssy = np.sum(ssy)\n    \n    # Normalize weights per component (w_a / ||w_a||)\n    w_norm = w / np.linalg.norm(w, axis=0, keepdims=True)\n    \n    vip = np.sqrt(p * (w_norm**2 @ ssy) / total_ssy)\n    \n    return vip\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.445006Z","iopub.execute_input":"2026-08-03T05:53:27.445488Z","iopub.status.idle":"2026-08-03T05:53:27.454346Z","shell.execute_reply.started":"2026-08-03T05:53:27.445421Z","shell.execute_reply":"2026-08-03T05:53:27.452735Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"vips=vip_score(pls, train)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.455856Z","iopub.execute_input":"2026-08-03T05:53:27.456584Z","iopub.status.idle":"2026-08-03T05:53:27.504503Z","shell.execute_reply.started":"2026-08-03T05:53:27.456531Z","shell.execute_reply":"2026-08-03T05:53:27.503270Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"pls.x_weights_","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.505873Z","iopub.execute_input":"2026-08-03T05:53:27.506375Z","iopub.status.idle":"2026-08-03T05:53:27.516449Z","shell.execute_reply.started":"2026-08-03T05:53:27.506332Z","shell.execute_reply":"2026-08-03T05:53:27.515005Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"best=sorted(list(zip(abs(vips), [i for i in train.columns if i not in [\"label\"]])), key=lambda x: x[0], reverse=True)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.517677Z","iopub.execute_input":"2026-08-03T05:53:27.518107Z","iopub.status.idle":"2026-08-03T05:53:27.540608Z","shell.execute_reply.started":"2026-08-03T05:53:27.518072Z","shell.execute_reply":"2026-08-03T05:53:27.539139Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"num_f=90\n#features by weights from PLS\nbest_sel=[i[1] for i in best[:num_f]]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.545780Z","iopub.execute_input":"2026-08-03T05:53:27.547088Z","iopub.status.idle":"2026-08-03T05:53:27.565888Z","shell.execute_reply.started":"2026-08-03T05:53:27.547038Z","shell.execute_reply":"2026-08-03T05:53:27.564282Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"best_sel","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.567830Z","iopub.execute_input":"2026-08-03T05:53:27.568229Z","iopub.status.idle":"2026-08-03T05:53:27.592155Z","shell.execute_reply.started":"2026-08-03T05:53:27.568185Z","shell.execute_reply":"2026-08-03T05:53:27.590817Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"base_features=best_sel+[\"ask_qty\", \"buy_qty\", \"sell_qty\", \"volume\", \"bid_qty\", \"label\"]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.593882Z","iopub.execute_input":"2026-08-03T05:53:27.594415Z","iopub.status.idle":"2026-08-03T05:53:27.609990Z","shell.execute_reply.started":"2026-08-03T05:53:27.594368Z","shell.execute_reply":"2026-08-03T05:53:27.608706Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"weights=[i[1] for i in best[:num_f]]+[1,1,1]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.611450Z","iopub.execute_input":"2026-08-03T05:53:27.611969Z","iopub.status.idle":"2026-08-03T05:53:27.630800Z","shell.execute_reply.started":"2026-08-03T05:53:27.611935Z","shell.execute_reply":"2026-08-03T05:53:27.629424Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train = train[base_features]\ntest = test[base_features]\ntrain","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:27.632041Z","iopub.execute_input":"2026-08-03T05:53:27.632514Z","iopub.status.idle":"2026-08-03T05:53:28.554103Z","shell.execute_reply.started":"2026-08-03T05:53:27.632431Z","shell.execute_reply":"2026-08-03T05:53:28.552798Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def add_features(df):\n    # Original features\n    df['bid_ask_interaction'] = df['bid_qty'] * df['ask_qty']\n    df['bid_buy_interaction'] = df['bid_qty'] * df['buy_qty']\n    df['bid_sell_interaction'] = df['bid_qty'] * df['sell_qty']\n    df['ask_buy_interaction'] = df['ask_qty'] * df['buy_qty']\n    df['ask_sell_interaction'] = df['ask_qty'] * df['sell_qty']\n\n    df['volume_weighted_sell'] = df['sell_qty'] * df['volume']\n    df['buy_sell_ratio'] = df['buy_qty'] / (df['sell_qty'] + 1e-10)\n    df['selling_pressure'] = df['sell_qty'] / (df['volume'] + 1e-10)\n    df['log_volume'] = np.log1p(df['volume'])\n\n    df['effective_spread_proxy'] = np.abs(df['buy_qty'] - df['sell_qty']) / (df['volume'] + 1e-10)\n    df['bid_ask_imbalance'] = (df['bid_qty'] - df['ask_qty']) / (df['bid_qty'] + df['ask_qty'] + 1e-10)\n    df['order_flow_imbalance'] = (df['buy_qty'] - df['sell_qty']) / (df['buy_qty'] + df['sell_qty'] + 1e-10)\n    df['liquidity_ratio'] = (df['bid_qty'] + df['ask_qty']) / (df['volume'] + 1e-10)\n    \n    # === NEW MICROSTRUCTURE FEATURES ===\n    \n    # Price Pressure Indicators\n    df['net_order_flow'] = df['buy_qty'] - df['sell_qty']\n    df['normalized_net_flow'] = df['net_order_flow'] / (df['volume'] + 1e-10)\n    df['buying_pressure'] = df['buy_qty'] / (df['volume'] + 1e-10)\n    df['volume_weighted_buy'] = df['buy_qty'] * df['volume']\n    \n    # Liquidity Depth Measures\n    df['total_depth'] = df['bid_qty'] + df['ask_qty']\n    df['depth_imbalance'] = (df['bid_qty'] - df['ask_qty']) / (df['total_depth'] + 1e-10)\n    df['relative_spread'] = np.abs(df['bid_qty'] - df['ask_qty']) / (df['total_depth'] + 1e-10)\n    df['log_depth'] = np.log1p(df['total_depth'])\n    \n    # Order Flow Toxicity Proxies\n    df['kyle_lambda'] = np.abs(df['net_order_flow']) / (df['volume'] + 1e-10)\n    df['flow_toxicity'] = np.abs(df['order_flow_imbalance']) * df['volume']\n    df['aggressive_flow_ratio'] = (df['buy_qty'] + df['sell_qty']) / (df['total_depth'] + 1e-10)\n    \n    # Market Activity Indicators\n   # df['volume_depth_ratio'] = df['volume'] / (df['total_depth'] + 1e-10)\n    df['activity_intensity'] = (df['buy_qty'] + df['sell_qty']) / (df['volume'] + 1e-10)\n    df['log_buy_qty'] = np.log1p(df['buy_qty'])\n    df['log_sell_qty'] = np.log1p(df['sell_qty'])\n    df['log_bid_qty'] = np.log1p(df['bid_qty'])\n    df['log_ask_qty'] = np.log1p(df['ask_qty'])\n    \n    # Microstructure Volatility Proxies\n    df['realized_spread_proxy'] = 2 * np.abs(df['net_order_flow']) / (df['volume'] + 1e-10)\n    df['price_impact_proxy'] = df['net_order_flow'] / (df['total_depth'] + 1e-10)\n    df['quote_volatility_proxy'] = np.abs(df['depth_imbalance'])\n    \n    # Complex Interaction Terms\n  #  df['flow_depth_interaction'] = df['net_order_flow'] * df['total_depth']\n  #  df['imbalance_volume_interaction'] = df['order_flow_imbalance'] * df['volume']\n #   df['depth_volume_interaction'] = df['total_depth'] * df['volume']\n    df['buy_sell_spread'] = np.abs(df['buy_qty'] - df['sell_qty'])\n    df['bid_ask_spread'] = np.abs(df['bid_qty'] - df['ask_qty'])\n    \n    # Information Asymmetry Measures\n   # df['trade_informativeness'] = df['net_order_flow'] / (df['bid_qty'] + df['ask_qty'] + 1e-10)\n    #df['execution_shortfall_proxy'] = df['buy_sell_spread'] / (df['volume'] + 1e-10)\n    #df['adverse_selection_proxy'] = df['net_order_flow'] / (df['total_depth'] + 1e-10) * df['volume']\n    \n    # Market Efficiency Indicators\n    df['fill_probability'] = df['volume'] / (df['buy_qty'] + df['sell_qty'] + 1e-10)\n   # df['execution_rate'] = (df['buy_qty'] + df['sell_qty']) / (df['total_depth'] + 1e-10)\n   # df['market_efficiency'] = df['volume'] / (df['bid_ask_spread'] + 1e-10)\n    \n    # Non-linear Transformations\n    #df['sqrt_volume'] = np.sqrt(df['volume'])\n   # df['sqrt_depth'] = np.sqrt(df['total_depth'])\n   # df['volume_squared'] = df['volume'] ** 2\n   # df['imbalance_squared'] = df['order_flow_imbalance'] ** 2\n    \n    # Relative Measures\n    df['bid_ratio'] = df['bid_qty'] / (df['total_depth'] + 1e-10)\n    df['ask_ratio'] = df['ask_qty'] / (df['total_depth'] + 1e-10)\n    df['buy_ratio'] = df['buy_qty'] / (df['buy_qty'] + df['sell_qty'] + 1e-10)\n    df['sell_ratio'] = df['sell_qty'] / (df['buy_qty'] + df['sell_qty'] + 1e-10)\n    \n    # Market Stress Indicators\n   # df['liquidity_consumption'] = (df['buy_qty'] + df['sell_qty']) / (df['total_depth'] + 1e-10)\n   # df['market_stress'] = df['volume'] / (df['total_depth'] + 1e-10) * np.abs(df['order_flow_imbalance'])\n    df['depth_depletion'] = df['volume'] / (df['bid_qty'] + df['ask_qty'] + 1e-10)\n    \n    # Directional Indicators\n   ## df['net_buying_ratio'] = df['net_order_flow'] / (df['volume'] + 1e-10)\n    #df['directional_volume'] = df['net_order_flow'] * np.log1p(df['volume'])\n   # df['signed_volume'] = np.sign(df['net_order_flow']) * df['volume']\n    \n    # Replace infinities and NaNs\n    df = df.replace([np.inf, -np.inf], 0).fillna(0)\n    \n    return df","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:28.555426Z","iopub.execute_input":"2026-08-03T05:53:28.555856Z","iopub.status.idle":"2026-08-03T05:53:28.576294Z","shell.execute_reply.started":"2026-08-03T05:53:28.555816Z","shell.execute_reply":"2026-08-03T05:53:28.574866Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#x_train = add_features(train)\nx_train=train\nx_train.shape\n\nimport warnings \n\nwarnings.filterwarnings('ignore')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:28.577844Z","iopub.execute_input":"2026-08-03T05:53:28.578297Z","iopub.status.idle":"2026-08-03T05:53:28.602279Z","shell.execute_reply.started":"2026-08-03T05:53:28.578257Z","shell.execute_reply":"2026-08-03T05:53:28.600787Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#scaler = StandardScaler()\n#x_train.iloc[:, :] = scaler.fit_transform(X_train)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:28.603830Z","iopub.execute_input":"2026-08-03T05:53:28.604326Z","iopub.status.idle":"2026-08-03T05:53:28.623173Z","shell.execute_reply.started":"2026-08-03T05:53:28.604279Z","shell.execute_reply":"2026-08-03T05:53:28.621978Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#x_test = add_features(test)\nx_test=test\nx_test.shape","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:28.624424Z","iopub.execute_input":"2026-08-03T05:53:28.624878Z","iopub.status.idle":"2026-08-03T05:53:28.644527Z","shell.execute_reply.started":"2026-08-03T05:53:28.624851Z","shell.execute_reply":"2026-08-03T05:53:28.643431Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Ensure the index is a datetime type\nx_train.index = pd.to_datetime(x_train.index)\n\n# Sort the dataset by timestamp (index)\nx_train = x_train.sort_index()\n\n# Define the split point (80% train, 20% validation)\nsplit_index = int(len(x_train) * 0.8)\n\n# Slice by index — NO shuffling\ntrain_split = x_train.iloc[:split_index]\nval_split = x_train.iloc[split_index:]\n\n# Training features and labels\nX_train = train_split.drop(columns=['label'])\ny_train = train_split['label']\n\n# Validation features and labels\nX_val = val_split.drop(columns=['label'])\ny_val = val_split['label']","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:28.645967Z","iopub.execute_input":"2026-08-03T05:53:28.646525Z","iopub.status.idle":"2026-08-03T05:53:29.192791Z","shell.execute_reply.started":"2026-08-03T05:53:28.646461Z","shell.execute_reply":"2026-08-03T05:53:29.191326Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"y_train.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:29.194181Z","iopub.execute_input":"2026-08-03T05:53:29.194930Z","iopub.status.idle":"2026-08-03T05:53:29.203421Z","shell.execute_reply.started":"2026-08-03T05:53:29.194892Z","shell.execute_reply":"2026-08-03T05:53:29.202256Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from xgboost import XGBRegressor\nfrom sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error\n\nXGB_PARAMS = {\n    \"tree_method\": \"hist\",\n    \"device\": \"gpu\",\n    \"colsample_bylevel\": 0.4778,\n    \"colsample_bynode\": 0.3628,\n    \"colsample_bytree\": 0.7107,\n    \"gamma\": 1.7095,\n    \"learning_rate\": 0.02213,\n    \"max_depth\": 20,\n    \"max_leaves\": 12,\n    \"min_child_weight\": 16,\n    \"n_estimators\": 1667,\n    \"subsample\": 0.06567,\n    \"reg_alpha\": 1,#39.3524,\n    \"reg_lambda\": 75.4484,\n    \"verbosity\": 0,\n    \"random_state\": 42,\n    \"n_jobs\": -1,\n    \"feature_weights\": weights\n}\n\nLEARNERS = [\n    {\"name\": \"xgb\", \"Estimator\": XGBRegressor, \"params\": XGB_PARAMS}\n]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:29.204929Z","iopub.execute_input":"2026-08-03T05:53:29.205301Z","iopub.status.idle":"2026-08-03T05:53:29.556203Z","shell.execute_reply.started":"2026-08-03T05:53:29.205271Z","shell.execute_reply":"2026-08-03T05:53:29.555081Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from xgboost import XGBRegressor\nimport numpy as np\n\nmodel = XGBRegressor(**XGB_PARAMS)\nmodel.fit(X_train, y_train)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:53:29.557650Z","iopub.execute_input":"2026-08-03T05:53:29.558083Z","iopub.status.idle":"2026-08-03T05:54:48.332793Z","shell.execute_reply.started":"2026-08-03T05:53:29.558038Z","shell.execute_reply":"2026-08-03T05:54:48.331508Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def create_time_decay_weights(n: int, decay: float = 0.9) -> np.ndarray:\n    positions = np.arange(n)\n    normalized = positions / (n - 1)\n    weights = decay ** (1.0 - normalized)\n    return weights * n / weights.sum()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:54:48.334253Z","iopub.execute_input":"2026-08-03T05:54:48.335094Z","iopub.status.idle":"2026-08-03T05:54:48.341902Z","shell.execute_reply.started":"2026-08-03T05:54:48.335054Z","shell.execute_reply":"2026-08-03T05:54:48.340596Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"y_val_pred = model.predict(X_val)\n\nfrom scipy.stats import pearsonr\n\n# Pearson correlation\npearson_corr, _ = pearsonr(y_val, y_val_pred)\n\nprint(f\"✅ Pearson Correlation: {pearson_corr:.4f}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:54:48.343570Z","iopub.execute_input":"2026-08-03T05:54:48.343973Z","iopub.status.idle":"2026-08-03T05:54:49.659831Z","shell.execute_reply.started":"2026-08-03T05:54:48.343939Z","shell.execute_reply":"2026-08-03T05:54:49.658264Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"X = x_train.drop(columns=['label'])\ny = x_train['label']\nfeature_names = X.columns.tolist()  # ✅ Save exact feature names\n\nx_test = x_test[feature_names]  # ✅ Ensure same columns, same order\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:54:49.661155Z","iopub.execute_input":"2026-08-03T05:54:49.661551Z","iopub.status.idle":"2026-08-03T05:54:50.276345Z","shell.execute_reply.started":"2026-08-03T05:54:49.661523Z","shell.execute_reply":"2026-08-03T05:54:50.275202Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#x_test=x_test.drop(columns=['label'])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:54:50.277855Z","iopub.execute_input":"2026-08-03T05:54:50.278236Z","iopub.status.idle":"2026-08-03T05:54:50.283766Z","shell.execute_reply.started":"2026-08-03T05:54:50.278204Z","shell.execute_reply":"2026-08-03T05:54:50.282578Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"y_pred = model.predict(x_test)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:54:50.284886Z","iopub.execute_input":"2026-08-03T05:54:50.285311Z","iopub.status.idle":"2026-08-03T05:54:57.938651Z","shell.execute_reply.started":"2026-08-03T05:54:50.285282Z","shell.execute_reply":"2026-08-03T05:54:57.937831Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"submission = pd.read_csv(\"/kaggle/input/drw-crypto-market-prediction/sample_submission.csv\")\nsubmission[\"prediction\"] = y_pred\nsubmission.to_csv(\"submission.csv\", index=False)\nprint(\"📁 Submission file saved as 'submission.csv'\")\nsubmission.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-03T05:54:57.942849Z","iopub.execute_input":"2026-08-03T05:54:57.943386Z","iopub.status.idle":"2026-08-03T05:54:59.180373Z","shell.execute_reply.started":"2026-08-03T05:54:57.943359Z","shell.execute_reply":"2026-08-03T05:54:59.179018Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"","metadata":{}}]}