Artificial Intelligence and Embedded
System
Dr. Arijit Ukil
Principal Scientist, TCS Research
Arijit Ukil
AI Technologies
Types of Learning
Supervised: Learning with a labeled training set
Example: email classification with already labeled emails
Unsupervised: Discover patterns in unlabeled data
Example: cluster similar documents based on text
Reinforcement learning: learn to act based on feedback/reward
Example: learn to play Go, reward: win or lose
class A
class A
Classification Regression Clustering
Anomaly Detection
Sequence labeling [Link]
Arijit2 Ukil
Machine Learning Pipeline
• A Machine Learning Pipeline is a systematic workflow designed to
automate the process of building, training, and deploying of ML
models.
• It includes several steps, such as data collection, preprocessing,
feature engineering, model training, evaluation and deployment.
Source- [Link]
data-to-insightful-models-80c54914b7a9
Arijit3 Ukil
Machine Learning Pipeline
Step 1: Data Collection and Preprocessing
• Gather data from sources like databases, APIs, texts, images, or CSV
files.
• Clean the data by handling missing values, duplicates and errors.
• Normalize and standardize numerical values.
• Convert categorical variables into a machine readable format.
Step 2: Feature Engineering
• Select the most important features for better model performance.
• Create new features for feature extraction or transformation.
Step 3: Data splitting
• Divide the dataset into training, validation and testing sets.
• When dealing with imbalanced datasets, use random sampling.
Source- [Link]
Arijit4 Ukil
Machine Learning Pipeline
Step 4: Model Selection & Training
• Choose the best algorithm based on the problem includes
classification, regression, Clustering etc.
• Train the model using the training dataset.
Step 5: Model evaluation & Optimization
• Test the model's performance using accuracy, precision, recall and
other metrics.
• Tune hyperparameters using Grid Search or Random Search and
avoiding overfitting using techniques like cross- validation.
Source- [Link]
Arijit5 Ukil
Machine Learning Pipeline
Step 6: Model Deployment
• Deploy the trained model using Pytorch, TensorFlow and cloud
services.
• Save the trained model for real-world applications.
Step 7: Continuous learning & Monitoring
• Update the model with new data to maintain accuracy.
• Model finetuning with newer training/ adaptation data.
Source- [Link]
Arijit6 Ukil
Feature Engineering
• Feature engineering is the process of turning raw data into useful
features that help improve the performance of machine learning
models.
• It is the process of extracting useful insights from the input raw data
Source- [Link]
Arijit7 Ukil
Feature Engineering
Source- [Link]
Arijit8 Ukil
Feature Engineering
1. Feature Creation: Feature creation involves generating new features from
domain knowledge or by observing patterns in the data. It can be:
• Domain-specific: Created based on industry knowledge like business
rules.
• Data-driven: Derived by recognizing patterns in data.
• Synthetic: Formed by combining existing features.
2. Feature Transformation: Transformation adjusts features to improve model
learning:
• Normalization & Scaling: Adjust the range of features for consistency.
• Encoding: Converts categorical data to numerical form i.e one-hot
encoding.
• Mathematical transformations: Like logarithmic transformations for
skewed data. Source- [Link]
Arijit9 Ukil
Feature Engineering
3. Feature Extraction: Extracting meaningful features can reduce
dimensionality and improve model accuracy:
• Dimensionality reduction: Techniques like PCA reduce features while
preserving important information.
• Aggregation & Combination: Summing or averaging features to simplify
the model.
4. Feature Selection: Feature selection involves choosing a subset of relevant
features to use:
• Filter methods: Based on statistical measures like correlation.
• Wrapper methods: Select based on model performance.
• Embedded methods: Feature selection integrated within model training.
Source- [Link]
Arijit10 Ukil
Feature Engineering
5. Feature Scaling: Scaling ensures that all features contribute equally to the
model:
• Min-Max scaling: Rescales values to a fixed range like 0 to 1.
• Standard scaling: Normalizes to have a mean of 0 and variance of 1.
• Z-scaling:
Source- [Link]
Arijit11 Ukil
Feature Selection
1. Filter methods
These methods evaluate the relevance of features based on statistical measures,
independent of any machine learning algorithm. They are computationally fast
and are often used as a preprocessing step.
• Pearson's Correlation: Measures the linear relationship between continuous
features and the target variable.
• Chi-squared test: Checks for a relationship between categorical features and
the target variable.
• Information Gain: Measures the reduction in entropy (uncertainty) provided
by a feature.
• Variance Threshold: Removes features with a variance below a certain
threshold, assuming they have low predictive power.
Source- [Link]
Arijit12 Ukil
Feature Selection
2. Wrapper methods
These methods use a specific machine learning model to evaluate different
subsets of features. They are more computationally intensive than filter methods
but often result in a better-performing feature set.
• Forward Selection: Starts with an empty feature set and iteratively adds the
feature that provides the most model improvement.
• Backward Elimination: Starts with all features and iteratively removes the
least significant feature.
• Recursive Feature Elimination (RFE): A greedy algorithm that repeatedly
builds a model, ranks features by importance, and removes the least
important ones.
Source- [Link]
Arijit13 Ukil
Feature Selection
3. Embedded methods
This approach combines the best aspects of filter and wrapper methods by
performing feature selection during the model training process. The algorithm
itself learns which features are most important.
• LASSO Regression (L1 regularization): Adds a penalty to the loss function
that can shrink the coefficients of less important features to zero, effectively
removing them.
• Ridge Regression (L2 regularization): Penalizes large coefficients but does not
eliminate features, keeping all variables with reduced influence.
• Tree-based methods: Algorithms like Random Forest and Gradient Boosting
can provide a feature importance score, indicating the contribution of each
feature to the model's predictive power.
Source- [Link]
Arijit14 Ukil
Model Evaluation
• Model evaluation is a process that uses some metrics which help us to analyze
the performance of the model. Think of training a model like teaching a
student.
• Model evaluation is like giving them a test to see if they truly learned the
subject—or just memorized answers.
• Cross-validation is a machine learning technique to assess how well a model
will perform on unseen data by dividing a dataset into training and testing sets
multiple times.
• Instead of a single train-test split, the data is repeatedly partitioned, with
each part serving as a test set for a model trained on the remaining data.
• This iterative process generates an average performance score, providing a
more robust and reliable estimate of the model's ability to generalize,
which helps prevent.
Source- [Link]
Arijit15 Ukil
Model Evaluation- Cross validation
K-Fold Cross Validation
• In K-Fold Cross Validation we split the dataset into k number of subsets
known as folds then we perform training on the all the subsets but leave
one (k-1) subset for the evaluation of the trained model.
• In this method, we iterate k times with a different subset reserved for
testing purpose each time.
Example of K=5 Fold Cross Validation
The diagram below shows an example of the training subsets and evaluation
subsets generated in k-fold cross-validation. Here we have total 25 instances. In
first iteration we use the first 20 percent of data for evaluation and the remaining
80 percent for training.
Source- [Link]
Arijit16 Ukil
Model Evaluation- Cross validation
Source- [Link]
Arijit17 Ukil
Model Evaluation- Cross validation
Stratified Cross-Validation
• It is a technique used in machine learning to ensure that each fold of the
cross-validation process maintains the same class distribution as the entire
dataset.
• This is particularly important when dealing with imbalanced datasets
where certain classes may be under represented.
• In this method:
• The dataset is divided into k folds while maintaining the proportion
of classes in each fold.
• During each iteration, one-fold is used for testing and the remaining
folds are used for training.
• The process is repeated k times with each fold serving as the test set
exactly once.
Stratified Cross-Validation is essential when dealing with classification
problems where maintaining the balance of class distribution is crucial
for the model to generalize well to unseen data.
Source- [Link]
Arijit18 Ukil
Model Evaluation- Confusion Matrix
• Confusion matrix is a simple table used to measure how well a classification
model is performing. It compares the predictions made by the model with the
actual results and shows where the model was right or wrong.
• This helps to understand the performance of the model.
• It breaks down the predictions into four categories:
• True Positive (TP): The model correctly predicted a positive
outcome i.e the actual outcome was positive.
• True Negative (TN): The model correctly predicted a negative
outcome i.e the actual outcome was negative.
• False Positive (FP): The model incorrectly predicted a positive
outcome i.e the actual outcome was negative. It is also known as a
Type I error.
• False Negative (FN): The model incorrectly predicted a negative
outcome i.e the actual outcome was positive. It is also known as a
Type II error.
Source- [Link]
Arijit19 Ukil
Model Evaluation- Confusion Matrix
Source- [Link]
Arijit20 Ukil
Model Evaluation- Confusion Matrix
Source- [Link]
Arijit21 Ukil
Model Evaluation- Confusion Matrix
• F1 score- harmonic mean of sensitivity and precision.
• F1-score is a better measure than accuracy in class-imbalance condition.
Source- [Link]
Arijit22 Ukil
Model Evaluation- Confusion Matrix
Source- [Link]
Arijit23 Ukil
Model Evaluation- Confusion Matrix
• Accuracy: Overall, how often is the classifier correct?
(TP+TN)/total = (100+50)/165 = 0.91
• Misclassification Rate: Overall, how often is it wrong?
(FP+FN)/total = (10+5)/165 = 0.09
equivalent to 1 minus Accuracy-> also known as "Error Rate"
• True Positive Rate: When it's actually yes, how often does it predict
yes?
TP/actual yes = 100/105 = 0.95
also known as "Sensitivity" or "Recall"
• False Positive Rate: When it's actually no, how often does it predict
yes?
FP/actual no = 10/60 = 0.17 Source- [Link]
Arijit24 Ukil
Model Evaluation- Confusion Matrix
• True Negative Rate: When it's actually no, how often does it predict
no?
• TN/actual no = 50/60 = 0.83
equivalent to 1 minus False Positive Rate-> also known as
“Specificity”
• Precision: When it predicts yes, how often is it correct?
TP/predicted yes = 100/110 = 0.91
• Prevalence: How often does the yes condition actually occur in our
sample?
actual yes/total = 105/165 = 0.64
Compute F1-score
Source- [Link]
Arijit25 Ukil
Supervised Learning
Source-
[Link]
ne-learning/machine-learning/
Arijit26 Ukil
Supervised Learning
Source- Source- CIS 419/519, E.
Eaton
Arijit27 Ukil
Supervised Learning
Source- Source- CIS 419/519, E.
Eaton
Arijit28 Ukil
Supervised Learning
Source- Source- CIS 419/519, E.
Eaton
Arijit29 Ukil
Supervised Learning
Source- Source- CIS 419/519, E.
Eaton
Arijit30 Ukil
Unsupervised Learning
Source-
[Link]
ne-learning/machine-learning/
Arijit31 Ukil
Reinforcement Learning
Reinforcement learning interacts with environment and learn from them based
on rewards.
Source-
[Link]
ne-learning/machine-learning/
Arijit32 Ukil
Other Types of Learning
Self-Supervised Learning: Self-supervised learning is often
considered a subset of unsupervised learning, but it has grown
into its own field due to its success in training large-scale models.
It generates its own labels from the data, without any manual
labeling.
Semi-Supervised Learning: This approach combines a small
amount of labeled data with a large amount of unlabeled data. It’s
useful when labeling data is expensive or time-consuming.
Source-
[Link]
ne-learning/machine-learning/
Arijit33 Ukil
Thank You
Arijit34 Ukil
Q&A
Arijit35 Ukil