0% found this document useful (0 votes)
27 views2 pages

DLWP Assignment 3

The document outlines an assignment for a Deep Learning Workshop, detailing ten tasks that involve writing Python code for various neural network implementations and algorithms. Tasks include training a perceptron, implementing feedforward and backpropagation in neural networks, using gradient descent for linear regression, and applying activation functions. Additionally, it covers the use of libraries like NumPy and TensorFlow for tasks such as predicting digits from the MNIST dataset and analyzing a healthcare dataset.
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)
27 views2 pages

DLWP Assignment 3

The document outlines an assignment for a Deep Learning Workshop, detailing ten tasks that involve writing Python code for various neural network implementations and algorithms. Tasks include training a perceptron, implementing feedforward and backpropagation in neural networks, using gradient descent for linear regression, and applying activation functions. Additionally, it covers the use of libraries like NumPy and TensorFlow for tasks such as predicting digits from the MNIST dataset and analyzing a healthcare dataset.
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/ 2

Centre for Artificial Intelligence Machine Learning

Institute of Technical Education & Research, SOA, Deemed to be University

Deep Learning Workshop With Python (CSE 3194)


A SSIGNMENT-3: I NTITUTION OF N EURAL N ETWORK

1. Write a Python code from scratch to train a perceptron with input 3X3 matrix having values as
X=[[0.5, 1.2, −0.3], [−1.5, 2.3, 0.8], [1.0, −0.5, 2.0], [−0.3, 0.8, −1.2]] and target Y=[[1, 0, 1, 0]]initialize
the weight as [0, 0, 0] bias as 0 and the learning rate as 0.1 with 10 iterations.

2. Write a Python code from scratch for feed forward neural network with sigmoid activation func-
tion and the input value is [[0, 3.5], [1, 2], [1, 0.5]] and target is [[1], [1], [0]] with weights as [[0.5,0.1,-
0.3],[0.7,-0.3,0.2]] and bias as [[0.4, 0.1, −0.1]] for hidden layer and weight as [[0.8], [0.1], [−0.1]]and
bias as [[0.2]] for output layer.

3. Write a Python code to use backpropagation in Q.2 to update the weight and bias in such a manner
that will improve the predicted class by minimizing the loss. Also print the loss after each 100th
iteration. Let take the number of iterations to be 500.

4. Write a Python code to use a gradient descent algorithm from scratch to update the mean squared
error in linear regression for input x=[1,2,3] and target y=[6,7,8] where the slope and intercept are 0
and the learning rate is 0.01. Print the slope and intercept for 200th iteration and MSE for each 100th
iteration. Also print the final slope, intercept and mse.

5. Write a Python code to use a stochastic gradient descent algorithm from scratch to update the squared
error in linear regression for input x=[1,2,3] and target y=[2,4,6] where the slope and intercept are 0
and the learning rate is 0.01 . Print the slope and intercept for 3 iteration and also print the final slope,
intercept.

6. Write a Python code for numpy implementation of the softmax activation function with input array as
[2.5,1.2,-0.8].

7. Write a Python code to show the comparison of sigmoid, tanh and ReLU activations function using
matplotlib with input value ranges from-5 to 5.

8. Write a Python code to implement Multilayer perceptron using sklearn for iris dataset available in
sklearn.datasets, train the MLP using hidden layer as 64, activation function as logistic (sigmoid),
solver as sgd(optimizer),maximum iteration to be 300 and also generates the classification report and
print test accuracy. Also discuss the test accuracy for activation function reLU with solver as sgd and
adam.

9. Write a Python code to predict the digits using tensorflow use the mnist dataset and perform the
following operations:
Load the MNIST dataset.
a. Normalize the pixel value.
b. Convert the labels to one-hot encoding.
c. Define the Multilayer Perceptron model with one input layer and two hidden layer with neuron
128 and 64 and output layer with neuron 10 and use softmax activation function at output layer
and relu at hidden layer.
d. Discuss the model performance with SGD and Adam as optimizer .
e. Select a random image from test data and predict the digit .
f. Also generates the classification report.

1
Centre for Artificial Intelligence Machine Learning
Institute of Technical Education & Research, SOA, Deemed to be University

10. Download the dataset from the given url: https://www.kaggle.com/datasets/aouatifcherdid/healthcare-


dataset-stroke-data and perform the following operation:
a. Load and preprocess the dataset.
b. Encode and standardize the features using standardScaler and label encoder.
c. Handle NaN using simpleImputer with strategy mean.
d. Handle the imbalanced data.
e. Split the data with 80:20 for training and testing.
f. Analyze the model with one input one hidden and one output layer with activation function
as sigmoid and optimizer as SGD and one input two hidden and one output layer with activation
function as reLU at hidden layer and sigmoid at output layer and optimizer as SGD.
g. Print the prediction and classification report for two cases and discuss the difference between
the two cases.

You might also like