0% found this document useful (0 votes)
9 views28 pages

Data Intelligence Lab Record

The document is a laboratory report submitted by Mohana Shree K for the Master of Business Administration degree at SSN School of Management. It includes various assignments related to data intelligence, covering topics such as data cleaning, linear regression, confidence intervals, and machine learning classification metrics. The report showcases practical applications of statistical methods and data analysis techniques in business contexts.

Uploaded by

user
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)
9 views28 pages

Data Intelligence Lab Record

The document is a laboratory report submitted by Mohana Shree K for the Master of Business Administration degree at SSN School of Management. It includes various assignments related to data intelligence, covering topics such as data cleaning, linear regression, confidence intervals, and machine learning classification metrics. The report showcases practical applications of statistical methods and data analysis techniques in business contexts.

Uploaded by

user
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

PBA3211 Data Intelligence Laboratory

Submitted in partial fulfilment of

the requirement for the award of the degree of

MASTER OF BUSINESS ADMINISTRATION

Name of the Student : Mohana Shree K

Register No : 3122258001068

SSN School of Management

(SSN College of Engineering, Kalavakkam –


603 110) (An Autonomous Institution, Affiliated

to Anna University, Chennai)


SSN SCHOOL OF MANAGEMENT

BONAFIDE CERTIFICATE

This is to certify that, this is a Bonafide record work done by Mohana Shree K (Reg. No
3122258001068), full time student of SSN School of Management, Kalavakkam, towards
submission for the End Semester Practical Examination held on .

Lab In-charge HOD

Kalavakkam Date:

Examiner I Examiner II
TABLE OF CONTENTS

Ex No. Date Title Page No

1 29/01/2026 Assignment 1 1

2 02/02/2026 Assignment 2 5

3 10/02/2026 Assignment 3 6

4 18/02/2026 Assignment 4 11

5 18/02/2026 Assignment 5 14

6 25/02/2026 Assignment 6 17

7 25/02/2026 Assignment 7 20

8 05/03/2026 Assignment 8 23
DI Assignment 1

Name: Mohana Shree

Reg No: 3122258001068

Code:

1
2
3
4
DI ASSIGNMENT 2
Name: Mohana Shree K
3122258001068

Code:

5
DI ASSIGNMENT 3
Name: Mohana Shree K

3122258001068

• The penguins dataset includes details on species, island, and physical features
like bill size, flipper length, and body mass.
• Some entries contain missing values (NaN), so the data needs cleaning before
analysis or visualization.

6
• The scatter plot displays the relationship between bill length and bill depth, with
points grouped into clear clusters.
• These clusters indicate differences in bill size, likely representing different
penguin species.

• Adding species as hue clearly separates Adelie, Chinstrap, and Gentoo penguins
into distinct clusters.
• This shows that bill length and bill depth are strong features for identifying
penguin species.

7
• Using body mass as point size shows that Gentoo penguins generally have a
larger body mass, shown by bigger points.
• Along with color-based species separation, point size highlights differences in
body mass across species and bill measurements.

• Differentiating by island shows how bill size and species differ across Torgersen,
Biscoe, and Dream islands.
• Gentoo penguins (larger points due to higher body mass) are mostly found on
Biscoe, while Adelie and Chinstrap are common on the other islands.

8
• The line chart shows a clear positive trend where body mass increases with
flipper length.
• This indicates a strong relationship between flipper size and overall body weight
in penguins.

• The bar chart shows that Gentoo penguins have a much higher average body
mass than Adelie and Chinstrap.
• Adelie and Chinstrap have similar average body weights with only small
differences.

9
• The histogram shows most penguins have body mass between about 3,000 g and
5,000 g.
• The distribution is slightly right-skewed, with fewer penguins at very high body
mass values.

• The pie chart shows Adelie penguins form the largest share of the dataset,
followed by Gentoo and Chinstrap.
• Chinstrap penguins make up the smallest portion, with fewer observations than
the others.

10
LINEAR REGRESSION – ASSIGNMENT 4

1. Define linear regression and explain its purpose in predictive modeling.

Linear Regression is a statistical method used to understand how one variable affects another.
Basically, it helps us see how a dependent variable (like sales) changes when one or more
independent variables (like advertising spend) change.

The basic equation is:


Y = a + bX

In predictive modeling, linear regression is mainly used to:

● Forecast future outcomes


● Understand relationships between variables
● Help managers make smarter, data-driven decisions

2. Describe key concepts such as coefficients, intercept and residuals.

Coefficient: Tells us how much the dependent variable changes when the independent variable
increases by one unit. If it’s positive, Y increases. If it’s negative, Y decreases.

Intercept: The predicted value of Y when all independent variables are zero. Think of it as the
baseline.

Residual: The difference between the actual value and the predicted value. It shows how
accurate (or off) our model is.

3. Explain how linear regression can be applied in a management context, such as


predicting sales.

In management, regression is very useful for decision-making. For example, a company can use
it to predict sales based on how much they spend on TV, radio, and newspaper ads.

By understanding which channel has the strongest impact, managers can:

● Allocate budgets more effectively


● Reduce unnecessary spending
● Maximize return on investment

11
4. Impact of Advertising Channels on Sales

When analyzing advertising channels:

● TV advertising usually shows a strong positive relationship with sales. That means
higher TV spending often leads to higher sales.

● Radio advertising tends to have a moderate positive impact. It helps, but not as
strongly as TV.

● Newspaper advertising often shows a weak relationship with sales, meaning its
influence is relatively low.

To visualize these relationships, scatter plots are commonly used. They clearly show:

● The direction of the relationship (positive or negative)


● The strength of the association
● Any patterns or outliers

5. Use of Regression Line

A regression line represents the average relationship between independent and dependent
variables. The best fit line is determined using the Ordinary Least Squares (OLS) method, which
minimizes the sum of squared residuals.

12
13
ASSIGNMENT - 5

1. What is a Confidence Interval? What is its use?


A confidence interval is a range of values within which the true population parameter is
expected to lie with a certain level of confidence (usually 95%).

For example, a 95% confidence interval means we are 95% confident that the true value of the
parameter lies within that range.

Use:

● It measures the reliability of an estimate.


● It shows the precision of regression coefficients.
● It helps in decision-making by indicating uncertainty around predictions.
● If the confidence interval of a coefficient does not include zero, the variable is considered
statistically significant.

2. How does the p-value help in identifying feature selection (dropping


independent variables that are not impacting the model)?

The p-value helps determine whether an independent variable has a statistically significant
impact on the dependent variable.

● If p-value < 0.05, the variable is statistically significant and should be retained.
● If p-value > 0.05, the variable is not statistically significant and may be removed from the
model.

Thus, p-values assist in feature selection by helping eliminate variables that do not meaningfully
contribute to predicting the outcome.

3. What are the names by which R² is called? Why do we need it?

Other names of R²:

● Coefficient of Determination
● Goodness of Fit

14
Why we need it:
R² measures the proportion of variation in the dependent variable that is explained by the
independent variables.

For example, if R² = 0.80, it means 80% of the variation in the dependent variable is explained
by the model.

It is used to:

● Evaluate model performance


● Compare different regression models
● Understand how well the model fits the data

4. What are the ways in which we can select the independent variables that
have an impact on the model?

The independent variables can be selected using the following methods:

● Based on p-values (removing insignificant variables)


● Using Adjusted R² (selecting variables that improve model performance)
● Stepwise Regression (Forward Selection, Backward Elimination, or Both)
● Correlation analysis
● Domain knowledge and theoretical relevance
● Checking multicollinearity using VIF (Variance Inflation Factor)

These methods help in selecting meaningful predictors and improving model accuracy.

5. Why do we split the dataset into training and testing?

The dataset is split into training and testing sets to evaluate the model’s performance on unseen
data.

● The training set is used to build the model.


● The testing set is used to check how well the model performs on new data.

This helps to:

● Prevent overfitting
● Measure real-world predictive accuracy
● Ensure model generalization

15
6. Did you find any patterns or trends in the advertising dataset? If so,
please substantiate with relevant chart or plot.

Yes, clear patterns were observed in the advertising dataset:

● TV advertising shows a strong positive relationship with sales.


● Radio advertising shows a moderate positive relationship.
● Newspaper advertising shows a weak relationship with sales.

Scatter plots between advertising spend and sales demonstrate:

● A clear upward trend for TV and Radio.


● A scattered pattern with weak trend for Newspaper.

This indicates that TV advertising has the highest impact on sales, followed by Radio, while
Newspaper has minimal influence.

16
ASSIGNMENT 6

Name: Mohana Shree K


Reg No: 3122258001068

1. Why do we split the data into training and testing dataset? What happens if we
don’t split?
● We split data to evaluate how well the model performs on unseen data.
● Training data → used to train the model
● Testing data → used to check model performance

If we don’t split:

● The model will memorize the dataset


● It may give very high accuracy
● But it won’t perform well on new data
● This leads to overfitting

2. Why do we standardize the data? What function is used?


● Standardization makes features have mean = 0 and standard deviation = 1
● It helps models like Logistic Regression, KNN, SVM perform better
● It prevents features with large values from dominating

StandardScaler() is the function used for standardizing.

3. Calculate mean age for male and female passengers using groupby

(train_titanic.csv)
17
4. When train accuracy is greater than test accuracy, what is it called?
● It is called Overfitting

Because:

● Model performs very well on training data


● Performs poorly on unseen (test) data

• What is the purpose of pd.get_dummies()? If 3 unique values exist, how many columns
are created?

Purpose:

● Converts categorical variables into numerical variables


● Used for One-Hot Encoding
● 3 columns are created

18
ASSIGNMENT 7

Name: Mohana Shree K


Reg No: 3122258001068

1. What are the two types of Supervised Machine Learning?


● Regression
● Classification

Regression → predicts continuous values (price, salary)


Classification → predicts categories (yes/no, pass/fail)

2. What are the two types of Classification?


● Binary Classification → 2 classes (0 or 1)
● Multiclass Classification → More than 2 classes

Example:

● Survived / Not Survived → Binary


● Grade A / B / C → Multiclass

3. What is the equation of Logistic Regression?

Logistic Regression uses the Sigmoid function. Linear

equation:

z=b0+b1x1+b2x2+...+bnxn

Sigmoid function:

P(Y=1)=1/(1+e^-z)

It gives probability between 0 and 1.

19
4. What are the metrics of the classification model? Write a formula for each?

Given below are the metrics of the classification model

20
Accuracy= TP+TN/FP+FN+TP+TN
Precision= TP/FP+TP
Recall= TP/FN+TP
F1= 2×Precision×Recall/Precision+Recall
Specificity= TN/TN+FP

5. How do you calculate the threshold of a classification model? What graph is


used?
● Logistic regression outputs probability
● Default threshold = 0.5
● If probability > threshold → Class 1
● If probability < threshold → Class 0

To choose best threshold:

● Use ROC Curve


● Or Precision-Recall Curve

Graph used:

● ROC Curve (Receiver Operating Characteristic) It

plots:

● TPR (Recall) vs FPR

Best threshold is chosen where model performance is optimal (closest to top-left corner).

21
Assignment - 8

Name: Mohana Shree K


Reg No: 3122258001068
1) The sigmoid function is a mathematical function used in logistic regression to convert
any real-valued number into a probability between 0 and 1.

The formula for the sigmoid function is:

where

● e is the base of the natural logarithm.

The sigmoid function produces an S-shaped curve and maps outputs to the range 0 to 1,
which allows the result to be interpreted as a probability.

2) An odds ratio represents the ratio of the probability that an event occurs to the
probability that it does not occur.

where

● PPP = probability that the event occurs.

For example, if the probability of success is 0.8, the odds are:

0.8/0.2 = 4

This means the event is four times more likely to occur than not occur.

22
3) The logit function is the logarithm of the odds of an event occurring.

where

● PPP = probability of the event.

The logit function converts probabilities (which lie between 0 and 1) into values that
range from −∞ to +∞.

In logistic regression, the model assumes that the log of the odds is a linear
combination of the independent variables:

This transformation allows linear modeling techniques to be applied.

4) Although logistic regression is used for classification problems, it is called regression


because the model estimates the relationship between independent variables and the
log-odds of the dependent variable using a regression equation.

The model fits a linear regression equation to predict the logit (log-odds) of the
probability:

Thus, the regression part refers to the process of estimating coefficients that describe
the relationship between variables, even though the final output is used for
classification.

23
5) In a hospital there are 150 patients, out of which there are 40
cancer patients. Our Logistic Regression model is classifying 25
out of the 40 cancer patients correctly and 90 patients correctly as
non-cancer out of the remaining non-cancer 110 patients. Write
the formula and calculate accuracy, precision, recall, F1-score,
True Negative Rate, False Positive Rate for the above data

Actual cancer
patients = 40 Actual
non-cancer patients
= 110 True positive =
25
True
negative
= 90 False
positive =
20 False
negative
= 15

Accuracy = (𝑇𝑃+𝑇𝑁) / ( 𝑇𝑃+𝑇𝑁+𝐹𝑃+𝐹𝑁)


= (25+90) / (25+90+20+15)
= 115/150
= 23/30 = 76.67%

Precision = 𝑇𝑃 / (𝑇𝑃+𝐹𝑃) = 25 / (25+20)


= 25/45
= 5/9
= 55.55%

Recall = 𝑇𝑃 / (𝑇𝑃+𝐹𝑁)
= 25 / (25+15)
= 25/40
= 5/8
= 62.5%

24
F1 = (2∗𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛∗𝑅𝑒𝑐𝑎𝑙𝑙) / (𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛+𝑅𝑒𝑐𝑎𝑙𝑙)
= 58.82%

True Negative Rate = TN / (TN+FP)


= 90 / (90+20)
=0.818

False Positive Rate = FP / (FP+TN)

= 20 / (20+90)
= 0.182

25

You might also like