ML Lab Manual (Vim)
ML Lab Manual (Vim)
RAJAJINAGAR BANGALORE
MACHINE LEARNING LAB MANUAL.
6TH SEM BCA
OUTPUT:
2) Introduce scikit-learn as a machine learning library.
• Scikit-learn (Sklearn) is the most useful and robust library for machine learning in
Python.
• It provides a selection of efficient tools for machine learning and statistical modeling
including classification, regression, clustering and dimensionality reduction via a
consistence interface in Python.
• This library, which is largely written in Python, is built upon NumPy, pandas,SciPy and
Matplotlib.
Installation
If you already installed NumPy and Scipy, the following are the two easiest ways to
install scikit-learn –
Using pip
The following command can be used to install scikit-learn via pip
pip install scikit-learn
Features
Rather than focusing on loading, manipulating and summarizing data , Scikit-learn
library is focused on modeling the data. Some of the most popular groups of models
provided by Sklearn are as follows .
Supervised Learning algorithms − Almost all the popular supervised learning
algorithms, like Linear Regression, Support Vector Machine (SVM), Decision Tree etc.,
are the part of scikit-learn.
Unsupervised Learning algorithms − On the other hand, it also has all the popular
unsupervised learning algorithms from clustering, factor analysis, PCA (Principal
Component Analysis) to unsupervised neural networks.
Clustering − This model is used for grouping unlabeled data.
Cross Validation − It is used to check the accuracy of supervised models on unseen
data.
3) Install and set up scikit-learn and other necessary tools.
Pip upgrade:
Using pip:
• Pip is Python's package manager.
• It usually comes installed with Python.
• Open a terminal/command prompt.
Py –m install pip - -upgrade pip
a)Install NumPy :-
pip install numpy
press Enter. This command will download and install NumPy.
b)Install pandas:-
pip install pandas
press Enter. This command will download and install pandas.
c)Install matplotlib:-
pip install matplotlib
press Enter. This command will download and install matplotlib.
d)Install scipy:-
pip install scipy press Enter. This command will download and install scipy
e)Install scikit-learn(sklearn):-
pip install scikit-learn
press Enter. This command will download and install scikit-learn
Verify installations:
Open a IDLE
OUTPUT:
4. Write a program to Load and explore the dataset of .CSV and excel files using pandas.
OUTPUT:
5. Write a program to Visualize the dataset to gain insights using Matplotlib or Seaborn by
plotting scatter plots, and bar charts.
OUTPUT:
6. Write a program to Handle missing data, encode categorical variables, and perform
feature scaling.
OUTPUT:
8. Write a program to implement a linear regression model for regression tasks and Train
the model on a dataset with continuous target variables.
OUTPUT:
9. Write a program to implement a decision tree classifier using scikit-learn and visualize the
decision tree and understand its splits.
OUTPUT: