If you are completely new to machine learning, then probably you should read my earlier post what is machine learning!
If you are new to python programming, then I suggest you to go through our python coding tutorial first, that will help you to learn python coding syntax and how to work with database, it’s free!
In this Python Machine Learning Tutorial, you will learn how to perform basic price prediction using python machine learning API.
Before you start learning python machine learning, I suggest you should get familiar with following python libraries, because during machine learning we will be using those libraries extensively, if you know those library code syntax, you will able to focus more on machine learning flow rather than wondering about those library-codes.
In our example below, we will be learning some of above libraries, so you need to install them in your local project.
First, we need to setup our python development environment by installing all required libraries as listed above.
You need to create your dataset, You create dataset in any data source like any RDBMS or Excel or CSV anything.
At this stage, you need to load dataset into python object, so you can play with data, how to load data that will depend what data source you are working with, in my example i will load data from excel file.
You may need to understand data by changing order, removing columns, adding additional columns, grouping them etc. Get them ready to train and test algorithms.
Now, you may want to see how visually data will look like, by plotting, charting etc. You can also save the visual representation in pdf format for future reference or reporting purpose.
Try different algorithms to see which produce the best closest result
Finally, make prediction with real data.
In our example, we will predict fruit price based on previous year data.
Note: if you don’t have data you can download Taxi fare standard data for practice.
Start your SDE, we are using Visual Studio 2019 to write python console application for machine learning example. (You can use any Python SDE, code will remain same.)
First, we need to make sure that all required libraries are installed correctly, so let’s run the following code in your console.
print("We are learning Machine Learning at WebTrainingRoom") import sys print('Python: {}'.format(sys.version)) # install matplotlib import matplotlib print('matplotlib: {}'.format(matplotlib.__version__)) # install pandas import pandas print('pandas: {}'.format(pandas.__version__)) # install scikit-learn import sklearn print('sklearn: {}'.format(sklearn.__version__)) # install scipy import scipy print('scipy: {}'.format(scipy.__version__)) # install numpy import numpy print('numpy: {}'.format(numpy.__version__))
If you are creating for first time, then you may need to install all packages one by one,
to do that, expand your solution explorer, go to python environment, then right click to manage package,
then run pip command, like pip install sklearn
Once you run the above code, here is the result you should see on your console screen, don’t worry if you see the different version. Core concept will remain same.
We are learning Machine Learning at WebTrainingRoom Python: 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] matplotlib: 3.1.3 pandas: 1.0.1 sklearn: 0.22.1 scipy: 1.4.1 numpy: 1.18.1 Press any key to continue . . .
in progress