web analytics

Steps of Discriminant Analysis in python

This Tutorial will Explain you that how data can be analyze using Discriminant  analysis with the help of Python coding.

Data Science is very growing field  in current technology. because  it is helpful to expand business , future prediction , business analysis , Machine Learning ,etc..

At infovium web scraping services we are providing best data analytics services..


  • Discriminant Analysis ( DA ) is one type of Machine Learning Algorithm to Analyzing   and  prediction of Data.
  • This algorithm is used t Discriminate between two or multiple groups .

Types of Discriminant Algorithm

  • When there is dependent variable has two group or two categories then it is known as Two-group discriminant analysis.
  • When there is dependent variable has more then two group or  categories then it is known as Multiple  discriminant analysis.

Similarity and Difference between Anova , Regression and Discriminant Analysis



Similarity:- No of Dependent Variable single single single
Similarity:- No of Dependent Variable Multiple Multiple Multiple
Difference:- Nature of Dependent Variable Continuous Continuous Categorical
Difference:- Nature of Independent Variable Categorical Continuous Continuous

Objectives of Discriminant analysis

  • Development of discriminant functions, or linear combinations of the predictor or independent variables, which will best discriminate between the categories of the criterion or dependent variable (groups).
  • Examination of whether significant differences exist among the groups, in terms of the predictor variables.
  • Determination of which predictor variables contribute to most of the inter group differences.

DA Model

The discriminant analysis model involves linear combinations of the following form:

D = b0 + b1X1 + b2X2 + b3X3 + . . . + bkXk


D  =  discriminant score

b ‘s  =  discriminant coefficient or weight

X ‘s  =  predictor or independent variable

Deciding factor  Wilksλ

Wilksλ :-  Sometimes also called the U statistic, Wilks’ λ for each predictor is the ratio of the within-group sum of squares to the total sum of squares.  Its value varies between 0 and 1.  Large values of     (near 1) indicate that group means do not seem to be different.  Small values of     (near 0) indicate that the group means seem to be different.

Basic Python code Step for DA

import pandas as pd

import numpy as np

from sklearn.discriminant_analysis import LinearDiscriminantAnalysis

  • Import Above Three packages for Dataset and discriminant analysis algorithm loading.
  • Load the dataset in which you want to perform DA.
  • Descide Dependent and Independent Variable
  • Take Dependent variable on y and Independent on X.





Thus you will get Accuracy Score  for Prediction accuracy.

ppt for discriminant analysis 

Leave a Reply

Your email address will not be published. Required fields are marked *