0% found this document useful (0 votes)
7 views11 pages

Perfect ?

The document outlines key concepts in data manipulation using NumPy and Pandas, highlighting their APIs and roles in Machine Learning. It also discusses Python's features, built-in data types, types of learning, and performance measures in linear regression, emphasizing their importance in ML. Additionally, it addresses overfitting, underfitting, and the bias-variance trade-off, providing a comprehensive overview of essential topics for ML exam preparation.

Uploaded by

Shrinidhi Achar
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)
7 views11 pages

Perfect ?

The document outlines key concepts in data manipulation using NumPy and Pandas, highlighting their APIs and roles in Machine Learning. It also discusses Python's features, built-in data types, types of learning, and performance measures in linear regression, emphasizing their importance in ML. Additionally, it addresses overfitting, underfitting, and the bias-variance trade-off, providing a comprehensive overview of essential topics for ML exam preparation.

Uploaded by

Shrinidhi Achar
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

Perfect

Now I’ll upgrade the THEORY answers to full 12-mark exam format
more points
structured headings
simple language
extra lines for writing in answer sheet
based on your notes + standard ML text

NumPy & Pandas APIs for Data Manipulation (12 Marks)

Introduction

• NumPy and Pandas are core Python libraries used for data preprocessing and numerical
computation in Machine Learning.

• They help in efficient storage, manipulation, and analysis of large datasets.

NumPy – Important APIs

1. Array creation

• [Link]()

• [Link]()

• [Link]()

• [Link]()

• [Link]()

Used for creating numerical datasets.

2. Array operations

• reshape()

• flatten()

• transpose()

Used in feature engineering.

3. Mathematical functions

• [Link]()

• [Link]()

• [Link]()

• [Link]()

• [Link](), [Link]()
Used for statistical analysis.

4. Linear algebra functions

• [Link]()

• [Link]()

• [Link]()

Used in ML algorithms like Linear Regression.

5. Indexing & slicing

• Fast and memory efficient

• Used for dataset splitting

Advantages of NumPy

• Faster than Python lists

• Less memory usage

• Supports vectorization

• Used in deep learning libraries

Pandas – Important APIs

1. Data structures

• Series() → 1D data

• DataFrame() → 2D data

2. Reading data

• read_csv()

• read_excel()

• read_json()

3. Data inspection

• head()

• tail()

• info()

• describe()

4. Data selection

• loc[]
• iloc[]

5. Handling missing values

• dropna()

• fillna()

6. Grouping & aggregation

• groupby()

• value_counts()

Role in Machine Learning

• Data cleaning

• Feature extraction

• Handling categorical data

• Normalization & scaling

Data preprocessing is the first step in ML pipeline.

Conclusion

NumPy and Pandas provide high-performance data manipulation tools, making them essential for
ML model development.

Key Features of Python (12 Marks)

Introduction

Python is a high-level, interpreted, general-purpose programming language widely used in ML and


AI.

Features

1. Simple and readable syntax

• Easy to learn

• English-like commands

2. Interpreted language

• No compilation required

• Faster debugging
3. Dynamically typed

• No need to declare data types

4. Platform independent

• Runs on Windows, Linux, Mac

5. Object-oriented

• Supports classes and objects

6. Large standard library

• NumPy

• Pandas

• Matplotlib

• Scikit-learn

• TensorFlow

7. Extensible

• Can be integrated with C/C++

8. Portable

• Same code runs on multiple platforms

9. Open source

• Free to use

10. GUI support

• Tkinter, PyQt

Why Python for ML?

• Less code

• Large community

• Rich libraries

• Rapid prototyping

Conclusion

Because of its simplicity and powerful libraries, Python is the most preferred language for Machine
Learning.
Pandas DataFrame (12 Marks)

Definition

A DataFrame is a two-dimensional labeled data structure with rows and columns.

Characteristics

• Heterogeneous data

• Mutable size

• Labeled axes

• Indexing support

Creation of DataFrame

From list

[Link]([[1,'A'],[2,'B']], columns=['ID','Name'])

From dictionary

[Link]({'ID':[1,2],'Name':['A','B']})

From NumPy array

[Link]([Link]([[1,2],[3,4]]))

Operations on DataFrame

• Column selection

• Row selection

• Adding new column

• Deleting column

• Sorting

• Filtering

Applications in ML

• Data cleaning

• Handling missing values

• Data transformation

• Feature selection
Advantages

• Fast

• Flexible

• Easy handling of large datasets

Conclusion

DataFrame is the most important data structure in data analysis and ML preprocessing.

NumPy vs SciPy (12 Marks)

NumPy

• Basic numerical operations

• N-dimensional array

• Broadcasting

• Linear algebra

• Random number generation

SciPy

• Built on NumPy

• Advanced scientific computing

• Optimization

• Integration

• Signal processing

• Statistics

Difference

NumPy SciPy

Basic array operations Advanced algorithms

Faster array processing Scientific functions

Matrix operations Optimization & FFT


Similarity

• Both used in ML

• Both support numerical computation

Conclusion

NumPy is used for array handling, SciPy for advanced scientific tasks.

Built-in Data Types in Python (12 Marks)

Numeric

• int

• float

• complex

Sequence

• list

• tuple

• range

• string

Set type

• set

• frozenset

Mapping

• dictionary

Boolean

• True / False

Mutable vs Immutable

Mutable

• list

• set

• dictionary
Immutable

• int

• float

• tuple

• string

Importance in ML

• Lists → store datasets

• Dictionaries → store parameters

• Tuples → fixed data

Types of Learning in Machine Learning (12 Marks)

1. Supervised Learning

• Labeled data

• Prediction task

• Algorithms:

o Linear Regression

o Logistic Regression

o SVM

o KNN

Applications

• Spam detection

• House price prediction

2. Unsupervised Learning

• No labels

• Finds hidden patterns

Algorithms

• K-means

• Hierarchical clustering

• PCA
Applications

• Customer segmentation

• Market basket analysis

3. Semi-supervised learning

• Small labeled data + large unlabeled data

4. Reinforcement learning

• Learning using reward & penalty

• Agent and environment

Applications

• Robotics

• Game playing

Conclusion

Different learning types are used based on nature of the problem and availability of data.

Overfitting, Underfitting & Bias-Variance (12 Marks)

Overfitting

• Model learns noise

• High variance

• Low training error

• High testing error

Prevention

• Cross validation

• Regularization

• More data

Underfitting

• Model too simple

• High bias
• Poor performance on both datasets

Bias-Variance Trade-off

Bias

• Error due to wrong assumptions

Variance

• Error due to sensitivity to training data

Ideal model

• Low bias

• Low variance

Diagram explanation (write in exam)

• X-axis → model complexity

• Y-axis → error

Conclusion

A good ML model maintains balance between bias and variance.

Performance Measures in Linear Regression (12 Marks)

MAE

Average absolute difference between actual & predicted.

MSE

Squares the error → penalizes large errors.

RMSE

Square root of MSE → interpretable in same unit.

R² Score

• Measures goodness of fit

• Value between 0 and 1

• Higher → better model

Adjusted R²
• Used for multiple regression

Importance

• Model comparison

• Accuracy measurement

• Error minimization

If you want FULL SCORING FORMAT

Next I can give:

• Exact how many pages to write per answer

• What to underline

• Where to draw diagrams

• How to start & end answers for maximum marks

Just say: “give me exam-writing format” and I’ll convert this into answer-sheet style.

You might also like