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

DLWP Assignment 2

This document outlines an assignment for a Deep Learning Workshop, focusing on practical Python coding tasks using libraries such as Numpy, Pandas, and Matplotlib. The tasks include matrix operations, data manipulation with dataframes, generating Markov chains, plotting functions and graphs, and calculating various loss functions. Each task is designed to enhance understanding of data handling and analysis in Python.
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)
2 views2 pages

DLWP Assignment 2

This document outlines an assignment for a Deep Learning Workshop, focusing on practical Python coding tasks using libraries such as Numpy, Pandas, and Matplotlib. The tasks include matrix operations, data manipulation with dataframes, generating Markov chains, plotting functions and graphs, and calculating various loss functions. Each task is designed to enhance understanding of data handling and analysis in Python.
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-2: I NTRODUCTION TO N UMPY ,PANDAS ,M ATPLOTLIB , L OSS
F UNCTIONS

1. Write a Python code to to multiply two 3x3 matrix using Numpy.


2. Write a Python code to convert a 2D array in 1D without using numpy function.
3. Write a Python code to generate an array of 10 numbers between 1 and 100 and find their mean and
variance without using numpy function.
4. Write a Python code to find the transpose of a matrix without a numpy function.
5. Write a Python code to generate 12 states of Markov chain for the given weather states as [‘Sunny’,
‘Rainy’, ‘Cloudy’] and the transition matrix as [[0.6,0.2,0.2],[0.3,0.5,0.2],[0.5,0.4,0.1]]where the row
indicate the current state and column indicate the next state.
6. Write a Python code to ccreate a dataframe and perform the following operations:
data = ”id”:[1,2,3,4], ”Name”: [”Ram”, ”Bob”, ”Dave”,”Jill”], ”Age”: [25, 30, 35,32], ”Gender”:
[”Male”, ” Male ”, ” Male ”,” Female ”], ”City”: [”New York”, ”Los Angeles”, ”Chicago”,”New
York”]
A) Save the dataframe to data.csv file(Use df.to csv(filename,index=False) function.
B) Select a specific column “Age” from the dataframe.
C)Find the shape of the dataframe.
D) Filter rows based on a condition where age > 30.
E) Sort a DataFrame by an increasing order of age.
F) Filter the dataframe based on the given condition Age>30 and Gender==‘Male’
G) Rename the columns as ‘UniqueID’,‘Full Name’,’Years’(instead of Age)
H) Create another dataframe from dict1=”UniqueID”:[1,2,3,4], ”Salary”: [50000,45000,60000,70000]
and merge two dataframe based on a column id.
7. Write a Python code to plot a function y=x2 take 100 values of x in the range of -10 to 10.(Use
linspace)
8. Write Python code to plot a bar graph with the given information:
categories = [”A”, ”B”, ”C”, ”D”,”E”]
values = [10, 25, 35, 40,55]
colors = [”red”, ”green”, ”blue”, ”purple”, ”yellow”]
9. Write a Python code to perform the following operations on the given values:
y true = [0, 1, 1, 0, 1, 0, 1, 1, 0, 0]
y pred = [0, 1, 0, 0, 1, 1, 1, 1, 0, 1]
A)To generate a classification report on the given values.
B)To extract the precision, recall and F1-score and visualize using bar chart.
C)To plot a confusion matrix using matplotlib.
D)To visualize the precision, recall and F1 score using bar chart .
10. Write a Python code to generate a classification report and extract the precision, recall and F1-score
for a multi-class problem and also visualize it as given below:
y true multi = [0, 1, 2, 2, 0, 1, 1, 2, 0, 0]
y pred multi = [0, 1, 2, 1, 0, 2, 1, 2, 0, 1]
1
Centre for Artificial Intelligence Machine Learning
Institute of Technical Education & Research, SOA, Deemed to be University

11. Write a Python code to find the mean square error for the given value from scratch:
y true = [4.5,1.5,11.4,13.3,11.0,10.9]
y pred = [3.4,2.1,12.1,10.2,12.0,14.2]

12. Write a Python code to find the mean absolute error for the given value from scratch:
y true = [4.5,1.5,11.4,13.3,11.0,10.9]
y pred = [3.4,2.1,12.1,10.2,12.0,14.2]

13. Write a Python code to find binary cross entropy loss for the given value:
y true = [1, 0, 1, 1]
y pred = [0.9, 0.2, 0.8, 0.7]

14. Write a Python code to find multiclass cross-entropy loss for the given data values:
y true = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] # One-hot encoded
y pred = [[0.7, 0.2, 0.1], [0.1, 0.8, 0.1], [0.2, 0.1, 0.7]]

You might also like