DV Lab Manual
DV Lab Manual
Name : ……………………………………………………
Batch : ……………… Reg.No : ……………….…..
Branch : ……………. Year : ………………………
KIT-KALAIGNARKARUNANIDHI INSTITUTE OF TECHNOLOGY
(ANAUTONOMOUS INSTITUTION)
(Accredited by NAAC & NBA with ‘A’ Grade)
Approved by AICTE & Affiliated to Anna University, Chennai)
Kannampalayam Post, Coimbatore-641402
BONAFIDE CERTIFICATE
Name : ….…………………………………………………………………………………………
of IV – Year Artificial Intelligence and Data Science during the academic year 2024-2025.
2
Instructions for Laboratory Classes
1. Enter the lab with record work book & necessary things.
7. Shutdown the Computer properly and arrange chairs in order before leaving the lab.
8. The program should be written on the left side pages of the record workbook.
9. The record work book should be completed in all aspects and submitted in the next
class itself.
10. Experiment number with date should be written at the top left-hand corner of the
11. Strictly follow the uniform dress code for Laboratory classes.
13. Avoid eatables inside and maintain the cleanliness of the lab.
3
VISION
To produce competent professionals to the dynamic needs of the emerging field of Artificial
Intelligence and Data Science
MISSION
• To empower students with the knowledge and skills necessary to create intelligent systems and
innovative solutions that address societal issues.
• Providing technical knowledge on par with Industry to the students through qualified faculty members
having knowledge in recent trends and technologies.
• To produce competent engineers who are both professional and life-skills oriented.
• Providing opportunities for students to improve their research skills in order to address a variety of
societal concerns through innovative projects.
PROGRAMMEOUTCOMES (POs)
Students graduating from Artificial Intelligence and Data Science should be able to:
PO2 Problem analysis: Identify, formulate, research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences,
and Artificial Intelligence and Data Sciences.
PO3 Design/development to solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate consideration
for the public health and safety, and the cultural, societal, and environmental considerations in the
field of Artificial Intelligence and Data Science.
PO4 Conduct investigations of complex problems: Using research-based knowledge and Artificial
Intelligence & Data Science oriented research methodologies including design of experiments,
analysis and interpretation of data, and synthesis of the information to provide valid conclusions.
PO5 Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex Artificial Intelligence and
Data Science Engineering activities with an understanding of the limitations.
4
PO6 The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
PO7 Environment and sustainability: Understand the impact of the professional Artificial
Intelligence and Data Science Engineering solutions in societal and environmental contexts, and
demonstrate the knowledge, and need for the sustainable development.
PO8 Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
PO9 Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams and in multidisciplinary settings.
PO12 Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
PEO1: Graduates will have a strong foundation in mathematics, programming, machine learning,
artificial intelligence, and data science, as well as advanced skills in these areas to solve technical
problems.
PEO2: Graduates will have the capability to apply their knowledge and skills to identify and solve the
issues in real world Artificial Intelligence and Data Science related applications.
PEO3: Graduates will be able to engage in life-long learning by completing advanced software
Technologies, certificates, and/or other professional development.
5
PROGRAM SPECIFIC OUTCOME(PSOs)
Graduates of Artificial Intelligence and Data Science Programmed should be able to:
PSO1: Apply fundamental concepts of Artificial Intelligence and Data Science according to the
environmental needs.
PSO2: Ability to develop skills to address and solve Artificial Intelligence based social and
environmental problem using Data Science to deal multidisciplinary projects using modern tools.
COURSE OUTCOMES:
Students will be able to:
CO2: Apply data visuals to convey trends in data over time using tableau. K3
CO3: Construct effective data visuals to solve complex problems.
K3
CO2 K3 3 3 2 1 3 - - - - - - 2 3 3
CO3 K3 3 3 2 1 3 - - - - - - 2 3 3
CO4 K3 3 3 2 1 3 - - - - - - 2 3 3
CO5 K3 3 3 2 1 3 - - - - - - 2 3 3
Weighted 3 3 2 1 3 - - - - - - 2
3 3
Average
6
SYLLABUS
LIST OF EXPERIMENTS
3. Basic Visualization in R.
Total hours: 45
7
No.
Sl.
Model Exam Marks (25):
Date
Name of the Experiment
Page
Number
Aim
(10 Marks)
Program
Signature of the Faculty Member
/procedure
(40 Marks)
Output &
Inference
(15 Marks)
Viva-Voce
( 10Marks )
Total
(75Marks)
Signature of
the Faculty
Member
No.
Sl.
Model Exam Marks (25):
Date
Name of the Experiment
Page
Number
Aim
(20 Marks)
Program
/procedure
Signature of the Faculty Member
(30 Marks)
Output &
Inference
(15Marks)
Viva-Voce
( 10Marks )
Total
(75Marks)
Signature of
the Faculty
Member
S.NO EXPERIMENT PREREQUISITES LEARNING OBJECTIVES
10
Ex. No: 1 Introduction to various Data Visualization tools
Date:
AIM
DESCRIPTION
Data visualization is the practice of translating information into a visual context, such
as a map or graph, to make data easier for the human brain to understand and pull
insights from. It is the representation of information and data through use of common
look into analytical reports and understand concepts that might otherwise
be difficult to grasp.
Table: A table is data displayed in rows and columns, which can be easily created
along an x and y axis, usually with bars, points, or lines, to represent data
in comparison.
18
Geospatial visualization: Data is depicted in map form with shapes and
12
19
Viva Questions:
1. Give Two Top companies where Tableau is Used for Data Visualization.
20
8.Why does NASA use Matlab?
RESULT
Thus the study experiment on various Data visualization tools is successfully completed.
21
Ex. No: 2 Basic Visualization in Python
Date:
Aim :
To implement different visualization effects with Python on data using
matplotlib seaborn.
Description :
22
1. Line plots
2. Area plots
3. Histograms
4. Bar charts
5. Pie charts
6. Box plots
7. Scatter plots
I ) Line Plots:
A line plot is used to represent quantitative values over a continuous interval or
time period. It is generally used to depict trends on how the data has
changed over time.
Program:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5, 6]
y = [1, 5, 3, 5, 7, 8]
plt.plot(x, y)
plt.show()
23
Output :
Program:
import matplotlib.pyplot as plt
days = [1,2,3,4,5]
sleeping =[7,8,6,11,7]
eating = [2,3,4,3,2]
working =[7,8,7,2,2]
playing = [8,5,7,8,13]
plt.plot([],[],color='m', label='Sleeping', linewidth=5)
plt.plot([],[],color='c', label='Eating', linewidth=5)
plt.plot([],[],color='r', label='Working', linewidth=5)
plt.plot([],[],color='k', label='Playing', linewidth=5)
plt.stackplot(days, sleeping,eating,working,playing, colors=['m','c','r','k'])
24
plt.xlabel('x')
plt.ylabel('y')
plt.title('Stack Plot')
plt.legend()
plt.show()
Output :
iii) Histograms:
Histograms represents the frequency distribution of a dataset. It is a graph
showing the number of observations within each given interval.
Program:
import matplotlib.pyplot as plt
population_age=[22,55,62,45,21,22,34,42,42,4,2,102,95,85,55,110,120,70,65,55,111,115,80]
bins = [0,10,20,30,40,50,60,70,80,90,100]
plt.hist(population_age, bins, histtype='bar', rwidth=0.8)
25
plt.xlabel('age groups')
plt.ylabel('Number of people')
plt.title('Histogram')
plt.show()
Output:
rectangular bars with heights or lengths proportional to the values that they represent.
A bar plot is a way of representing data where the length of the bars represents the
26
Program:
Output:
V) Pie Charts:
A Pie chart is a circular statistical chart, which is divided into sectors to illustrate
numerical proportion.
Program :
autopct='%1.1f%%')
plt.title('Pie Plot')
plt.show()
Output:
A Box plot (or box-and-whisker plot) shows the distribution of quantitative data in a
way that facilitates comparisons between variables or across levels of a categorical variable.
Box plot shows the quartiles of the dataset while the whiskers extend encompass
28
the rest of the distribution but leave out the points that are the outliers.
Program:
import matplotlib.pyplot as plt
x=[1,2,3,4,5,6,7]
y=[1,2,4,5,3,6,9]
z=[x,y] plt.boxplot(z,labels=[‘A’,’B’],showmeans=True)
plt.show()
Output:
A Scatter chart, also called a scatter plot, is a chart that shows the relationship between
two variables.
Program:
import matplotlib.pyplot as plt
x=[1,1.5,2,2.5,3,3.5,3.6]
y=[7.5,8,8.5,9,9.5,10,10.5]
x1=[8,8.5,9,9.5,10,10.5,11]
y1=[3,3.5,3.7,4,4.5,5,5.2]
plt.scatter(x,y, label='high income low saving',color='r')
plt.scatter(x1,y1,label='low income high savings',color='b')
plt.xlabel('saving*100')
plt.ylabel('income*1000')
plt.title('Scatter Plot')
plt.legend()
plt.show()
29
Output
30
Viva Questions :
31
Result:
Thus, the implementation of various visualization using python Matplotlib was executed
Successfully
32
Ex. No: 3 Basic Visualization in R
Date:
AIM
DESCRIPTION:
ggplot2 is an open-source data visualization package for the statistical programming
language R. ggplot is enriched with customized features to make visualization better.
ggplot2 is a system for declaratively creating graphics, based on the Grammar
Of Graphics .
The ggplot2 package can be easily installed using the following R function:
install. packages(ggplot2)
then the following command must be used in program to use
ggplot package: library(ggplot2)
Consider the following dataset named surveys.
All the visualizations mentioned above are applied on this dataset.
Surveys<-data.frame(
record_id=c(1,2,3,4,5),
month=c(7,7,7,7,7),
day=c(16,16,16,17,17),
year=c(1977,1977,1977,1977,1977),
plot_id=c(2,3,2,7,3),
species_id=c(NL,NL,DM,DM,DM),
sex=c(M,M,F,M,M),
hindfoot_length=c(32,33,37, 36,35))
weight = c(20, 22, 25, 23, 24) # Added weight variable for demonstration
33
)
1. Scatter plots
2. Line plots
3. Box plots
4. Histograms
5. Bar charts
34
1.Scatter plot
Program:
library(ggplot2)
# Scatter plot
ggplot(data = Surveys, mapping = aes(x = hindfoot_length, y = weight)) +
geom_point(alpha = 0.1, color = "blue")
OutPut:
35
2) Histogram
Program
library(ggplot2)
Surveys <- data.frame(
record_id = c(1, 2, 3, 4, 5),
month = c(7, 7, 7, 7, 7),
day = c(16, 16, 16, 17, 17),
year = c(1977, 1977, 1977, 1977, 1977),
plot_id = c(2, 3, 2, 7, 3),
species_id = c("NL", "NL", "DM", "DM", "DM"),
sex = c("M", "M", "F", "M", "M"),
hindfoot_length = c(32, 33, 37, 36, 35),
weight = c(20, 22, 25, 23, 24) # Added weight variable for demonstration
)
Output:
36
3) Bar Chart
Program
library(ggplot2)
library(dplyr)
37
labs(title = "Total Weight by Species", x = "Species ID", y = "Total Weight")
Output:
4.Box Plot:
Program
library(ggplot2)
# Load required package
library(ggplot2)
38
year = c(1977, 1977, 1977, 1977, 1977),
plot_id = c(2, 3, 2, 7, 3),
species_id = c("NL", "NL", "DM", "DM", "DM"),
sex = c("M", "M", "F", "M", "M"),
hindfoot_length = c(32, 33, 37, 36, 35),
weight = c(20, 22, 25, 23, 24) # Added weight variable for demonstration
)
Output:
39
5)Line Plot
Program
40
Output:
41
Viva Questions :
42
Result:
Thus, the implementation of various visualization using ggplot2 in R language was
implemented Successfully.
43
Ex. No: 4 Introduction to Tableau and Installation
Date:
AIM
To implement the Tableau installation tool for performing the Data visualization.
DESCRIPTION:
Tableau is a data visualization tool that provides pictorial and graphical representations
of data. It is used for data analytics and business intelligence. Tableau provides limitless
data exploration without interrupting flow of analysis. With an intuitive drag and
drop interface, user can uncover hidden insights in data and make smarter decisions faster.
https://www.tableau.com/products/public/download
44
Click the licence agreement checkbox and then click on install button.
After installation,click on Tableau Public icon to run Tableau.
Following is the Tableau Public home screen.
45
Viva Questions
Result :
Thus the Tableau for Public was installed successfully .
46
5 Connecting to Data and preparing data for visualization in Tableau
Date:
Aim
To connect the data from the external source and prepare it for visualization
DESCRIPTION:
Now drag Returns table onto the Canvas to the right of Orders table. This
shows the relation between the two tables Orders and Returns.
48
If we click on the link between Orders and Returns table names at the top
gives the summary of the relationship between the tables. Now rename the
data store and click on Sheet1 at the
bottom left to proceed. This step creates a data extract which improves
query performance.
49
VIVA VOICE
50
Result:
I have learnt thus the implementation for loading the prepared data was executed
successfully
51
Ex. No: 6
Data aggregation and statistical functions
Date:
AIM
To implement the data aggregation and statistical functions
DESCRIPTION:
We can apply various aggregation and statistical functions on data such as count,
minimum, maximum, standard deviation, variance etc. This is shown below.
This can be done by right clicking on the required field of dataset, click on Default
properties and click on aggregation.
Or the above operation can be done by creating a calculated field as shown below. To create
a calculated field, click on the down arrow button beside search tab above Tables panel, drag
a field to that calculated field window.
52
Then click on apply and results are shown below:
In the same way we can apply any aggregate or statistical function on data with the help
of calculated fields.
53
Output:
54
VIVA VOICE
1. What is aggregation in data visualization?
55
Result:
Thus the implementation data aggregation and statistical functions are profound using tableau
Is completed and executed successfully
56
Ex. No: 7
Data Visualization
Date:
AIM
To implement various types of Visualization using tableau
Description:
We can perform various visualization operations on data in Tableau. Some of them are bar cart,
histogram, bubble chart, gantt chart, scatter plot, heat map etc.
Bar chart:
Bar charts can be created in 3 variations in Tableau: Horizontal bars, stacked bars, side-by-side
bars.
Horizontal bars can be created by selecting that type of chart from Show Me menu on right
hand side of Canvas. The type of chart in box on right hand side represents horizontal bar graph.
57
In similar to above, stacked bar graph can be created and the result is shown
below
58
Line graph: Line graph can be continuous or discrete.
Continuous line graph is shown below:
59
Pie chart:
Bubble chart:
60
Heat map:
61
VIVA VOICE
62
RESULT
Thus the implementation of visualization using different types in tableau is
completed and executed successfully
63
Ex. No: 8
Dashboards
Date:
AIM
To implements Dashboards using tableau
Description:
For example, category of sales across months in a year, region is the field
added. The first view is shown below. This can be renamed at the bottom
of the screen.
Now go to 2nd sheet for creating the642nd view. The second view is shown
below. A bubble chart was drawn between profit and subcategory. Then
rename the sheet.
Next 3rd view is created as follows for profit for each subcategory in the category
with averages.
now the sheets or views which are created earlier can be drag and dropped on this dashboard.
The above three created views are placed in the dashboard as follows. One can follow their own
way of importing sheets on the dashboard. After creating dashboard, title can be given to the
dashboard from Dashboard tab. Dahsboard can be customized in terms of its appearance by the
user if requied. Dashboard once created can be saved on users system and can be retrieved
whenever required.
66
67
OUTPUT
68
VIVA VOCE:
1. What are dashboards in tableau?
69
RESULT
70
CONTENT BEYOND SYLLABUS
71
Ex. No: 9
Date:
AIM
Procedure:
72
PROGRAM:
73
74
OUTPUT:
Result:
75