University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-I
(PANDAS)
1. Create a Pandas series named ‘weights’ containing 30 random integers between
45 and 60.
2. Verify the type of value stored in the 'weights' variable using the 'type()' function.
3. Create a Python list which contains students name, height, weight and False if the
student is not having a good BMI. Convert the list into a Pandas series. Also,
verify whether the list successfully is converted to a Pandas series or not.
4. Find the number of rows and columns in the 'weights' series.
5. Calculate the average value of all the numbers in the Pandas series.
6. Print the minimum and maximum values in the Pandas series.
7. Print only the first 5 items in a Pandas series.
8. Print the last 5 items in the Pandas series.
9. Print the first 8 items of the weights series.
10.Print the last 12 items of the weights series.
11.Retrieve items from a Pandas series using the indexing method.
12.Print the items ranging from the indices 17 to 27.
13.Compute the modal value in the series.
14.Arrange the weights in the increasing order using the 'sort_values()'
15.Using the 'sort_values()' function, arrange the weights in the decreasing order.
16.Using the 'median()' function, find the median weight in the weights series.
17.Count the number of times each item in the 'weights' Pandas series occurs.
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-II
(NUMPY-Part 1)
1. Create an array containing '1' as its items using the 'ones()' function from the
'numpy' module.
2. Using the 'type()' function, verify whether the 'ones' array is a NumPy array or
not.
3. Using 'zeros()' function, create a NumPy array having 4 blocks, 2 rows and 3
columns. The items should be int data-type.
4. Using 'zeros()' function, create a numpy array having 4 blocks, 2 rows and 3
columns.
5. Using the 'dtype' keyword, verify whether the 'zeros_float' array items are
floating-point values or not.
6. Using the 'dtype' keyword, verify whether the 'ones' array items are int values or
not.
7. Run the code shown below to see that the 'type()' function returns the type of
Python object.
8. Using the 'ndim' array, find out the dimension of 'ones', 'zeros' and 'zeros_float'
NumPy arrays.
9. Using the 'shape' keyword find out the number of blocks, rows and columns in
the 'ones', 'zeros' and 'zeros_float' arrays.
10.Create a one-dimensional array containing numbers between 5 and 20 using the
'arange()' function in the NumPy module.
11. Create an array of numbers from 1 to 24 such that the difference between two
consecutive numbers is 4.
12.Create an array of numbers from 1 to 24 such that the difference between two
consecutive numbers is 4 and each item is a float.
13.Create an array containing 4 numbers between 1 to 25.
14.Create an array containing 10 numbers between 1 and 25 such that the difference
between two consecutive numbers is constant.
15.Reshape the 'zeros' array so that it has 6 rows and 4 columns.
16.Reshape the 'ones' array so that it has just 1 row.
17.Create a 'numpy' array using 'ndarray()' function having 5 rows and 2 columns.
18.Create a one-dimensional NumPy array containing 15 random integers between
50 and 100.
19.Create a two-dimensional NumPy array containing 15 random integers between
50 and 100.
20.Create a three-dimensional NumPy array containing 40 random integers between
50 and 100.
21.Convert a Python list into a NumPy array using the 'array()' function.
22.Verify whether the 'arr' array is a NumPy array or a Python list.
23.Convert a NumPy array into a Python list using the 'list()' function.
24.Verify whether the 'arr_converted' list is Python list or not.
25.Create a function to check whether the input lenghts represent the lengths of the
side of a triangle.
26.Create a function to calculate the area of a triangle using the Heron's formula.
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-III
(NUMPY-Part 2)
1. Create a list of angles representing angles either angles in radians or degrees.
2. Calculate the sine of the angles.
3. Calculate the cosine of the angles.
4. Calculate the tangent of the angles.
5. Calculate the first 10 powers of the Napier's constant (or e).
6. To get the logarithms of a number a , i.e., log10a , use the np.log10()
function.
7. Create two distinct one-dimensional arrays and get the items common between
them.
8. Get all the items of two distinct one-dimensional arrays created above.
9. Create a NumPy array for all the three different dimensions and calculate their
lengths.
10.Compute the number of items in the 'one_dim_ar', 'two_dim_ar' and
'three_dim_ar' NumPy arrays.
11.Consider that you are a smartphone retailer and you have few smartphones in
your inventory. Suppose you decided to do some analysis of your inventory.
In the process, you want to find answers to the following questions:
12.What is the total monetary value of the inventory?
13.What is the average (or mean) price of a smartphone?
14.What is the price of the cheapest smartphone in the inventory?
15.What is the price of the most expensive smartphone in the inventory?
16.What is the median price of a smartphone?
17.What is the most commonly occurring price of a smartphone?
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-IV
(NUMPY- Part 3)
1. Square the values in a numpy array.
2. Directly apply the exponent (**) operator on a Python list.
3. Directly multiply a Python list with a number.
4. Square all the items in a Python list.
5. Create two NumPy arrays. One having a radii of 10 cylinders and another having
their corresponding heights. Compute the volume of the 10 cylinders by
multiplying the NumPy arrays and store the new NumPy array in the new
variable.
6. Run the code shown below to see that NumPy arrays are faster than Python lists.
7. Create the 'mode()' function which takes a 1D NumPy array as an input and
returns the modal value and its count as an output.
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-V
(Data Visualization)
1. Write a python program to make the pie chart from the given data:
labels=['Oxygen','Hydrogen','Carbon_dioxide','nitrogen'],
values=[4500,2500,1053,500]
2. Write a python program to daw a bar chart for the given data:
month=['Jan','Feb','Mar','Apr','May','June','July','Aug','Sep','Oct','Nov','Dec'],
avetemp=[9.0,15.0,22.0,30.4,36.7,40.8,42.7,45.6,44.7,42.8,30.7,7.0]
3. Write a python program to draw a line chart for the following:
x_data=[2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012],
y_data=[18,21,18,21,16,14,13,18,17,16,19,23]
4. Write a program to create the pie chart use a different colour for different
countries. title: Carbon emissions of the countries(1990-2011)
values=[27,11,25,8,1,3,25], countries=["US","China","European
Union","Russian federation","Brazil","India","Rest of World"]
5. Write a python program to draw a line with suitable labels in the x-axis, y-axis
and a title. value of x must be entered by the user as the list and value of Y
should be twice of x.
6. Import the required modules. Create a DataFrame for the dataset for this
project and store it in the df variable.
7. Display the first 5 rows using the 'head()' function.
8. Display the last 5 rows using the 'tail()' function
9. Display the number of rows and columns using the 'shape' keyword
10.Check for the missing values using the 'isnull()' function.
11.Scatter plot between y and x1.
12.Line plot between y and x1.
13.Scatter plot between y and x2.
14.Line plot between y and x2.
15.Scatter plot between y and x3.
16.Line plot between y and x3.
17.Scatter plot between y and x4.
18.Line plot between y and x4.
19.Scatter plot between y and 2 * x1 + 3 * x2 + 4 * x3 + 5 * x4.
20.Line plot between y and 2 * x1 + 3 * x2 + 4 * x3 + 5 * x4.
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-VI
(Linear Regression)
1. What is Linear Regression?
2. Deploy a Linear Regression model of Machine Learning on the given 2 datasets.
3. Inspect the column headers.
4. When we do a regression there are two types of variables. What are they? Discuss
with respect to the given datasets.
5. Visualize the results graphically.
6. Analyze and compare the results of both the datasets.
7. Justify the usage of Linear Regression Model in these type of datasets.
8. Based on your exploratory view of the data what do you think are the key
relationships within this data set?
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-VII
(Logistic Regression)
1. Deploy a Logistic Regression model of Machine Learning on the given 2
datasets. Explain the Sigmoid curve in detail.
2. Inspect the column headers.
3. Analyze and compare the results.
4. Visualize the results graphically.
5. Justify the usage of Logistic Regression Model in these type of datasets.
6. Why Linear Regression fails here?
7. Based on your exploratory view of the data what do you think are the key
relationships within this data set?
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-VIII
(Clustering)
1. Deploy basic K-means Clustering model along with the visual representation of the
Elbow Method.
2. Inspect the column headers.
3. Analyze and compare the results.
4. Visualize the results graphically.
5. What type of Learning is clustering? Why we applied clustering here?
6. Deploy 1D and 2D K-means Clustering model on the given dataset.
7. Analyze and do a comparative study of both the models.
8. Based on your exploratory view of the data what do you think are the key
relationships within this data set?
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-IX
(Confusion Matrix)
1. What is Confusion Matrix? Why is it significant in Machine Learning?
2. Visualize Confusion Matrix on the given dataset through Python coding.
3. Inspect the column headers.
4. Visualize the results graphically.
5. What is Heat Map? Visualize it graphically.
6. What is TP, FP, TN, FN ?
7. Describe each of the above parameters with respect to the dataset given. What
does these signify?
8. What is the accuracy, precision, recall and F1 score of the model deployed?
9. Based on your exploratory view of the data what do you think are the key
relationships within this data set?
University of Engineering and Management, Kolkata
Course: B. Tech Admission Batch 2022
Department: CSE (AI & ML)
Semester: 5th
Paper Name: AI and ML Lab
Paper Code: PCCCS594
ASSIGMENT NO.-X
(Decision Tree)
1. What is Decision Tree? What is it’s significance in Machine Learning?
2. Deploy Decision Tree model on the given dataset. What is the significance of
using this model?
3. Inspect the column headers.
4. Visualize the results graphically.
5. Calculate the accuracy of the model.
6. Display the Precision, Recall and F1-score of the model.
7. Based on your exploratory view of the data what do you think are the key
relationships within this data set?