You are on page 1of 13

Machine Learning for Chemical Engineers

CHE F315

Ajaya Kumar Pani


BITS Pilani Department of Chemical Engineering
B.I.T.S-Pilani, Pilani Campus
Pilani Campus
Lecture-8
31-01-2024
BITS Pilani
Pilani Campus
Data Preprocessing
BITS Pilani
Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

Recap

Feature extraction
Principal component analysis
Applications
Procedure
Algorithm
Examples

3 February 2024 4
BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

Linear discriminant analysis


(LDA)
A supervised feature extraction approach
Linear transformation that maximize the separation between
multiple classes.
A technique used to find a linear combination of features that best
separates the classes in a dataset.
If samples are from k different classes, LDA generates a k-1
dimensional space to represent the data, such that in this space
the samples from different classes are well separable.
To reduce the dimensions of a m-dimensional data set by
projecting it onto a (p)-dimensional subspace (where m < d) that
maximizes separation between classes

3 February 2024 5
BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

Linear discriminant analysis


(LDA)
2-class LDA – Fisher’s
LDA
Multiclass LDA
The binary classification
task projects data onto a
line

3 February 2024 6
BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

Procedure

• Compute the m-dimensional mean vectors for the different classes.


• Compute the scatter matrices (in-between-class and within-class
scatter matrices)
• Compute the eigenvectors and corresponding eigenvalues for the
scatter matrices.
• Sort the eigen vectors in decreasing eigenvalues and choose those
with the largest eigenvalues to form a m×k dimensional matrix
• Transform the samples onto the new subspace using this eigen
vector matrix.

3 February 2024 7
BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

Example

3 February 2024 8
BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

Tharwat, A., Gaber, T., Ibrahim, A., & Hassanien, A. E.


(2017). Linear discriminant analysis: A detailed
tutorial. AI communications, 30(2), 169-190.
3 February 2024 9
BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

Chemical Engg Application

Choi, S. W., Park, J. H., & Lee, I. B. (2004). Process monitoring using a
Gaussian mixture model via principal component analysis and discriminant
analysis. Computers & chemical engineering, 28(8), 1377-1387.
3 February 2024 10
BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

3 February 2024
11 BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

maha = diag(X*inv(covariance)*X'); % Calculation of


Mahalanobis distance
outliermd = zeros(size(maha,1),1);
j = 1;
for i = 1:m
if maha(i)> 25.188
outliermd(j,1) = i;
j = j+1;
end
end

3 February 2024 12
BITS Pilani, Pilani Campus
CHE F315 Machine Learning for Chemical Engineers

outliermd(j:size(maha)) = [];
Xcorrect = input1;
Xcorrect(outliermd,:) = []; % Corrected input matrix after the
deletion of the rows detected as outliers
ycorrect = output1;
ycorrect(outliermd,:) = [];
subplot(1,3,1);
plot(1:400,25.188,1:400,maha);

3 February 2024 13
BITS Pilani, Pilani Campus

You might also like