Python Machine Learning Environment Setup 2018
Let's take a look at a Python Machine Learning environment setup as well as explore different Python libraries.
Join the DZone community and get the full member experience.
Join For FreeHow to Install Python
Before anything else, you will need to Install Python on your machine. So, here are the steps to install Python.
Plain Download
You can download from the official website:
https://www.python.org/downloads/
At the time of writing, the latest version of Python is Python 3.7. This is what the installer looks like:
Installing With Anaconda
Or you can install it with Anaconda:
https://www.anaconda.com/download/
This downloads Anaconda for us. Now to install it, we run the installer:
And for the final options:
And then, it installs Anaconda:
Starting and Updating Anaconda
To confirm that your Anaconda environment is up to date, follow these steps:
1. Open Anaconda Prompt and type the following:
- (base) C:\Users\Ayushi>conda -V
conda 4.5.8
2. Now the following command tells you about your Python environment:
- (base) C:\Users\Ayushi>python -V
Python 3.6.5 :: Anaconda, Inc
3. Then, to confirm that the conda environment you hold is up to date:
- (base) C:\Users\Ayushi>conda update conda
Solving environment: done
# All requested packages already installed.
- (base) C:\Users\Ayushi>conda update anaconda
Solving environment: done
# All requested packages already installed.
Installing Needed Python Libraries
Working with Machine Learning, we will need a few Python Libraries often. Here’s a list of some of those-
NumPy
NumPy, a Python library that will let you handle multi-dimensional arrays and matrices. It also offers multiple high-level mathematical functions to operate on these.
You can install it as:
- conda install numpy
SciPy
SciPy is a scientific and technical computing Python library that is free and open-source. Install it as:
- conda install scipy
Matplotlib
Matplotlib, a Python library for plotting and has NumPy as its numerical mathematics extension. Install it as:
- conda install matplotlib
pandas
pandas is a software library for Python that comes in handy when working with data manipulation and analysis. Install it with the following command-
- conda install pandas
statsmodels
This is a Python package that lets users explore data, estimate statistical models, and carry out statistical tests. You can install it as:
- conda install statsmodels
seaborn
This is a Python library for data visualization and is based on Matplotlib. It offers a high-level interface for plotting statistical graphs that are attractive and informative. You can install it with the following command:
- conda install seaborn
scikit-learn
This is a free software ML library for Python. It offers facilities like classification, regression, and clustering algorithms.
To find out which version of a library you’re using, you can run the following piece of code in the interpreter:
- >>> import scipy
- >>> scipy.__version__
‘1.1.0’
So, this was all in Python Machine Learning Environment Setup. Hope you like our explanation.
Conclusion
In this Python Machine Learning Environment Setup, we discussed how to install Python. Moreover, we saw the starting and updating of Anaconda. Also, in this Python Machine Learning Environment Setup, we learned about the need libraries. If you follow all the steps mentioned above, you will successfully set up a Machine Learning environment for Python at a beginner level. Still, if you have any doubts regarding Python Machine Learning Environment Setup, ask in the comments section.
Published at DZone with permission of Rinu Gour. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments