0% found this document useful (0 votes)
7 views5 pages

Lab 4

The document outlines Lab 06 for the CS326 course at Usman Institute of Technology, focusing on Artificial Neural Networks and the implementation of a Multilayer Perceptron Classifier in Python. It includes objectives, student information sections, and a sample Python code for loading a dataset, training a model, and evaluating its accuracy. Students are tasked with implementing the code, discussing its components, and analyzing performance metrics.

Uploaded by

Rizwana Qurban
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)
7 views5 pages

Lab 4

The document outlines Lab 06 for the CS326 course at Usman Institute of Technology, focusing on Artificial Neural Networks and the implementation of a Multilayer Perceptron Classifier in Python. It includes objectives, student information sections, and a sample Python code for loading a dataset, training a model, and evaluating its accuracy. Students are tasked with implementing the code, discussing its components, and analyzing performance metrics.

Uploaded by

Rizwana Qurban
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/ 5

Usman Institute of Technology

Department of Computer Science


Course Code: CS326
Course Title: Artificial Intelligence and Expert System
Spring 2024

Lab 06

Objective: Introduction to Artificial Neural Network

• To Understand the concept Artificial Neural Network.


• To implement Artificial Neural Network, i.e., Multilayer Perceptron Classifier.

Student Information

Student Name

Student ID

Date

Assessment

Marks Obtained

Remarks

Signature
Usman Institute of Technology
Department of Computer Science
CS326 – Artificial Intelligence and Expert System
Lab 06

Artificial Neural Network (ANN)


Example in Python – MLP Classifier
# Import necessary libraries
from sklearn.datasets import load_breast_cancer
from sklearn.neural_network import MLPClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import warnings
warnings.filterwarnings('ignore')

# Load dataset
data = load_breast_cancer()

# Split dataset into training and testing sets


X = data.data
y = data.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,
random_state=42)

# Create a multi-layer perceptron classifier


mlp = MLPClassifier()

# Fit the model on the training data


mlp.fit(X_train, y_train)

# Make predictions on the testing data


predictions = mlp.predict(X_test)

# Calculate the accuracy of the model


accuracy = accuracy_score(y_test, predictions)
print("Accuracy:", accuracy)

Student Tasks:

Class Task

For Clustering Algorithms

a. Implement the provided code.


b. Discuss each line/block of code
c. Discuss the Performance Metrics and Analyze the Output

Home Task

a. Use different values for each of the parameters to analyse the accuracy of the MLP classifier.

You might also like