diff --git a/README.md b/README.md index 4dc36cd74a..d7126e5c64 100644 --- a/README.md +++ b/README.md @@ -156,112 +156,7 @@ The six major areas of data science include the following: | Content List | | --------------- | -| [Advanced Visualizations](Advanced%20Visualizations) | -| [Alzheimer's Disease Predictor](Alzheimer's%20Disease%20Predictor) | -| [Analysis And predict_Black_friday_sale](Analysis_&_predict_Black_friday_sale) | -| [Audio Classification](Audio%20Classification) | -| [Automatic Summarization of Scientific Papers](Automatic%20Summarization%20of%20Scientific%20Papers) | -| [Basics of ML and DL](Basics%20of%20ML%20and%20DL) | -| [Basics of Power Bi](Basics%20of%20Power%20Bi) | -| [Basics of the Python](Basics%20of%20the%20Python) | -| [Bidirectional LSTM](Bidirectional%20LSTM) | -| [Bird Species Classification Web App](Bird%20Species%20Classification%20Web%20App) | -| [Bitcoin Price Prediction Web App](Bitcoin%20Price%20Prediction%20Web%20App) | -| [Bitcoin Price Predictor](Bitcoin%20Price%20Predictor) | -| [CBT_ChatBot](CBT_ChatBot) | -| [COVID_19-DATA-ANALYSIS](COVID_19-DATA-ANALYSIS) | -| [Cheat Sheets](Cheat%20Sheets) | -| [Class Imbalance problem](Class%20Imbalance%20problem) | -| [Classification Algorithms](Classification%20Algorithms) | -| [Cloud Details](Cloud%20Details) | -| [Covid19 forecasting with prophet](Covid19%20forecasting%20with%20prophet) | -| [Covid_Third_Wave_Forecasting](Covid_Third_Wave_Forecasting) | -| [CrowdAI Plant Disease](CrowdAI%20Plant%20Disease) | -| [Customer Segmentation using Machine Learning](Customer%20Segmentation%20using%20Machine%20Learning) | -| [Data Cleaning Techniques](Data%20Cleaning%20Techniques) | -| [Data Filling and Cleaning Techniques](Data%20Filling%20and%20Cleaning%20Techniques) | -| [Different types of Clustering](Different%20types%20of%20Clustering) | -| [Different types of feature selection techniques](Different%20types%20of%20feature%20selection%20techniques) | -| [Different_types_of_scaling_Method](Different_types_of_scaling_Method) | -| [Driver_Drowsiness_Detection](Driver_Drowsiness_Detection) | -| [EDA-and-Perform-Modelling-on-Ionosphere-Dataset-main](EDA-and-Perform-Modelling-on-Ionosphere-Dataset-main) | -| [Email Classifier](Email%20Classifier) | -| [Emotion Recognition Based on NLP](Emotion%20Recognition%20Based%20on%20NLP) | -| [Ensemble Methds in ML](Ensemble%20Methds%20in%20ML) | -| [Explaination and Example for P value with code](Explaination%20and%20Example%20for%20P%20value%20with%20code) | -| [Exploratory-data-analysis](Exploratory-data-analysis) | -| [Extract_Text_from_PDF_using_Python](Extract_Text_from_PDF_using_Python) | -| [Fake_News_Detection](Fake_News_Detection) | -| [File of SQL Commands](File%20of%20SQL%20Commands) | -| [Fish-Weight-Estimation](Fish-Weight-Estimation) | -| [Flight_delay_prediction_project](Flight_delay_prediction_project) | -| [GDP Prediction](GDP%20Prediction) | -| [GUI-JARVIS](GUI-JARVIS) | -| [Gender Pay Gap Analysis](Gender%20Pay%20Gap%20Analysis) | -| [Google Teachable Machine](Google%20Teachable%20Machine) | -| [Handwritten Equation Solver using CNN](Handwritten%20Equation%20Solver%20using%20CNN) | -| [Handwritten character recognition](Handwritten%20character%20recognition) | -| [Heart_Predection](Heart_Predection) | -| [HollywoodMarketSynopsis](HollywoodMarketSynopsis) | -| [IMDB Box Office Prediction](IMDB%20Box%20Office%20Prediction) | -| [LanguageDetection](LanguageDetection) | -| [Medical Charges for Smokers and Non-smoker](Medical%20Charges%20for%20Smokers%20and%20Non-smoker) | -| [Medical_Help_Chatbot](Medical_Help_Chatbot) | -| [Meteorite Landing Data Analysis](Meteorite%20Landing%20Data%20Analysis) | -| [Movie-Recommendation-System](Movie-Recommendation-System) | -| [Movie-Recommender-System using python](Movie-Recommender-System%20using%20python) | -| [Nasa-Asteroids-Dataset-Analysis](Nasa-Asteroids-Dataset-Analysis) | -| [NumPy - Basics](NumPy%20-%20Basics) | -| [Number_of_people_counter](Number_of_people_counter) | -| [OCR-Medicine-Reader](OCR-Medicine-Reader) | -| [Object Detection](Object%20Detection) | -| [Ola Bike Ride Request Demand Forecast](Ola%20Bike%20Ride%20Request%20Demand%20Forecast) | -| [Optical character recognition (OCR)](Optical%20character%20recognition%20(OCR)) | -| [Plant Seedlings Classification](Plant%20Seedlings%20Classification) | -| [R language](R%20language) | -| [Random forest from scratch](Random%20forest%20from%20scratch) | -| [Random forest test](Random%20forest%20test) | -| [Rock Paper Scissors Python Game](Rock%20Paper%20Scissors%20Python%20Game) | -| [Sentiment analysis for depression based on social media posts](Sentiment%20analysis%20for%20depression%20based%20on%20social%20media%20posts) | -| [Sentiment-Analysis](Sentiment-Analysis) | -| [Skin Disease Predictor](Skin%20Disease%20Predictor) | -| [Spam Mail Detection](Spam%20Mail%20Detection) | -| [Speech_Emotion_Recognition](Speech_Emotion_Recognition) | -| [Spelling Corrector](Spelling%20Corrector) | -| [Sports Analytics Project](Sports%20Analytics%20Project) | -| [Startup_Profit_Prediction](Startup_Profit_Prediction) | -| [Stock Price Analysis](Stock%20Price%20Analysis) | -| [Sudoku Solver using CNN](Sudoku%20Solver%20using%20CNN) | -| [Tensorflow.js Demo](Tensorflow.js%20Demo) | -| [Time Series Forecasting with Python](Time%20Series%20Forecasting%20with%20Python) | -| [Time-Series LSTM Model](Time-Series%20LSTM%20Model) | -| [Unique Chatbot](Unique%20Chatbot) | -| [Various Plots using Matplot,Seaborn,Pandas](Various%20Plots%20using%20Matplot%2CSeaborn%2CPandas) | -| [Vehicles and Pedestrian Detection](Vehicles%20and%20Pedestrian%20Detection) | -| [Weather Prediction](Weather%20Prediction) | -| [Web-Scraping-with-Beautiful-Soup-master](Web-Scraping-with-Beautiful-Soup-master) | -| [XgBoost_Algorithm](XgBoost_Algorithm) | -| [ensemble-methods-notebooks-master](ensemble-methods-notebooks-master) | -| [heart failure](heart%20failure) | -| [job_Advertisement_detection](job_Advertisement_detection) | -| [logistic_regression_scratch](logistic_regression_scratch) | -| [recommendation_system](recommendation_system) | -| [.DS_Store](.DS_Store) | -| [Analysis_of_Temperature_Rise_in_PMSM.ipynb](Analysis_of_Temperature_Rise_in_PMSM.ipynb) | -| [Beautiful Soup.ipynb](Beautiful%20Soup.ipynb) | -| [Ensemble learning.docx](Ensemble%20learning.docx) | -| [Ensemble-Learning (Stacking)](Ensemble-Learning%20(Stacking)) | -| [Machine Hack -1.ipynb](Machine%20Hack%20-1.ipynb) | -| [README.md updated file](README.md%20updated%20file) | -| [Role_from_Resume.ipynb](Role_from_Resume.ipynb) | -| [Sql](Sql) | -| [Statistics- Basics.ipynb](Statistics-%20Basics.ipynb) | -| [Test Task_NIket.ipynb](Test%20Task_NIket.ipynb) | -| [UBER_DATA_ANALYSIS.ipynb](UBER_DATA_ANALYSIS.ipynb) | -| [Various_Plots_in_Matplotlib.ipynb](Various_Plots_in_Matplotlib.ipynb) | -| [Visualization with Seaborn & Matplotlib.ipynb](Visualization%20%20with%20Seaborn%20%26%20Matplotlib.ipynb) | -| [buyer_s_time234.ipynb](buyer_s_time234.ipynb) | -| [random_forest.py](random_forest.py) | + ### Note: diff --git a/StudentMarksPrediction/Readme.md b/StudentMarksPrediction/Readme.md new file mode 100644 index 0000000000..eeecc412ad --- /dev/null +++ b/StudentMarksPrediction/Readme.md @@ -0,0 +1,42 @@ +# Student Marks Prediction with Machine Learning + +This project demonstrates a regression model to predict student marks based on the number of courses taken and average daily study time. + +## Table of Contents + +- [Overview](#overview) +- [Dataset](#dataset) +- [Model](#model) +- [Results](#results) +- [Contributing](#contributing) + +## Overview + +The project aims to predict student marks using a simple linear regression model. It uses Python and libraries such as NumPy, pandas, Plotly, and scikit-learn. + +## Dataset + +The dataset includes three columns: +- number_courses: Number of courses taken by the student. +- time_study: Average study time per day. +- Marks: Marks obtained (target variable). + +Place the dataset file Student_Marks.csv in the data/ directory. + +## Model + +Steps involved: +1. *Data Preprocessing*: Checking for null values and understanding data distribution. +2. *Visualization*: Using Plotly to visualize relationships. +3. *Training*: Splitting data into training and test sets, then applying linear regression. +4. *Prediction*: Evaluating model performance with test data. + +## Results + +The model achieves a high accuracy with an R² score of approximately 0.946, indicating a strong correlation between the study time and marks obtained. + +## Contributing + +Contributions are welcome! Fork the repository, make your changes, and create a pull request. + +--- diff --git a/StudentMarksPrediction/Student_Marks.csv b/StudentMarksPrediction/Student_Marks.csv new file mode 100644 index 0000000000..539c09cf27 --- /dev/null +++ b/StudentMarksPrediction/Student_Marks.csv @@ -0,0 +1,101 @@ +number_courses,time_study,Marks +3,4.508,19.202 +4,0.096,7.734 +4,3.133,13.811 +6,7.909,53.018 +8,7.811,55.299 +6,3.211,17.822 +3,6.063,29.889 +5,3.413,17.264 +4,4.410,20.348 +3,6.173,30.862 +3,7.353,42.036 +7,0.423,12.132 +7,4.218,24.318 +3,4.274,17.672 +3,2.908,11.397 +4,4.260,19.466 +5,5.719,30.548 +8,6.080,38.490 +6,7.711,50.986 +8,3.977,25.133 +4,4.733,22.073 +6,6.126,35.939 +5,2.051,12.209 +7,4.875,28.043 +4,3.635,16.517 +3,1.407,6.623 +7,0.508,12.647 +8,4.378,26.532 +5,0.156,9.333 +4,1.299,8.837 +8,3.864,24.172 +3,1.923,8.100 +8,0.932,15.038 +6,6.594,39.965 +3,4.083,17.171 +3,7.543,43.978 +4,2.966,13.119 +6,7.283,46.453 +7,6.533,41.358 +6,7.775,51.142 +4,0.140,7.336 +6,2.754,15.725 +6,3.591,19.771 +5,1.557,10.429 +4,1.954,9.742 +3,2.061,8.924 +4,3.797,16.703 +4,4.779,22.701 +3,5.635,26.882 +5,3.913,19.106 +6,6.703,40.602 +6,4.130,22.184 +4,0.771,7.892 +7,6.049,36.653 +8,7.591,53.158 +7,2.913,18.238 +8,7.641,53.359 +7,7.649,51.583 +3,6.198,31.236 +8,7.468,51.343 +6,0.376,10.522 +4,2.438,10.844 +6,3.606,19.590 +3,4.869,21.379 +7,0.130,12.591 +6,2.142,13.562 +4,5.473,27.569 +3,0.550,6.185 +4,1.395,8.920 +6,3.948,21.400 +4,3.736,16.606 +5,2.518,13.416 +3,4.633,20.398 +3,1.629,7.014 +4,6.954,39.952 +3,0.803,6.217 +5,6.379,36.746 +8,5.985,38.278 +7,7.451,49.544 +3,0.805,6.349 +7,7.957,54.321 +8,2.262,17.705 +4,7.410,44.099 +5,3.197,16.106 +8,1.982,16.461 +8,6.201,39.957 +7,4.067,23.149 +3,1.033,6.053 +5,1.803,11.253 +7,6.376,40.024 +7,4.182,24.394 +8,2.730,19.564 +4,5.027,23.916 +8,6.471,42.426 +8,3.919,24.451 +6,3.561,19.128 +3,0.301,5.609 +4,7.163,41.444 +7,0.309,12.027 +3,6.335,32.357 \ No newline at end of file diff --git a/StudentMarksPrediction/StudentsMarksPrediction (1).ipynb b/StudentMarksPrediction/StudentsMarksPrediction (1).ipynb new file mode 100644 index 0000000000..94c9ef3342 --- /dev/null +++ b/StudentMarksPrediction/StudentsMarksPrediction (1).ipynb @@ -0,0 +1 @@ +{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyNb6YBGDrRSzMHQQgH97Cu4"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","source":["pip install modelbit"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"w7tv-KmN93fJ","executionInfo":{"status":"ok","timestamp":1716040402219,"user_tz":-330,"elapsed":16692,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"60d34be2-7740-4874-f260-48f9478d02ad"},"execution_count":4,"outputs":[{"output_type":"stream","name":"stdout","text":["Collecting modelbit\n"," Downloading modelbit-0.37.5-py3-none-any.whl (133 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m133.3/133.3 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting pycryptodomex (from modelbit)\n"," Downloading pycryptodomex-3.20.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.1/2.1 MB\u001b[0m \u001b[31m33.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from modelbit) (2.0.3)\n","Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from modelbit) (4.66.4)\n","Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from modelbit) (2.31.0)\n","Collecting types-requests (from modelbit)\n"," Downloading types_requests-2.31.0.20240406-py3-none-any.whl (15 kB)\n","Requirement already satisfied: pyyaml in /usr/local/lib/python3.10/dist-packages (from modelbit) (6.0.1)\n","Collecting types-PyYAML (from modelbit)\n"," Downloading types_PyYAML-6.0.12.20240311-py3-none-any.whl (15 kB)\n","Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from modelbit) (3.1.4)\n","Collecting types-pkg-resources (from modelbit)\n"," Downloading types_pkg_resources-0.1.3-py2.py3-none-any.whl (4.8 kB)\n","Collecting zstandard (from modelbit)\n"," Downloading zstandard-0.22.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.4/5.4 MB\u001b[0m \u001b[31m67.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: appdirs in /usr/local/lib/python3.10/dist-packages (from modelbit) (1.4.4)\n","Collecting texttable (from modelbit)\n"," Downloading texttable-1.7.0-py2.py3-none-any.whl (10 kB)\n","Requirement already satisfied: build in /usr/local/lib/python3.10/dist-packages (from modelbit) (1.2.1)\n","Collecting pkginfo (from modelbit)\n"," Downloading pkginfo-1.10.0-py3-none-any.whl (30 kB)\n","Collecting boto3>=1.23.0 (from modelbit)\n"," Downloading boto3-1.34.108-py3-none-any.whl (139 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m139.3/139.3 kB\u001b[0m \u001b[31m16.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting urllib3<2,>=1.21.1 (from modelbit)\n"," Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m143.8/143.8 kB\u001b[0m \u001b[31m18.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting build (from modelbit)\n"," Downloading build-0.10.0-py3-none-any.whl (17 kB)\n","Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.10/dist-packages (from modelbit) (7.1.0)\n","Collecting botocore<1.35.0,>=1.34.108 (from boto3>=1.23.0->modelbit)\n"," Downloading botocore-1.34.108-py3-none-any.whl (12.2 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m12.2/12.2 MB\u001b[0m \u001b[31m56.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting jmespath<2.0.0,>=0.7.1 (from boto3>=1.23.0->modelbit)\n"," Downloading jmespath-1.0.1-py3-none-any.whl (20 kB)\n","Collecting s3transfer<0.11.0,>=0.10.0 (from boto3>=1.23.0->modelbit)\n"," Downloading s3transfer-0.10.1-py3-none-any.whl (82 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m82.2/82.2 kB\u001b[0m \u001b[31m9.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: packaging>=19.0 in /usr/local/lib/python3.10/dist-packages (from build->modelbit) (24.0)\n","Requirement already satisfied: pyproject_hooks in /usr/local/lib/python3.10/dist-packages (from build->modelbit) (1.1.0)\n","Requirement already satisfied: tomli>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from build->modelbit) (2.0.1)\n","Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.10/dist-packages (from importlib-metadata->modelbit) (3.18.1)\n","Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->modelbit) (2.1.5)\n","Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.10/dist-packages (from pandas->modelbit) (2.8.2)\n","Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->modelbit) (2023.4)\n","Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->modelbit) (2024.1)\n","Requirement already satisfied: numpy>=1.21.0 in /usr/local/lib/python3.10/dist-packages (from pandas->modelbit) (1.25.2)\n","Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->modelbit) (3.3.2)\n","Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->modelbit) (3.7)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->modelbit) (2024.2.2)\n","INFO: pip is looking at multiple versions of types-requests to determine which version is compatible with other requirements. This could take a while.\n","Collecting types-requests (from modelbit)\n"," Downloading types_requests-2.31.0.20240403-py3-none-any.whl (15 kB)\n"," Downloading types_requests-2.31.0.20240402-py3-none-any.whl (15 kB)\n"," Downloading types_requests-2.31.0.20240311-py3-none-any.whl (14 kB)\n"," Downloading types_requests-2.31.0.20240310-py3-none-any.whl (14 kB)\n"," Downloading types_requests-2.31.0.20240218-py3-none-any.whl (14 kB)\n"," Downloading types_requests-2.31.0.20240125-py3-none-any.whl (14 kB)\n"," Downloading types_requests-2.31.0.20240106-py3-none-any.whl (14 kB)\n","INFO: pip is looking at multiple versions of types-requests to determine which version is compatible with other requirements. This could take a while.\n"," Downloading types_requests-2.31.0.20231231-py3-none-any.whl (14 kB)\n"," Downloading types_requests-2.31.0.10-py3-none-any.whl (14 kB)\n"," Downloading types_requests-2.31.0.9-py3-none-any.whl (14 kB)\n"," Downloading types_requests-2.31.0.8-py3-none-any.whl (14 kB)\n"," Downloading types_requests-2.31.0.7-py3-none-any.whl (14 kB)\n","INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.\n"," Downloading types_requests-2.31.0.6-py3-none-any.whl (14 kB)\n","Collecting types-urllib3 (from types-requests->modelbit)\n"," Downloading types_urllib3-1.26.25.14-py3-none-any.whl (15 kB)\n","Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.2->pandas->modelbit) (1.16.0)\n","Installing collected packages: types-urllib3, types-pkg-resources, texttable, zstandard, urllib3, types-requests, types-PyYAML, pycryptodomex, pkginfo, jmespath, build, botocore, s3transfer, boto3, modelbit\n"," Attempting uninstall: urllib3\n"," Found existing installation: urllib3 2.0.7\n"," Uninstalling urllib3-2.0.7:\n"," Successfully uninstalled urllib3-2.0.7\n"," Attempting uninstall: build\n"," Found existing installation: build 1.2.1\n"," Uninstalling build-1.2.1:\n"," Successfully uninstalled build-1.2.1\n","Successfully installed boto3-1.34.108 botocore-1.34.108 build-0.10.0 jmespath-1.0.1 modelbit-0.37.5 pkginfo-1.10.0 pycryptodomex-3.20.0 s3transfer-0.10.1 texttable-1.7.0 types-PyYAML-6.0.12.20240311 types-pkg-resources-0.1.3 types-requests-2.31.0.6 types-urllib3-1.26.25.14 urllib3-1.26.18 zstandard-0.22.0\n"]}]},{"cell_type":"code","source":["import modelbit\n","mb = modelbit.login()"],"metadata":{"id":"3RQnkO60-V0a","colab":{"base_uri":"https://localhost:8080/","height":121},"executionInfo":{"status":"ok","timestamp":1716040408530,"user_tz":-330,"elapsed":553,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"12a8b035-ce8a-4d11-b635-48d381e04f26"},"execution_count":5,"outputs":[{"output_type":"display_data","data":{"text/plain":[""],"text/html":["\n","
\n","
Connect to Modelbit
\n","
\n"," Open modelbit.com/t/eyJhbGciOi... to authenticate this kernel.\n"," Learn more.\n","
\n","
"]},"metadata":{}}]},{"cell_type":"markdown","source":["Importing necessary libraries"],"metadata":{"id":"SxWz6kwIsbYE"}},{"cell_type":"code","execution_count":6,"metadata":{"id":"183otnHVb081","executionInfo":{"status":"ok","timestamp":1716040435663,"user_tz":-330,"elapsed":2255,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}}},"outputs":[],"source":["import numpy as np\n","import pandas as pd\n","import plotly.express as px\n","from sklearn.model_selection import train_test_split\n","from sklearn.linear_model import LinearRegression"]},{"cell_type":"markdown","source":["Importing students_marks.csv file"],"metadata":{"id":"kUXiTHHcskx7"}},{"cell_type":"code","source":["from google.colab import files\n","uploaded = files.upload()\n","import io\n","df = pd.read_csv(io.BytesIO(uploaded['Student_Marks.csv']))"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":128},"id":"Moby2RhFnuxE","executionInfo":{"status":"ok","timestamp":1716040455609,"user_tz":-330,"elapsed":13932,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"97e13146-1e23-468a-c997-6a254588bf5f"},"execution_count":7,"outputs":[{"output_type":"display_data","data":{"text/plain":[""],"text/html":["\n"," \n"," \n"," Upload widget is only available when the cell has been executed in the\n"," current browser session. Please rerun this cell to enable.\n"," \n"," "]},"metadata":{}},{"output_type":"stream","name":"stdout","text":["Saving Student_Marks.csv to Student_Marks.csv\n"]}]},{"cell_type":"markdown","source":["Checking whether this dataset contains any null values or not"],"metadata":{"id":"kMLeSCVDs9pS"}},{"cell_type":"code","source":["print(df.isnull().sum())"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"35e_0RBtrTrZ","executionInfo":{"status":"ok","timestamp":1716040462708,"user_tz":-330,"elapsed":837,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"0c45148b-1a86-41c3-b5cf-0c3ace2b2e26"},"execution_count":8,"outputs":[{"output_type":"stream","name":"stdout","text":["number_courses 0\n","time_study 0\n","Marks 0\n","dtype: int64\n"]}]},{"cell_type":"code","source":["df[\"number_courses\"].value_counts()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"pI_UKXg0tLbG","executionInfo":{"status":"ok","timestamp":1716040464850,"user_tz":-330,"elapsed":11,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"8cf2385f-cd02-4815-d07f-a0eb29c81e35"},"execution_count":9,"outputs":[{"output_type":"execute_result","data":{"text/plain":["number_courses\n","3 22\n","4 21\n","6 16\n","8 16\n","7 15\n","5 10\n","Name: count, dtype: int64"]},"metadata":{},"execution_count":9}]},{"cell_type":"markdown","source":["so,there are minimum of three and a maximum of eight courses students have chosen"],"metadata":{"id":"kyJXevBfty5R"}},{"cell_type":"code","source":["figure = px.scatter(df,x=\"number_courses\",y=\"Marks\",size = \"time_study\", title =\"Number of courses and marks scored\")\n","figure.show()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":542},"id":"UcInCG2-zAPM","executionInfo":{"status":"ok","timestamp":1716040469434,"user_tz":-330,"elapsed":831,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"0080c8da-6f5d-427c-d99c-398a3313617f"},"execution_count":10,"outputs":[{"output_type":"display_data","data":{"text/html":["\n","\n","\n","
\n","
\n","\n",""]},"metadata":{}}]},{"cell_type":"markdown","source":["From the above data visualisation, we can conclude that the number of courses doesn't affect the marks of student if they study for more time."],"metadata":{"id":"CN3r88zo1Ivb"}},{"cell_type":"markdown","source":["Let's have a look at the relationship between time study and marks scored by the student."],"metadata":{"id":"qhrAGg3hQ9mH"}},{"cell_type":"code","source":["figure = px.scatter(df, x = \"time_study\" , y=\"Marks\", size = \"number_courses\",title = \" Relationship between time study and marks\" , trendline=\"ols\")\n","figure.show()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":542},"id":"2GLhzWR1JR-F","executionInfo":{"status":"ok","timestamp":1716040474713,"user_tz":-330,"elapsed":1433,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"defb8fdd-a224-4168-caf6-ec2a83c74c0e"},"execution_count":11,"outputs":[{"output_type":"display_data","data":{"text/html":["\n","\n","\n","
\n","
\n","\n",""]},"metadata":{}}]},{"cell_type":"markdown","source":["So, there's a linear relationship between time study and marks scored by a student. This means student who can study for more time they can score good marks."],"metadata":{"id":"twcP_-yUUDKY"}},{"cell_type":"markdown","source":["Now, let's have a correlation between the marks scored by the student and other two columns in the data"],"metadata":{"id":"IoLFhjN_bq7z"}},{"cell_type":"code","source":["correlation = df.corr()\n","print(correlation[\"Marks\"].sort_values(ascending=False))"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"lby_Aa17bTee","executionInfo":{"status":"ok","timestamp":1716040478475,"user_tz":-330,"elapsed":606,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"8bf9ba1e-c06a-42d6-b641-ca49ecc55185"},"execution_count":12,"outputs":[{"output_type":"stream","name":"stdout","text":["Marks 1.000000\n","time_study 0.942254\n","number_courses 0.417335\n","Name: Marks, dtype: float64\n"]}]},{"cell_type":"markdown","source":["So the time_studied column is more correlated with the marks column than the other column."],"metadata":{"id":"-LLByseKdMSm"}},{"cell_type":"markdown","source":["Student Marks Prediction Model"],"metadata":{"id":"0pdqemEzdcBc"}},{"cell_type":"code","source":["x = np.array(df[[\"number_courses\",\"time_study\"]])\n","y = np.array(df[\"Marks\"])\n","x_train,x_test,y_train,y_test = train_test_split(x,y,test_size=0.2, random_state = 42)"],"metadata":{"id":"klRyUOEyd4H7","executionInfo":{"status":"ok","timestamp":1716040480219,"user_tz":-330,"elapsed":8,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}}},"execution_count":13,"outputs":[]},{"cell_type":"code","source":["model = LinearRegression()\n","model.fit(x,y)\n","model.score(x_test,y_test)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"HOy5HhdSfmn9","executionInfo":{"status":"ok","timestamp":1716040483359,"user_tz":-330,"elapsed":7,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"a922a2e2-4960-4a32-ec3f-21f1dcf4aac4"},"execution_count":14,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0.9559821384668957"]},"metadata":{},"execution_count":14}]},{"cell_type":"code","source":["\n","# features = time_study, number_courses\n","features = np.array([[5.034,4]])\n","model.predict(features)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"cCZ6stJQiZdM","executionInfo":{"status":"ok","timestamp":1716040486385,"user_tz":-330,"elapsed":8,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"7808abf1-5c4e-469e-9b13-2d0c628ed332"},"execution_count":15,"outputs":[{"output_type":"execute_result","data":{"text/plain":["array([23.52400036])"]},"metadata":{},"execution_count":15}]},{"cell_type":"markdown","source":["In this way we can predict the marks of a student with machine learning using python."],"metadata":{"id":"48OriJ21j61A"}},{"cell_type":"code","source":["# Function for predicting student marks\n","def StudentMarksPrediction(time_study, number_courses):\n"," \"\"\"\n"," Predict the marks of a student.\n","\n"," Args:\n"," time_study (float): Amount of time student spends studying.\n"," number_courses (int): Number of courses selected.\n","\n"," Returns:\n"," float: Predicted marks.\n"," \"\"\"\n"," features = np.array([[number_courses, time_study]])\n"," predicted_marks = model.predict(features)\n"," return predicted_marks\n","\n","#Example usage\n","predicted_marks = StudentMarksPrediction(6.78, 2)\n","print(f\"Predicted Marks: {predicted_marks}\")"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"mNFtJcXwBRVR","executionInfo":{"status":"ok","timestamp":1716040794495,"user_tz":-330,"elapsed":573,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"4a12d38f-812f-470b-aea4-cc976580e40f"},"execution_count":23,"outputs":[{"output_type":"stream","name":"stdout","text":["Predicted Marks: [32.87818743]\n"]}]},{"cell_type":"markdown","source":["Now, let's test the performance of the machine learning model by giving inputs"],"metadata":{"id":"8yZ0OHKviltn"}},{"cell_type":"code","source":["mb.deploy(StudentMarksPrediction)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":213},"id":"wDkHXpwWKgE1","executionInfo":{"status":"ok","timestamp":1716040501856,"user_tz":-330,"elapsed":4495,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"de87920b-4b23-4688-f222-35c9429eeb20"},"execution_count":17,"outputs":[{"output_type":"display_data","data":{"text/plain":[""],"text/html":["
\n","
\n"," Deploying StudentMarksPrediction\n","
\n"," \n","\n","
Uploading dependencies...
\n","
"]},"metadata":{}},{"output_type":"display_data","data":{"text/plain":[""],"text/html":["
\n","
Success!
\n"," \n","
\n"," Deployment StudentMarksPrediction\n"," will be ready in a few seconds!\n","
\n"," \n","\n"," \n"," \n"," View in Modelbit\n","
\n"," \n",""]},"metadata":{}}]},{"cell_type":"code","source":["#Define input data\n","\n","time_study = 6.78\n","number_courses = 2\n","\n","#Get prediction from deployed model\n","prediction = modelbit.get_inference(\n"," region=\"ap-south-1\",\n"," workspace=\"pondupondu\",\n"," deployment=\"StudentMarksPrediction\",\n"," data=[time_study, number_courses]\n",")\n","\n","#Display the prediction\n","print(f\"The predicted score is : {prediction}\")"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"uAcXasaRMYPO","executionInfo":{"status":"ok","timestamp":1716043746330,"user_tz":-330,"elapsed":680,"user":{"displayName":"Akhil Padala","userId":"08563666418104416782"}},"outputId":"b8f42558-99d4-4c97-89f8-3c8f21e0d622"},"execution_count":29,"outputs":[{"output_type":"stream","name":"stdout","text":["The predicted score is : {'data': [32.878187432790085]}\n"]}]}]} \ No newline at end of file