This repository contains machine learning projects in the Python programming language.
--> Visit the official website of pycharm:
--> Download according to the platform that will be used like Linux, Macos or Windows.
--> Follow the setup wizard and sign up for the free version (trial version) or else continue with the premium or paid version.
--> First, in pycharm we have the concept of virtual environment. In virtual environment we can install all the required libraries or frameworks.
--> Each project has its own virtual environment, so thath we can install requirements like Libraries or Framworks for that project only.
--> After this we can create a new file, various file types are available in pycharm like script files, text files and also Jupyter Notebooks.
--> After selecting the required file type, we can continue the execution of that file by saving it and using this shortcut shift+F10 (In Windows).
--> Output is given in Console while installation happens in terminal in Pycharm.
--> Flask is a micro web framework written in Python.
--> It is classified as a microframework because it does not require particular tools or libraries.
--> Flask supports extensions that can add application features as if they were implemented in Flask itself.
--> To install flask in your system, just run this command-
pip install flask
Make Sure all depencies are already satisfied before running the app.
- Ensure that you are in the project home directory.Create the machine learning model by running below command -
--> This machine_learning_model.py file contains the code for the amachine learning model.
python machine_learning_model.py
This would create a serialized version of our model into a file model.pkl
- Run app.py using below command to start Flask API
--> This app.py file contains the code for the flask app
python app.py
By default, flask will run on port 5000.
- Navigate to URL http://localhost:5000
You should be able to view the homepage as below :
Enter valid numerical values in all the input boxes and hit Predict. Here I have entered 8.
If everything goes well, Predicted Value will be shown on the HTML page!
๐ Project and Models will change but this process will remain the same for all flask projects.
Complete Description about the project and resources used.
Each project has four major parts :
- machine_learning_mode.py - This contains code for Machine Learning model to predict output based on input from a dataset file.
- app.py - This contains Flask APIs that receives details through GUI or API calls, computes the precited value based on our model and returns it.
- templates - This folder contains the HTML template to allow user to enter details and displays the predicted value.
- static- This folder contains the css for the HTML file.
--> First ML model is constructed using linear regression for the dataset.
--> Then this model is saved using pickle in disk with the extention .pkl(Pickle File).
--> The Homepage is designed for flask app.
--> After this the flask app code is written.
--> Finally we can run this app in the flask Server.
--> Dataset is taken from:
--> Contains Salary data for Regression.
--> The dataset has 2 columns-Years of Experience and Salary and 30 entries.
--> Column Years of Experience is used to find regression for Salary.
--> Dataset is already cleaned,no preprocessing required.
--> It computes the linear relationship between a dependent variable and one or more independent features.
--> The goal of the algorithm is to find the best linear equation that can predict the value of the dependent variable based on the independent variables.
--> First ML model is constructed using Naive Bayes Classifier for the dataset.
--> Then this model is saved using pickle in disk with the extention .pkl(Pickle File).
--> The Homepage is designed for flask app.
--> After this the flask app code is written.
--> Finally we can run this app in the flask Server.
--> Dataset is taken from:
--> Contains diabetes data for classification.
--> The dataset has 3 columns-glucose, blood pressure and diabetes and 995 entries.
--> Column glucose and blood pressure data is to classify whether the patient has diabetes or not.
--> Dataset is already cleaned,no preprocessing required.
--> It is not a single algorithm but a family of algorithms where all of them share a common principle, i.e. every pair of features being classified is independent of each other.
--> The fundamental Naive Bayes assumption is that each feature makes an independent and equal contribution to the outcome.
--> First ML model is constructed using Naive Bayes Classifier for the dataset.
--> Then this model is saved using joblib in disk with the extention .pkl(Pickle File).
--> The Homepage is designed for flask app.
--> After this the flask app code is written.
--> Finally we can run this app in the flask Server.
--> Dataset is taken from:
--> Contains information about cars with respect to features like Attribute Values:
1. buying v-high, high, med, low | 2.maint v-high, high, med, low | 3.doors 2, 3, 4, 5-more | 4. persons 2, 4, more | 5. lug_boot small, med, big | 6.safety low, med, high |
1. unacc 1210 (70.023 %) | 2. acc 384 (22.222 %) | 3. good 69 ( 3.993 %) | 4. v-good 65 ( 3.762 %) |
--> Dataset is not cleaned, preprocessing is required.
--> It is based on the concept of ensemble learning, which is a process of combining multiple classifiers to solve a complex problem and to improve the performance of the model.
--> Instead of relying on one decision tree, the random forest takes the prediction from each tree and based on the majority votes of predictions, and it predicts the final output.
--> The greater number of trees in the forest leads to higher accuracy and prevents the problem of overfitting.
Short Description about all libraries used in Project.
To install python library this command is used-pip install library_name
- NumPy (Numerical Python) โ Enables with collection of mathematical functions to operate on array and matrices.
- Pandas (Panel Data/ Python Data Analysis) - This library is mostly used for analyzing, cleaning, exploring, and manipulating data.
- Matplotlib - It is a data visualization and graphical plotting library.
- Scikit-learn - It is a machine learning library that enables tools for used for many other machine learning algorithms such as classification, prediction, etc.
- Pickle- The pickle module is used for implementing binary protocols for serializing and de-serializing a Python object structure.
- Joblib- Joblib is a set of tools to provide lightweight pipelining in Python. In particular transparent disk-caching of functions and lazy re-evaluation (memoize pattern) and easy simple parallel computing.
To see more of my machine learning models, visit my repository: https://github.com/madhurimarawat/Machine-Learning-Using-Python
- Drop a ๐ if you find this repository useful.
- If you have any doubts or suggestions, feel free to reach me.
๐ซ How to reach me: ย ย ย - Contribute and Discuss: Feel free to open issues ๐, submit pull requests ๐ ๏ธ, or start discussions ๐ฌ to help improve this repository!