This blog is a further continuation of computer vision to take us in areas of machine learning using Python. In case you have missed the earlier blog related to computer vision you may read it here.
Machine learning is an evolving field and you cant't go beyond basic robotics without getting your hands dirty with machine learning. Python is the language of choice from MieRobot team when using machine learning in robotics. The most common and essential python library that supports machine learning is SciKit. SciKit is free and part of open source software. We have installed SciKit over Ubuntu Linux and also ran few machine learning algorithms as that of plotting cross validated predictions.
Before you install SciKit please ensure you have Python installed which can be checked by going into terminal and typing 'python' (without quotes). If not then you can install Python from here. Once you have Python installed you would need to install NumPy and SciPy which you can read from our blog here.
Scikit-learn requires:Python (>= 2.6 or >= 3.3),NumPy (>= 1.6.1),SciPy (>= 0.9) as mentioned on date of the site from SciKit.
After you have a working installation of these you would need to do a PIP and package update as -
sudo pip install --upgrade pip
In case you get an error or do not have PIP you can install as below with
sudo apt install python-pip
After this we need to start the main process to install the SciKit package - so type as below.
pip install -U scikit-learn
If you get an error then try using Sudo as -
sudo pip install -U scikit-learn
You would get a prompt for upgrade and disk space, go ahead and type 'Y' (no quotes).
Successful install would look like this and make you return to the terminal as shown below.
Then its turn to test this with a algorithm that uses this package, so we take the example of ploting a cross validated predictions. The code can be downloaded from the SciKit site here.
Code source : http://scikit-learn.org/stable/index.html
Now go to the path where you have downloaded the code. For us it was in download folder as shown below.
Now after you have changed directory to the path you have downloaded the python code. Use sudo to run the code as - (make sure you dnt make a spelling mistake)
sudo python plot_cv_predict.py
If everything is correct you would see the predicted values against measured as shown.
This way you can call many functions from ScikIT and use in robots such as SID2 in areas of classifications, regressions, clustering and model selections.
Please like comment and share if you have like this blog. Your like inspires us.