0% found this document useful (0 votes)
15 views

AI Lab File

dgfdg

Uploaded by

YOGENDRA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

AI Lab File

dgfdg

Uploaded by

YOGENDRA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Experiment – 1

Objective - Applying Linear Regression - Utilize different classes in Python and visualize the Linear
regression algorithm. Also check the different Error values.

Working - This experiment demonstrates fitting a linear regression model, visualizing the fit, and
calculating error values.

Step – 1 ) Import required libraries and load the dataset.

Step – 2 ) Create a sample dataset.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 3 ) Preprocess the data by splitting into train and test sets.

Step – 4 ) Fit a Linear Regression model.

Step – 5 ) Predict and calculate error metrics (MSE and R-squared).

Artificial Intelligence Adarsh Patel 202210101330027


Step – 6 ) Visualize the regression line.

Artificial Intelligence Adarsh Patel 202210101330027


Experiment – 2
Objective - Applying Logistic Regression - Utilize different classes of python, visualize different graphs
using seaborn and use Logistic regression using the heart disease prediction dataset.

Working - Logistic Regression is a supervised learning algorithm used to predict categorical outcomes.
Here, it will help classify patients based on the likelihood of heart disease.

Step – 1 ) Import Libraries and Load Dataset

Step – 2 ) Data Preprocessing.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 3 ) Model Training.

Step – 4 ) Model Evaluation.

Artificial Intelligence Adarsh Patel 202210101330027


Experiment – 3
Objective - Using the Iris dataset visualize the working of Support Vector Machines - Load the iris
dataset and perform support vector classification on it, Then try to do the same using different kernels.
Understand the importance of ‘c’ and ‘gamma’ values in SVM.

Working - This experiment implements and evaluates KNN for classification.


Step – 1 ) Import libraries and create a sample dataset.

Step – 2 ) Data Preprocessing.

Step – 3 ) Model Training.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 4 ) Model Evaluation.

Artificial Intelligence Adarsh Patel 202210101330027


Experiment – 4
Objective - Implementation of Decision Tree Algorithm - Implement and visualize the decision tree
algorithm.

Working - This experiment trains and visualizes a Decision Tree classifier.


Step – 1 ) Import libraries and create a sample dataset.

Step – 2 ) Generate synthetic data and split it.

Step – 3 ) Train the Decision Tree model.

Step – 4 ) Visualize the Decision Tree.

Artificial Intelligence Adarsh Patel 202210101330027


Artificial Intelligence Adarsh Patel 202210101330027
Experiment – 5
Objective - Ensembling Techniques And Random Forest - Understanding ensemble learning
techniques and implement random forest algorithm. Also, visualize the difference between Decision tree and
Random Forest.

Working - Ensemble learning combines multiple models to improve performance. Random Forest, an
ensemble method, builds multiple Decision Trees to reduce overfitting and improve accuracy.

Step – 1 ) Import Libraries and Load Dataset.

Step – 2 ) Train Decision Tree and Random Forest Models.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 3 ) Evaluate the Models.

Step – 4 ) Visualize Decision Tree vs. Random Forest.

Artificial Intelligence Adarsh Patel 202210101330027


Artificial Intelligence Adarsh Patel 202210101330027
Experiment – 6
Objective - Implementing Unsupervised Learning Using K-Means clustering -
Understanding and implementing the K-Means clustering algorithm using a data set.

Working - K-Means is an unsupervised learning algorithm that groups data into clusters based on feature
similarity. The algorithm iteratively assigns data points to clusters and adjusts the cluster centroids until
convergence.

Step – 1 ) Import Libraries and Load Dataset.

Step – 2 ) Visualize the Data.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 3 ) Apply K-Means Clustering.

Step – 4 ) Visualize Clusters with Centroids.

Artificial Intelligence Adarsh Patel 202210101330027


Experiment – 7
Objective - Understanding Tensorflow Library and Creating and Implementing a
Neural network - Implement a Logistic Regression model using Scikit-Learn, compute its accuracy, and
visualize the confusion matrix.

Working - Logistic Regression is a classification algorithm that predicts probabilities of binary outcomes.
It is commonly used in binary classification problems.

Step – 1 ) Import Libraries and Load Dataset.

Step – 2 ) Split Data and Train Logistic Regression Model.

Step – 3 ) Evaluate the Model.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 4 ) Visualize Confusion Matrix.

Artificial Intelligence Adarsh Patel 202210101330027


Experiment – 8
Objective - Understanding CNN for image processing - Understanding and implementing the
Convolutional Neural Networks and performing image processing using MNIST dataset.

Working - This experiment implements a CNN for classifying handwritten digits in the MNIST dataset.
The CNN model uses convolutional layers to automatically extract features and a fully connected layer for
classification.

Step – 1 ) Import Libraries and Load Dataset.

Step – 2 ) Build the CNN Model.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 3 ) Compile and Train the Model.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 4 ) Evaluate and Visualize the Model.

Artificial Intelligence Adarsh Patel 202210101330027


Experiment – 9
Objective - Using OpenCv for image processing - Creating an image analyzation system that
understands the sentiment of the image.

Working - This experiment involves using OpenCV to preprocess images and a deep learning model (such
as a CNN) to perform sentiment analysis based on the image content, specifically recognizing facial
expressions that can indicate emotions such as happiness, sadness, or anger.

Step – 1 ) Upload the Model File to Google Colab.

Step – 2 ) Load the Model in Google Colab.

Step – 3 ) Load and Preprocess the Image.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 4 ) Convert to Array and Normalize.

Step – 5 ) Predict Emotions.

Artificial Intelligence Adarsh Patel 202210101330027


Experiment – 10
Objective - Implementing RNN and LSTM - Understanding the working of Recurrent Neural
Networks and LSTM.

Working - Recurrent Neural Networks (RNNs) are designed to handle sequence data. LSTM is a type of
RNN that is well-suited for learning long-term dependencies in sequences, addressing the vanishing gradient
problem.

Step – 1 ) Import Libraries and Load Dataset.

Step – 2 ) Build and Train the RNN Model.

Artificial Intelligence Adarsh Patel 202210101330027


Step – 3 ) Evaluate the RNN Model.

Step – 4 ) Build and Train the LSTM Model.

Step – 5 ) Evaluate the LSTM Model.

Artificial Intelligence Adarsh Patel 202210101330027

You might also like