From fa9bcdeb562ba3c024189a0172f63d567b930384 Mon Sep 17 00:00:00 2001 From: Piyush Kumar Mondal <146834305+piyush182004@users.noreply.github.com> Date: Sun, 20 Oct 2024 19:13:21 +0530 Subject: [PATCH] itz_piyush --- 18ALGOStock_Price_Prediction.ipynb | 5722 ++++++++++++++++++++++++++++ 1 file changed, 5722 insertions(+) create mode 100644 18ALGOStock_Price_Prediction.ipynb diff --git a/18ALGOStock_Price_Prediction.ipynb b/18ALGOStock_Price_Prediction.ipynb new file mode 100644 index 0000000..ab521b1 --- /dev/null +++ b/18ALGOStock_Price_Prediction.ipynb @@ -0,0 +1,5722 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "id": "8tzEK_mSvRoh" + }, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "from sklearn.model_selection import train_test_split\n", + "from sklearn.impute import SimpleImputer\n", + "from sklearn.preprocessing import MinMaxScaler\n", + "from sklearn.linear_model import LinearRegression\n", + "from sklearn.svm import SVR\n", + "from sklearn.tree import DecisionTreeRegressor\n", + "from sklearn.ensemble import RandomForestRegressor, AdaBoostRegressor, GradientBoostingRegressor\n", + "from sklearn.metrics import mean_squared_error, mean_absolute_error, mean_absolute_percentage_error\n", + "from sklearn.neighbors import KNeighborsRegressor\n", + "from tensorflow.keras.models import Sequential\n", + "from tensorflow.keras.layers import Dense,LSTM" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "NbBSc2jLvZWx", + "outputId": "3d158d54-f370-4e7b-fdb8-eb7f7fac2928" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Date Open High Low Close Adj Close \\\n", + "0 01-01-1996 18.691147 18.978922 18.540184 18.823240 12.409931 \n", + "1 02-01-1996 18.894005 18.964767 17.738192 18.224106 12.014931 \n", + "2 03-01-1996 18.327892 18.568489 17.643839 17.738192 11.694577 \n", + "3 04-01-1996 17.502312 17.832542 17.223972 17.676863 11.654142 \n", + "4 05-01-1996 17.738192 17.785366 17.459852 17.577793 11.588827 \n", + "\n", + " Volume \n", + "0 43733533.0 \n", + "1 56167280.0 \n", + "2 68296318.0 \n", + "3 86073880.0 \n", + "4 76613039.0 " + ], + "text/html": [ + "\n", + "
\n", + " | Date | \n", + "Open | \n", + "High | \n", + "Low | \n", + "Close | \n", + "Adj Close | \n", + "Volume | \n", + "
---|---|---|---|---|---|---|---|
0 | \n", + "01-01-1996 | \n", + "18.691147 | \n", + "18.978922 | \n", + "18.540184 | \n", + "18.823240 | \n", + "12.409931 | \n", + "43733533.0 | \n", + "
1 | \n", + "02-01-1996 | \n", + "18.894005 | \n", + "18.964767 | \n", + "17.738192 | \n", + "18.224106 | \n", + "12.014931 | \n", + "56167280.0 | \n", + "
2 | \n", + "03-01-1996 | \n", + "18.327892 | \n", + "18.568489 | \n", + "17.643839 | \n", + "17.738192 | \n", + "11.694577 | \n", + "68296318.0 | \n", + "
3 | \n", + "04-01-1996 | \n", + "17.502312 | \n", + "17.832542 | \n", + "17.223972 | \n", + "17.676863 | \n", + "11.654142 | \n", + "86073880.0 | \n", + "
4 | \n", + "05-01-1996 | \n", + "17.738192 | \n", + "17.785366 | \n", + "17.459852 | \n", + "17.577793 | \n", + "11.588827 | \n", + "76613039.0 | \n", + "
\n", + " | Open | \n", + "High | \n", + "Low | \n", + "Close | \n", + "Volume | \n", + "
---|---|---|---|---|---|
0 | \n", + "18.691147 | \n", + "18.978922 | \n", + "18.540184 | \n", + "18.823240 | \n", + "43733533.0 | \n", + "
1 | \n", + "18.894005 | \n", + "18.964767 | \n", + "17.738192 | \n", + "18.224106 | \n", + "56167280.0 | \n", + "
2 | \n", + "18.327892 | \n", + "18.568489 | \n", + "17.643839 | \n", + "17.738192 | \n", + "68296318.0 | \n", + "
3 | \n", + "17.502312 | \n", + "17.832542 | \n", + "17.223972 | \n", + "17.676863 | \n", + "86073880.0 | \n", + "
4 | \n", + "17.738192 | \n", + "17.785366 | \n", + "17.459852 | \n", + "17.577793 | \n", + "76613039.0 | \n", + "
\n", + " | Close | \n", + "
---|---|
5286 | \n", + "257.350006 | \n", + "
3408 | \n", + "129.464996 | \n", + "
5477 | \n", + "279.350006 | \n", + "
6906 | \n", + "588.500000 | \n", + "
530 | \n", + "21.644367 | \n", + "
LinearRegression()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
LinearRegression()
SVR()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
SVR()
RandomForestRegressor()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
RandomForestRegressor()
GradientBoostingRegressor()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
GradientBoostingRegressor()
XGBRegressor(base_score=None, booster=None, callbacks=None,\n", + " colsample_bylevel=None, colsample_bynode=None,\n", + " colsample_bytree=None, device=None, early_stopping_rounds=None,\n", + " enable_categorical=False, eval_metric=None, feature_types=None,\n", + " gamma=None, grow_policy=None, importance_type=None,\n", + " interaction_constraints=None, learning_rate=None, max_bin=None,\n", + " max_cat_threshold=None, max_cat_to_onehot=None,\n", + " max_delta_step=None, max_depth=None, max_leaves=None,\n", + " min_child_weight=None, missing=nan, monotone_constraints=None,\n", + " multi_strategy=None, n_estimators=None, n_jobs=None,\n", + " num_parallel_tree=None, random_state=None, ...)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
XGBRegressor(base_score=None, booster=None, callbacks=None,\n", + " colsample_bylevel=None, colsample_bynode=None,\n", + " colsample_bytree=None, device=None, early_stopping_rounds=None,\n", + " enable_categorical=False, eval_metric=None, feature_types=None,\n", + " gamma=None, grow_policy=None, importance_type=None,\n", + " interaction_constraints=None, learning_rate=None, max_bin=None,\n", + " max_cat_threshold=None, max_cat_to_onehot=None,\n", + " max_delta_step=None, max_depth=None, max_leaves=None,\n", + " min_child_weight=None, missing=nan, monotone_constraints=None,\n", + " multi_strategy=None, n_estimators=None, n_jobs=None,\n", + " num_parallel_tree=None, random_state=None, ...)
AdaBoostRegressor()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
AdaBoostRegressor()
DecisionTreeRegressor()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
DecisionTreeRegressor()
KNeighborsRegressor()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
KNeighborsRegressor()