{"id":28384980,"url":"https://github.com/mohammedsohail-dev/stockpriceprediction","last_synced_at":"2025-06-26T00:33:09.487Z","repository":{"id":223922069,"uuid":"761918516","full_name":"mohammedsohail-dev/StockPricePrediction","owner":"mohammedsohail-dev","description":"The following project leverages LSTM and uses it to predict stocks ","archived":false,"fork":false,"pushed_at":"2025-04-27T07:00:15.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T11:01:51.692Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mohammedsohail-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-22T18:24:02.000Z","updated_at":"2025-05-06T16:02:33.000Z","dependencies_parsed_at":"2024-02-22T19:49:47.339Z","dependency_job_id":null,"html_url":"https://github.com/mohammedsohail-dev/StockPricePrediction","commit_stats":null,"previous_names":["mohammedsohail-dev/stockmarketpredictor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mohammedsohail-dev/StockPricePrediction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedsohail-dev%2FStockPricePrediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedsohail-dev%2FStockPricePrediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedsohail-dev%2FStockPricePrediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedsohail-dev%2FStockPricePrediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohammedsohail-dev","download_url":"https://codeload.github.com/mohammedsohail-dev/StockPricePrediction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedsohail-dev%2FStockPricePrediction/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261977522,"owners_count":23239367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-30T09:40:57.944Z","updated_at":"2025-06-26T00:33:09.477Z","avatar_url":"https://github.com/mohammedsohail-dev.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"#To run the code the user requires tensorflow, numpy ,pandas and scikit as libraries and execute it by specifying the csv file in the format provided by NASDAQ site\n\nAfter executing it the algorithm gives out a prediction of one day ahead into the future and one can analyse their knowledge on stocks. As stocks are a sensitive topic, any decision taken by you is guided by you alone, do not come at me if u lose money using this code or anything.This tool just analysizes past data and gives out a prediction, nothing more nothing less\n\n#The dataset was taken from NASDAQ's website more info can be found here https://www.nasdaq.com/market-activity/quotes/historical\n\n# 📈 Netflix Stock Price Prediction using LSTM\n\nThis project uses an **LSTM (Long Short-Term Memory)** model built with **Keras** and **TensorFlow** to predict Netflix stock prices based on historical data.\n\n![Python](https://img.shields.io/badge/Python-3.8-%233B4E68?logo=python\u0026logoColor=white)\n![TensorFlow](https://img.shields.io/badge/TensorFlow-2.10-%23FF6F00?logo=tensorflow\u0026logoColor=white)\n![Keras](https://img.shields.io/badge/Keras-2.10-%23D00000?logo=keras\u0026logoColor=white)\n![Jupyter](https://img.shields.io/badge/Jupyter-%23F37626?logo=jupyter\u0026logoColor=white)\n![NumPy](https://img.shields.io/badge/NumPy-1.21-%23013243?logo=numpy\u0026logoColor=white)\n![Pandas](https://img.shields.io/badge/Pandas-1.3-%23150458?logo=pandas\u0026logoColor=white)\n![Matplotlib](https://img.shields.io/badge/Matplotlib-%23C23733?logo=matplotlib\u0026logoColor=white)\n\n\n---\n\n## 📄 Dataset\n- File used: `Netflix_alltime.csv`\n- Columns: `Date`, `Close/Last`, `Open`, `High`, `Low`, `Volume`\n- Preprocessing:\n  - Dates are reversed (oldest first).\n  - Dollar signs (`$`) are removed.\n  - Data is converted to numeric types.\n\n---\n\n## 🛠 Libraries Used\n\n- `pandas`\n- `numpy`\n- `keras`\n- `sklearn`\n- `tensorflow`\n\n---\n\n## ⚙️ Preprocessing Steps\n\n1. **Load and clean data**  \n   - Remove dollar signs (`$`) from price columns.\n   - Reverse the order of the dataset (oldest date first).\n\n2. **Prepare time-series data**\n   - Use a **window of 10 days** (`time_steps = 10`) to predict the next day's stock features.\n\n3. **Split into train and test**\n   - 80% training, 20% testing.\n\n4. **Normalize**\n   - MinMaxScaler is applied separately to input (`X`) and output (`y`).\n\n---\n\n## 🧠 Model Architecture\n\n| Layer | Details |\n|:------|:--------|\n| 1 | `LSTM(128 units)` with `relu` activation |\n| 2 | `Dense(128 units)` |\n| 3 | `Dense(5 units)` (output layer for 5 features: Close, Open, High, Low, Volume) |\n\n- **Loss Function**: Mean Squared Error (`mse`)\n- **Optimizer**: Adam with a custom learning rate `0.001`\n- **Epochs**: 200\n- **Batch Size**: 32\n\n---\n\n## 🚀 Training Output\n\n- **Final Test Loss**: `~0.0014`\n- **Prediction Output** (example):\n  ```\n  Predicted: [[577, 3131773, 576, 587, 568]]\n  ```\n\n---\n\n## 📈 Model Performance Graphs (optional)\n\nIf needed, you can plot:\n- Loss over epochs\n- Validation loss vs training loss\n\nExample:\n```python\nimport matplotlib.pyplot as plt\n\nplt.plot(history.history['loss'], label='Training Loss')\nplt.plot(history.history['val_loss'], label='Validation Loss')\nplt.title('Model Loss Over Epochs')\nplt.ylabel('Loss')\nplt.xlabel('Epoch')\nplt.legend()\nplt.show()\n```\n\n---\n\n## 📂 How to Run\n\n1. Clone the repository.\n2. Place your `Netflix_alltime.csv` in the working directory.\n3. Install dependencies:\n   ```bash\n   pip install pandas numpy keras scikit-learn tensorflow\n   ```\n4. Run the script:\n   ```bash\n   python lstm_netflix_prediction.py\n   ```\n\n\n# 🌟 Future Improvements\n- Add **Dropout** layers for regularization.\n- Try **Bidirectional LSTM**.\n- Use **multiple stocks** to predict Netflix.\n- Predict **only 'Close'** prices instead of all 5 features if needed.\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohammedsohail-dev%2Fstockpriceprediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohammedsohail-dev%2Fstockpriceprediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohammedsohail-dev%2Fstockpriceprediction/lists"}