{"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":96164,"databundleVersionId":11418275,"sourceType":"competition"}],"dockerImageVersionId":31040,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"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.idle":"2025-06-14T10:28:40.609897Z","shell.execute_reply.started":"2025-06-14T10:28:39.476433Z","shell.execute_reply":"2025-06-14T10:28:40.609002Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:28:48.308902Z","iopub.execute_input":"2025-06-14T10:28:48.309447Z","iopub.status.idle":"2025-06-14T10:28:49.181344Z","shell.execute_reply.started":"2025-06-14T10:28:48.309423Z","shell.execute_reply":"2025-06-14T10:28:49.180756Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data = pd.read_parquet('/kaggle/input/drw-crypto-market-prediction/train.parquet')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:29:13.043062Z","iopub.execute_input":"2025-06-14T10:29:13.043749Z","iopub.status.idle":"2025-06-14T10:29:40.994571Z","shell.execute_reply.started":"2025-06-14T10:29:13.043716Z","shell.execute_reply":"2025-06-14T10:29:40.991609Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:29:40.998602Z","iopub.execute_input":"2025-06-14T10:29:40.999496Z","iopub.status.idle":"2025-06-14T10:29:41.301273Z","shell.execute_reply.started":"2025-06-14T10:29:40.999321Z","shell.execute_reply":"2025-06-14T10:29:41.299008Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data.columns","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:40:53.75968Z","iopub.execute_input":"2025-06-14T10:40:53.760206Z","iopub.status.idle":"2025-06-14T10:40:53.768283Z","shell.execute_reply.started":"2025-06-14T10:40:53.76018Z","shell.execute_reply":"2025-06-14T10:40:53.767422Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data['label'].unique()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:41:05.722718Z","iopub.execute_input":"2025-06-14T10:41:05.723024Z","iopub.status.idle":"2025-06-14T10:41:05.820845Z","shell.execute_reply.started":"2025-06-14T10:41:05.723002Z","shell.execute_reply":"2025-06-14T10:41:05.820167Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train = data","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:41:21.436519Z","iopub.execute_input":"2025-06-14T10:41:21.437155Z","iopub.status.idle":"2025-06-14T10:41:21.441013Z","shell.execute_reply.started":"2025-06-14T10:41:21.437127Z","shell.execute_reply":"2025-06-14T10:41:21.44Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train['label'].plot(figsize=(15, 5), title='Target Label over Time')\nplt.ylabel('Label')\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:41:21.842465Z","iopub.execute_input":"2025-06-14T10:41:21.842778Z","iopub.status.idle":"2025-06-14T10:41:23.479052Z","shell.execute_reply.started":"2025-06-14T10:41:21.842755Z","shell.execute_reply":"2025-06-14T10:41:23.478023Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"cols = ['volume', 'buy_qty', 'sell_qty']\ntrain[cols].plot(figsize=(15, 5), title='Volume and Buy/Sell Quantities')\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:41:53.726808Z","iopub.execute_input":"2025-06-14T10:41:53.727094Z","iopub.status.idle":"2025-06-14T10:41:56.344101Z","shell.execute_reply.started":"2025-06-14T10:41:53.727075Z","shell.execute_reply":"2025-06-14T10:41:56.343218Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"corr = train.corr()\nplt.figure(figsize=(12, 6))\nsns.heatmap(corr[['label']].sort_values(by='label', ascending=False), annot=True, cmap='coolwarm')\nplt.title('Feature Correlation with Target Label')\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-14T10:47:50.666328Z","iopub.execute_input":"2025-06-14T10:47:50.667233Z","execution_failed":"2025-06-14T14:28:17.973Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train['hour'] = train.index.hour\ntrain['minute'] = train.index.minute\ntrain['weekday'] = train.index.dayofweek\n","metadata":{"trusted":true,"execution":{"execution_failed":"2025-06-14T14:28:17.976Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"sns.boxplot(x='hour', y='label', data=train)\nplt.title('Label Distribution Across Hours')\nplt.show()\n","metadata":{"trusted":true,"execution":{"execution_failed":"2025-06-14T14:28:17.976Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from sklearn.decomposition import PCA\nfrom sklearn.preprocessing import StandardScaler","metadata":{"trusted":true,"execution":{"execution_failed":"2025-06-14T14:28:17.976Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"X = train.drop(columns=['label'])\nX_scaled = StandardScaler().fit_transform(X)","metadata":{"trusted":true,"execution":{"execution_failed":"2025-06-14T14:28:17.977Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"\npca = PCA(n_components=2)\npca_result = pca.fit_transform(X_scaled)","metadata":{"trusted":true,"execution":{"execution_failed":"2025-06-14T14:28:17.978Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.figure(figsize=(8,6))\nplt.scatter(pca_result[:, 0], pca_result[:, 1], c=train['label'], cmap='viridis', alpha=0.5)\nplt.title('PCA Projection Colored by Label')\nplt.colorbar()\nplt.show()","metadata":{"trusted":true,"execution":{"execution_failed":"2025-06-14T14:28:17.978Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}