0% found this document useful (0 votes)
28 views8 pages

Bsee23 Aml Lab 1

This document outlines Lab 1 of the Applied Machine Learning course, detailing learning outcomes, equipment requirements, and core Python libraries. It includes specific lab tasks involving Python programming, data manipulation with Pandas, and data visualization with Matplotlib. Assessment rubrics for evaluating student performance in various competencies are also provided.

Uploaded by

Ziml Tariq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views8 pages

Bsee23 Aml Lab 1

This document outlines Lab 1 of the Applied Machine Learning course, detailing learning outcomes, equipment requirements, and core Python libraries. It includes specific lab tasks involving Python programming, data manipulation with Pandas, and data visualization with Matplotlib. Assessment rubrics for evaluating student performance in various competencies are also provided.

Uploaded by

Ziml Tariq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Department of Electrical Engineering

EE: Applied Machine Learning

Course Instructor:Dr. Sadia Naureen Date: 29-Sep-2025

Lab Engineer: Dr. Isma Javed Semester: 5th

Lab 1: Introduction to Applied Machine Learning

Weightage
Lab Title CLO BT PLO

1,2

Report Viva Total


Name Roll Number
Marks/10 Marks/5 Marks/15

Ziml Tariq BSEE22056

Checked on: __________________________

Signature: __________________________
1.1 Learning Outcomes
After completing this Lab, the student will be able to:

• Understand the basic syntax and data structures of Python.


• Install and utilize key Python libraries for data science: NumPy,
Pan- das, and Matplotlib.
• Create and manipulate arrays, matrices, and DataFrames.
• Generate basic plots and visualizations.
• Implement control flow using loops and conditional statements.

1.2 Equipment
• PC with Python 3.x installed (Anaconda Distribution recommended).
• IDE of choice (Jupyter Notebook, Spyder, VS Code, or PyCharm).
1.3 Theory & Background
Machine Learning (ML) heavily relies on data manipulation, statistical
analysis, and visualization. Python has become the i m p o r t a n t for
ML due to its simplicity and the powerful ecosystem of libraries that
handle these tasks efficiently.

1.3.1Core Python Libraries


• NumPy: The fundamental package for numerical computation in
Python. It provides support for large, multi-dimensional arrays
and matrices, along with a collection of mathematical functions
to operate on these arrays.
• Pandas: A library providing high-performance, easy-to-use data
struc- tures (Series and DataFrames) and data analysis tools. It is
essential for data cleaning, transformation, and manipulation.
• Matplotlib: A comprehensive library for creating static,
animated, and interactive visualizations in Python. It provides
a MATLAB-like interface and is highly customizable.

Q1-CLO1. Python Basics and NumPy Operations [1 Mark]


1. Create a 1D NumPy array ‘arr1‘ with values from 0 to 9.
2. Create a 2x3 NumPy array ‘arr2‘ with all elements initialized to 5.
3. Perform the following operations and print the results:
[0.5 Mark]

Q2. Creating and Manipulating Pandas DataFrames [1 Mark]


1. Create a DataFrame ‘df‘ with the following data.

2. Add a new column ‘Salary‘ with values [50000, 65000, 45000].


3. Select and print only the rows where ‘Age‘ is greater than 23.
4. Calculate and print the average salary.

Q3. Data Visualization with Matplotlib [1 Mark]


Using the DataFrame ‘df‘ from Q2:
1. Create a bar chart showing the salary of each person.
2. Label the x-axis as ’Name’, the y-axis as ’Salary (PKR)’, and give
the chart a title ’Employee Salaries’.
3. Create a simple line plot of the array ‘arr1‘ from Q1 against its index.
Add a title and labels.

Q4. Control Flow and Loops [1 Mark]


1. Use a for loop to iterate through the ‘Age‘ column in the DataFrame
‘df‘ and print ”Young” if the age is less than 25, otherwise print
”Adult”.
2. Use a loop to calculate the factorial of 5 (5!).
Lab Tasks
Task 1: Data Analysis on Synthetic Sensor Data [2 Marks]
 Create a NumPy array with 100 random temperature values between 15 and 35 degrees
 Convert it to a Pandas Series
 Calculate and display the requested statistics
 Create a line plot with appropriate labels and title
Task 2: Student Records DataFrame [2 Marks]
Create a DataFrame students for 5 hypothetical students with the following
columns: StudentID, Name, Score_ML (Marks in Machine Learning out of
100), Score_CP (Marks in Computer Programming out of 100).

Add a new column Total which is the sum of Score_ML and Score_CP.
Add a new column Status that contains "Pass" if Total is greater than 120, otherwise "Fail".
Use Matplotlib to create a scatter plot of Score_ML vs Score_CP. Color the points red if the
student failed and green if they passed.

Task 3: Matrix Operations [2 Marks]


1. Create two matrices, ‘A‘ (2x3) and ‘B‘
(3x2), filled with random integers.
2. Perform matrix multiplication on A and B
(using ‘np.dot(A, B)‘ or ‘A @ B‘) and
print the result.
3. Calculate and print the transpose of the resulting matrix.
Conclusion
[1 Mark]
Assessment Rubrics
EE472: Applied Machine Learning – Lab ___
Method: Lab reports and instructor observation during lab sessions

Outcome Assessed:
a. Ability to conduct experiments, as well as to analyze and interpret data (P).
b. Ability to function on multi-disciplinary teams (A).
c. Ability to use the techniques, skills, and modern engineering tools necessary for
engineering practice (P).

Exceeds expectation Meets expectation Does not meet


Performance Marks
(4-5) (3-2) expectation (1)
Selects relevant Needs guidance to Incapable of
equipment to the select relevant selecting relevant
experiment, develops equipment to the equipment to
1. Realization of setup diagrams of experiment and to conduct the
Experiment [a, c] equipment develop equipment experiment,
connections or wiring. connection or wiring equipment
diagrams. connection or wiring
diagrams are
Actively engages and Cooperates with other Distracts or
cooperates with other group members in a discourages other
2. Teamwork [b] group members in an reasonable manner. group members
effective manner. from conducting the
experiment.
Does proper Calibrates equipment, Unable to calibrate
calibration of examines equipment appropriate
equipment, carefully moving parts, and equipment, and
3. Conducting examines equipment operates the equipment operation
Experiment [a, c] moving parts, and equipment with minor is substantially
ensures smooth error. wrong.
operation and process.

Respectfully and Observes safety rules Disregards safety


4. Laboratory carefully observes and procedures with rules and
Safety Rules [a] safety rules and minor deviation. procedures.
procedures
Exceeds expectation Meets expectation Does not meet
Performance Marks
(5-4) (3-2) expectation (1)
Plans data collection to Plans data collection Does not know how to
achieve experimental to achieve plan data collection to
5. Data objectives, and experimental achieve experimental
conducts an orderly objectives, and goals; data collected is
Collection [a]
and a complete data collects complete data incomplete and
collection. with minor error. contain errors.

Accurately conducts Conducts simple Unable to conduct


simple computations computations and simple statistical
and statistical analysis statistical analysis analysis on collected
using collected data; using collected data data; no attempt to
correlates with minor error; correlate experimental
experimental results to reasonably correlates results with known
6. Data Analysis known theoretical experimental results to theoretical values;
[a] values; accounts for known theoretical incapable of
measurement errors values; attempts to explaining
and parameters that account for measurement errors or
affect experimental measurement errors parameters that affect
results. and parameters that the experimental
affect experimental results.
results.
Uses computer to Uses computer to Does not know how to
7. Computer collect and analyze collect and analyze use computer to
Use [a] data effectively. data with minor error. collect and analyze
data.

Total

Lab Engineer: Faculty:


Name: Name:

Signature: Signature:

Date: Date:

You might also like