Experiment No 1 (ML)
Experiment No 1 (ML)
EXPERIMENT NO- 1
AIM: Introduction to platforms Anaconda, Google COLAB.
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:
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
In this topic, we will learn to install Python and an IDE with the help of Anaconda
distribution.
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:
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
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
Note: In this topic, we are downloading Anaconda for Windows you can choose it as per your
OS.
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.
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
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:
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 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.
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.
Below some steps are given to show the downloading and installing process of Anaconda and
IDE:
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.
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.
Note: In this topic, we are downloading Anaconda for Windows you can choose it as per your
OS.
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.
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.
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:
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 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.
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.
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
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.
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.
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.
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.
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.
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.