ML Lab 1
ML Lab 1
with
Python
Lab - 1
Overview of what we are going
to cover:
1. Installing the Python and SciPy platform.
2. Loading the dataset.
3. Summarizing the dataset.
4. Visualizing the dataset.
5. Evaluating some algorithms.
6. Making some predictions.
Lab – 1:
1. An Introduction to Python
• Python is a popular object-oriented programing language having the
capabilities of high-level programming language. Its easy to learn
syntax and portability capability makes it popular these days. The
followings facts gives us the introduction to Python −
✓ Python was developed by Guido van Rossum at Stichting Mathematisch Centrum
in the Netherlands.
✓ It was written as the successor of programming language named ‘ABC’.
✓ It’s first version was released in 1991.
✓ The name Python was picked by Guido van Rossum from a TV show named
Monty Python’s Flying Circus.
✓ It is an open source programming language which means that we can freely
download it and use it to develop programs. It can be downloaded
from www.python.org.
✓ Python programming language is having the features of Java and C both. It is
having the elegant ‘C’ code and on the other hand, it is having classes and objects
like Java for object-oriented programming.
✓ It is an interpreted language, which means the source code of Python program
would be first converted into bytecode and then executed by Python virtual
machine.
Strengths and Weaknesses of Python
Strengths
According to studies and surveys, Python is the fifth most important language as well as the most
popular language for machine learning and data science. It is because of the following strengths that
Python has −
• Easy to learn and understand − The syntax of Python is simpler; hence it is relatively easy, even
for beginners also, to learn and understand the language.
• Huge number of modules − Python has huge number of modules for covering every aspect of
programming. These modules are easily available for use hence making Python an extensible
language.
• Support of open source community − As being open source programming language, Python is
supported by a very large developer community. Due to this, the bugs are easily fixed by the
Python community. This characteristic makes Python very robust and adaptive.
1. Jupyter Notebook
• It helps a data scientist to document the thought process while developing the analysis process.
• One can also capture the result as the part of the notebook.
• With the help of jupyter notebooks, we can share our work with a peer also.
• Installation and Execution
• If you are using Anaconda distribution, then you need not install jupyter
notebook separately as it is already installed with it. You just need to go to
Anaconda Prompt and type the following command −
C:\>jupyter notebook
• After pressing enter, it will start a notebook server at localhost:8888 of
your computer. It is shown in the following screen shot −
• Now, after clicking the New tab, you will get a list of options. Select
Python 3 and it will take you to the new notebook for start working
in it. You will get a glimpse of it in the following screenshots −
• On the other hand, if you are using standard Python distribution then
jupyter notebook can be installed using popular python package installer,
pip.
• After installing Scikit-learn, you can use it into your Python script as
you have done above.
Question & Answer
8/25/2023 24