0% found this document useful (0 votes)
16 views25 pages

Experiment No 1 (ML)

This document outlines an introductory experiment for Machine Learning students at Sindhudurg Shikshan Prasarak Mandal's College of Engineering, focusing on the use of Anaconda and Google Colab. It provides detailed steps for installing Anaconda, managing Python environments, and utilizing Jupyter Notebooks, as well as an overview of Google Colab's features and a comparison between the two platforms. The document concludes with instructions for running Python programs in the Spyder IDE and using Colaboratory for collaborative coding.

Uploaded by

tulsiraorane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views25 pages

Experiment No 1 (ML)

This document outlines an introductory experiment for Machine Learning students at Sindhudurg Shikshan Prasarak Mandal's College of Engineering, focusing on the use of Anaconda and Google Colab. It provides detailed steps for installing Anaconda, managing Python environments, and utilizing Jupyter Notebooks, as well as an overview of Google Colab's features and a comparison between the two platforms. The document concludes with instructions for running Python programs in the Spyder IDE and using Colaboratory for collaborative coding.

Uploaded by

tulsiraorane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.

Department of AIML Engineering

Subject: -Machine Learning (CSC604)

EXPERIMENT NO- 1
AIM: Introduction to platforms Anaconda, Google COLAB.

RESOURCES REQUIRED: H/W :- P4 machine


S/W :- Google Colaboratory , Anaconda Navigator, Jupyter Notebooks

THEORY:
Introduction to Anaconda
Anaconda distribution, a comprehensive platform for data science and scientific computing
in Python. Anaconda simplifies the process of setting up and working with various libraries
and tools commonly used in data science, machine learning, and scientific computing.

Experiment Steps
1. Installation of Anaconda
1. Download Anaconda:

 Go to the Anaconda website.


 Choose the appropriate version for your operating system (Windows, macOS,
Linux) and download the installer.
2. Install Anaconda:
 Follow the installation instructions for your operating system.
 During installation, you can choose to add Anaconda to your system PATH,
which makes it easier to access Anaconda from the command line.
3. Verify Installation:

 Open a new terminal or command prompt.


 Type conda --version to check if the installation was successful.
2. Anaconda Navigator
1. Launch Anaconda Navigator:
 Open Anaconda Navigator from your applications or Start menu.
2. Explore Navigator:
 Get familiar with the Anaconda Navigator interface.
Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering

Subject: -Machine Learning (CSC604)

 Identify the key components such as Home, Environments, and Jupyter


Notebooks.
3. Creating and Managing Environments
1. Create a New Environment:
 Use Anaconda Navigator to create a new environment.
 Choose the Python version and give your environment a name.
2. Manage Environments:

 Activate and deactivate environments.


 Install and remove packages using the Conda package manager.
4. Jupyter Notebooks with Anaconda
1. Launch Jupyter Notebook:
 Open Jupyter Notebook from Anaconda Navigator.
2. Create a New Notebook:
 Create a new Jupyter Notebook within your Anaconda environment.

3. Execute Code in Notebook:


 Write and execute a simple Python code snippet in the Jupyter Notebook.

5. Introduction to Google Colab


5.1 Overview of Google Colab
1. Go to Google Colab.
2. Overview of the interface and features.

5.2 Setting Up a Colab Notebook


1. Create a new Colab notebook.
2. Understand the collaborative features.

5.3 Collaboration Features


1. Share and collaborate on a Colab notebook.
2. Commenting and version history.
Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering

Subject: -Machine Learning (CSC604)

6. Comparing Anaconda and Google Colab

Feature Google Colab Jupyter Notebook


Accessibility and Cloud-based, requires no local
Requires local installation and setup.
Setup setup.
Real-time collaboration with Collaboration requires external
Collaboration
team members. services or plugins.
Free access to GPU and TPU Relies on local hardware resources
Hardware Resources
resources. for computation.
Integration with Seamless integration with Limited native integration with
Cloud Google Drive. cloud services.
Pre-installed libraries for Requires manual installation of
Library Management
machine learning. libraries.
Supports Matplotlib, Seaborn, Similar support for visualization
Visualization Tools
Plotly, etc. libraries.
Ideal for teaching and learning
Educational Use Widely used in educational settings.
with ease.
Offline Usage Limited offline functionality. Full functionality available offline.
Command Line Supports shell commands within Limited support; requires external
Integration notebooks. plugins.
Shareable via links or Google Sharing involves file transfer or
Ease of Sharing
Drive integration. external services.
Strong community support and Well-established community with
Community Support
resources. extensive resources.
Highly customizable based on local
Customization Limited customization options.
environment.

5. Conclusion
This lab document provides a structured outline for conducting an introduction to Anaconda
and Google Colab experiment.In this experiment, we have been introduced to the Anaconda
distribution and its capabilities. and learned how to install Anaconda, create and manage
Python environments, and use Jupyter Notebooks for interactive coding.

Additional Resources
 Anaconda Documentation: Anaconda Documentation
 Jupyter Notebook Documentation: Jupyter Notebook Documentation
Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering

Subject: -Machine Learning (CSC604)

Installing Anaconda and Python


To learn machine learning, we will use the Python programming language in this tutorial. So,
in order to use Python for machine learning, we need to install it in our computer system with
compatible IDEs (Integrated Development Environment).

In this topic, we will learn to install Python and an IDE with the help of Anaconda
distribution.

Anaconda distribution is a free and open-source platform for Python/R programming


languages. It can be easily installed on any OS such as Windows, Linux, and MAC OS. It
provides more than 1500 Python/R data science packages which are suitable for developing
machine learning and deep learning models.

Anaconda distribution provides installation of Python with various IDE's such as Jupyter
Notebook, Spyder, Anaconda prompt, etc. Hence it is a very convenient packaged solution
which you can easily download and install in your computer. It will automatically install
Python and some basic IDEs and libraries with it.

Below some steps are given to show the downloading and installing process of Anaconda and
IDE:

Step-1: Download Anaconda Python:

 To download Anaconda in your system, firstly, open your favorite browser and type
Download Anaconda Python, and then click on the first link as given in the below
image. Alternatively, you can directly download it by clicking on this link,
https://www.anaconda.com/distribution/#download-section.
Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering

Subject: -Machine Learning (CSC604)

 After clicking on the first link, you will reach to download page of Anaconda, as
shown in the below image:

 Since, Anaconda is available for Windows, Linux, and Mac OS, hence, you can
download it as per your OS type by clicking on available options shown in below
image. It will provide you Python 2.7 and Python 3.7 versions, but the latest version
is 3.7, hence we will download Python 3.7 version. After clicking on the download
option, it will start downloading on your computer.
TE-AIML-SEM-VI [DAV-Lab Manual] Prof. Rashmi Mahajan
Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering

Subject: -Machine Learning (CSC604)

Note: In this topic, we are downloading Anaconda for Windows you can choose it as per your
OS.

Step- 2: Install Anaconda Python (Python 3.7 version):

Once the downloading process gets completed, go to downloads → double click on the ".exe"
file (Anaconda3-2019.03-Windows-x86_64.exe) of Anaconda. It will open a setup window
for Anaconda installations as given in below image, then click on Next.

TE-AIML-SEM-VI [DAV-Lab Manual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering

Subject: -Machine Learning (CSC604)

 It will open a License agreement window click on "I Agree" option and move further.

 In the next window, you will get two options for installations as given in the below
image. Select the first option (Just me) and click on Next.
TE-AIML-SEM-VI [DAV-Lab Manual] Prof. Rashmi Mahajan
Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering

Subject: -Machine Learning (CSC604)

 Now you will get a window for installing location, here, you can leave it as default or
change it by browsing a location, and then click on Next. Consider the below image:

TE-AIML-SEM-VI [DAV-Lab Manual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 Now select the second option, and click on install.

 Once the installation gets complete, click on Next.

TE-AIML-SEM-VI [DAV-Lab Mannual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 Now installation is completed, tick the checkbox if you want to learn more about
Anaconda and Anaconda cloud. Click on Finish to end the process.

Note: Here, we will use the Spyder IDE to run Python programs.
Step- 3: Open Anaconda Navigator

 After successful installation of Anaconda, use Anaconda navigator to launch a Python


IDE such as Spyder and Jupyter Notebook.
 To open Anaconda Navigator, click on window Key and search for Anaconda
navigator, and click on it. Consider the below image:

TE-AIML-SEM-VI [DAV-Lab Mannual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 After opening the navigator, launch the Spyder IDE by clicking on the Launch button
given below the Spyder. It will install the Spyder IDE in your system.

Run your Python program in Spyder IDE.

 Open Spyder IDE, it will look like the below image:

TE-AIML-SEM-VI [DAV-Lab Mannual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 Write your first program, and save it using the .py extension.
 Run the program using the triangle Run button.
 You can check the program's output on console pane at the bottom right side.

Step- 4: Close the Spyder IDE.

Below some steps are given to show the downloading and installing process of Anaconda and
IDE:

Step-1: Download Anaconda Python:

 To download Anaconda in your system, firstly, open your favorite browser and type
Download Anaconda Python, and then click on the first link as given in the below
image. Alternatively, you can directly download it by clicking on this link,
https://www.anaconda.com/distribution/#download-section.

TE-AIML-SEM-VI [DAV-Lab Mannual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 After clicking on the first link, you will reach to download page of Anaconda, as
shown in the below image:

 Since, Anaconda is available for Windows, Linux, and Mac OS, hence, you can
download it as per your OS type by clicking on available options shown in below
image. It will provide you Python 2.7 and Python 3.7 versions, but the latest version
is 3.7, hence we will download Python 3.7 version. After clicking on the download
option, it will start downloading on your computer.

TE-AIML-SEM-VI [DAV-Lab Mannual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

Note: In this topic, we are downloading Anaconda for Windows you can choose it as per your
OS.

Step- 2: Install Anaconda Python (Python 3.7 version):

Once the downloading process gets completed, go to downloads → double click on the ".exe"
file (Anaconda3-2019.03-Windows-x86_64.exe) of Anaconda. It will open a setup window
for Anaconda installations as given in below image, then click on Next.

TE-AIML-SEM-VI [DAV-Lab Mannual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 It will open a License agreement window click on "I Agree" option and move further.

 In the next window, you will get two options for installations as given in the below
image. Select the first option (Just me) and click on Next.

TE-AIML-SEM-VI [DAV-Lab Mannual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 Now you will get a window for installing location, here, you can leave it as default or
change it by browsing a location, and then click on Next. Consider the below image:

TE-AIML-SEM-VI [DAV-Lab Mannual] Prof. Rashmi Mahajan


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 Now select the second option, and click on install.

 Once the installation gets complete, click on Next.

TE-AIML-SEM-VI [DAV-Lab Mannual] Asst.Prof. Shashank Naik


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 Now installation is completed, tick the checkbox if you want to learn more about
Anaconda and Anaconda cloud. Click on Finish to end the process.

Note: Here, we will use the Spyder IDE to run Python programs.
Step- 3: Open Anaconda Navigator

 After successful installation of Anaconda, use Anaconda navigator to launch a Python


IDE such as Spyder and Jupyter Notebook.
 To open Anaconda Navigator, click on window Key and search for Anaconda
navigator, and click on it. Consider the below image:

TE-AIML-SEM-VI [DAV-Lab Mannual] Asst.Prof. Shashank Naik


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 After opening the navigator, launch the Spyder IDE by clicking on the Launch button
given below the Spyder. It will install the Spyder IDE in your system.

Run your Python program in Spyder IDE.

 Open Spyder IDE, it will look like the below image:

TE-AIML-SEM-VI [DAV-Lab Mannual] Asst.Prof. Shashank Naik


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

 Write your first program, and save it using the .py extension.
 Run the program using the triangle Run button.
 You can check the program's output on console pane at the bottom right side.

Step- 4: Close the Spyder IDE.

How to use Colaboratory

To use Colaboratory, you must have a Google account.

On your first visit, you will see a Welcome To Colaboratory notebook with links to video
introductions and basic information on how to use Colab.

Create a workbook

From the File menu, click New notebook to create a workbook.

If you are not yet logged in to a Google account, the system will prompt you to log in.

The notebook will by default have a generic name; click on the filename field to rename it.

TE-AIML-SEM-VI [DAV-Lab Mannual] Asst.Prof. Shashank Naik


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

The file type, IPYNB, is short for "IPython notebook" because IPython was the forerunner of
Jupyter Notebook.

The interface allows you to insert various kinds of cells, mainly text and code, which have
their own shortcut buttons under the menu bar via the Insert menu.

Because notebooks are meant for sharing, there are accommodations throughout for
structured documentation.

Code, debug, repeat

You can insert Python code to execute in a code cell. The code can be entirely standalone or
imported from various Python libraries.

A notebook can be treated as a rolling log of work, with earlier code snippets being no longer
executed in favor of later ones, or treated as an evolving set of code blocks intended for
ongoing execution. The Runtime menu offers execution options, such as Run all, Run
before or Run the focused cell, to match either approach.

Each code cell has a run icon on the left edge, as shown above. You can type code into a cell
and hit the run icon to execute it immediately.

TE-AIML-SEM-VI [DAV-Lab Mannual] Asst.Prof. Shashank Naik


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

If the code generates an error, the error output will appear beneath the cell. Correcting the
problem and hitting run again replaces the error info with program output. The first line of
code, in its own cell, imports the NumPy library, which is the source of the arange
function. Colab has many common libraries pre-loaded for easy import into programs.

A text cell provides basic rich text using Markdown formatting by default and allows for the
insertion of images, HTML code and LaTeX formatting.

As you add text on the left side of the text cell, the formatted output appears on the right.

Once you stop editing a block, only the final formatted version shows.

TE-AIML-SEM-VI [DAV-Lab Mannual] Asst.Prof. Shashank Naik


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, Kankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

Incorporating data into the notebook

After getting comfortable with the interface and using it for initial test coding, you must
eventually provide the code with data to analyze or otherwise manipulate.

Colab can mount a user's Google Drive to the VM hosting their notebook using a code cell.

Once you hit run, Google will ask for permission to mount the drive.

If you allow it to connect, you will then have access to the files in your Google Drive via the
/my_drive path.

If you prefer not to grant access to your Drive space, you can upload files or any network file
space mounted as a drive from your local machine instead.

with file access, many functions are available to read data in various ways. For example,
importing the Pandas library gives access to functions such as read_csv and read_json.

TE-AIML-SEM-VI [DAV-Lab Mannual] Asst.Prof. Shashank Naik


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, ankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

Save and share

By default, Colab puts notebooks in a Colab Notebooks folder under My Drive in Google
Drive.

The File menu enables notebooks to be saved as named revisions in the version history,
relocated using Move, or saved as a copy in Drive or GitHub. It also allows you to download
and upload notebooks. Tools based on Jupyter provide broad compatibilities, so you can
create notebooks in one place and then upload and use them in another.

You can use the Share button in the upper right to grant other Google users access to the
notebook and to copy links.

Google also provides example notebooks illustrating available resources, such as pre-trained
image classifiers and language transformers, as well as addressing common business
problems, such as working with BigQuery or performing time series analytics. It also
provides links to introductory Python coding notebooks.

TE-AIML-SEM-VI [DAV-Lab Manual] Asst.Prof. Shashank Naik


Sindhudurg Shikshan Prasarak Mandal's College of Engineering, ankavli.
Department of AIML Engineering
Subject: -Machine Learning (CSC604)

TE-AIML-SEM-VI [DAV-Lab Manual] Asst.Prof. Shashank Naik

You might also like