MY CART (5)

Use Coupon: CART20 and get 20% off on all online Study Material

ITEM
DETAILS
MRP
DISCOUNT
FINAL PRICE
Total Price: R

There are no items in this cart.
Continue Shopping
Menu
Get instant 20% OFF on Online Material.
coupon code: MOB20 | View Course list

Get extra R 400 off
USE CODE: MOB20

				   

function of LDA with support of an example

6 years ago

Share

Answers : (1)

										Linear Discriminant Analysis (LDA)

The basic idea of LDA is simple: for each class to be identified, calculate a (different) linear function of the attributes. The class function yielding the highest score represents the predicted class.

There are many linear classification models, and they differ largely in how the coefficients are established. One nice quality of LDA is that, unlike some of the alternatives, it does not require multiple passes over the data for optimization. Also, it naturally handles problems with more than two classes and it can provide probability estimates for each of the candidate classes.

Some analysts attempt to interpret the signs and magnitudes of the coefficients of the linear scores, but this can be tricky, especially when the number of classes is greater than 2.

LDA bears some resemblance to principal components analysis (PCA), in that a number of linear functions are produced (using all raw variables), which are intended, in some sense, to provide data reduction through rearrangement of information. (See the Feb-26-2010 posting to this log,Principal Components Analysis.) Note, though, some important differences: First, the objective of LDA is to maximize class discrimination, whereas the objective of PCA is to squeeze variance into as few components as possible. Second, LDA produces exactly as many linear functions as there are classes, whereas PCA produces as many linear functions as there are original variables. Last, principal components are always orthogonal to each other ("uncorrelated"), while that is not generally true for LDA's linear scores.

Note that theLDAfunction assumes that the data its being fed is complete (no missing values) and performs no attribute selection.

Use ofLDAis straightforward: the programmer supplies the input and target variables and, optionally, prior probabilities. The function returns the fitted linear discriminant coefficients. a good example:


% Generate example data: 2 groups, of 10 and 15, respectively
X = [randn(10,2); randn(15,2) + 1.5]; Y = [zeros(10,1); ones(15,1)];

% Calculate linear discriminant coefficients
W = LDA(X,Y);

This example randomly generates an artificial data set of two classes (labeled 0 and 1) and two input variables. The LDA function fits linear discriminants to the data, and stores the result inW. So, what is inW?take a look:


>> W

W =

-1.1997 0.2182 0.6110
-2.0697 0.4660 1.4718

The first row contains the coefficients for the linear score associated with the first class (this routine orders the linear functions the same way asunique()). In this model, -1.1997 is the constant and 0.2182 and 0.6110 are the coefficients for the input variables for the first class (class 0). Coefficients for the second class's linear function are in the second row. Calculating the linear scores is easy:


% Calulcate linear scores for training data
L = [ones(25,1) X] * W';

Each column represents the output of the linear score for one class. In this case, the first column is class 0, and the second column is class 1. For any given observation, the higher the linear score, the more likely that class. Note that LDA's linear scores are not probabilities, and may even assume negative values. Here are the values from my run:


>> L

L =

-1.9072 -3.8060
1.0547 3.2517
-1.2493 -2.0547
-1.0502 -1.7608
-0.6935 -0.8692
-1.6103 -2.9808
-1.3702 -2.4545
-0.2148 0.2825
0.4419 1.6717
0.2704 1.3067
1.0694 3.2670
-0.0207 0.7529
-0.2608 0.0601
1.2369 3.6135
-0.8951 -1.4542
0.2073 1.1687
0.0551 0.8204
0.1729 1.1654
0.2993 1.4344
-0.6562 -0.8028
0.2195 1.2068
-0.3070 0.0598
0.1944 1.2628
0.5354 2.0689
0.0795 1.0976

To obtain estimated probabilities, simply run the linear scores through the softmax transform (exponentiate everything, and normalize so that they sum to 1.0):


% Calculate class probabilities
P = exp(L) ./ repmat(sum(exp(L),2),[1 2]);

As we see, most of the first 10 cases exhibit higher probabilities for class 0 (the first column) than for class 1 (the second column) and the reverse is true for the last 15 cases:


>> P

P =

0.8697 0.1303
0.1000 0.9000
0.6911 0.3089
0.6705 0.3295
0.5438 0.4562
0.7975 0.2025
0.7473 0.2527
0.3782 0.6218
0.2262 0.7738
0.2619 0.7381
0.1000 0.9000
0.3157 0.6843
0.4205 0.5795
0.0850 0.9150
0.6363 0.3637
0.2766 0.7234
0.3175 0.6825
0.2704 0.7296
0.2432 0.7568
0.5366 0.4634
0.2714 0.7286
0.4093 0.5907
0.2557 0.7443
0.1775 0.8225
0.2654 0.7346

This model is not perfect, and would really need to be tested more rigorously (via holdout testing, k-fold cross validation, etc.) to determine how well it approximates the data.

will not demonstrate its use here, but theLDAroutine offers a facility for modifying the prior probabilities. Briefly, the function assumes that the true distribution of classes is whatever it observes in the training data. Analysts, however, may wish to adjust this distribution for several reasons, and the third, optional, parameter allows this. Note that the LDA routine presented here always performs the adjustment for prior probabilities: Some statistical software drops the adjustment for prior probabilities altogether if the user specifies that classes are equally likely, and will produce different results thanLDA.
one year ago

Post Your Answer

Other Related Questions on Organic Chemistry

Hi pl tell the best book for organic chemistry for iit preparation of jee mains and jee advanced......its urgent....
 
 
HEY ARYAN YOU CAN REFER TO OP TANDN ORGANIC CHEMISTRY. The latest trends of different competitive examinations have been integrated with the fundamental concepts in the book. Some of the...
 
SAHIL 29 days ago
 
HEY DEAR OK NO PROBLEM YOU CAN REFER LG WADE BOOK ALSO INSTEAD OF OP TANDON. ACTUALLY IF YOU READ LG WADE AND SOLOMONS, YOU WILL COME TO UNDERSTAND THAT IT IS BETTER TO READ FROM LG WADE....
 
SAHIL 28 days ago
 
SORRY DEAR WE CANNOT POST EXTERNAL LINKS AT THIS SITE. MOREOVER THE BOOK IS NOT WITH ME IN ANY FORMAT. OTHERWISE THE BOOK IS GOOD FOR GOC. ALL THE THINGS ARE WELL EXPLAINED. IT WILL SURELY...
 
SAHIL 28 days ago
Cannizaro reaction is not given by Chloral HCHO 2-methylpropanal p-methoxybenzaldehydeThe answers are 1,2I have doubt in 3,4. Generally aldehydes without alphe hydrogen give cannizaro...
 
 
Here all the 4 compounds (HCHO, chloral,2 methyl propanal nd p-methoxybenzaldehyde will give cannizzaro reaction. In 2 methyl propansl,though alpha hydrogen is absent it will give cannizzaro...
 
2017 years ago
 
chloral would not undergo cannizaro rxn., it will give haloform rxn which is similar to Cannizaro reaction but not Cannizaro. When acetaldehyde is treated withCl 2 /NaOH for Haloform rxn....
 
2 days ago
What are biodegradable and non-biodegradable detergents?
 
 
Biodegradable detergents: Cleansing agents or detergents which are decomposed by microbes are called biodegradable detergents. Their molecules have less branching. Non-biodegradable...
 
SAI SARDAR 6 months ago
 
1. Biodegradable Detergents are those detergents which can be degraded or decomposed by microorganisms present in water.such detergents have straight chain of hydrocarbons in the...
 
somprasad 6 months ago
 
1.Biodegradable dete rgents :Detergents having straight hydrocarbon chains are easily degraded(decomposed) by microorganisms .e.g.sodium lauryl sulphate. 2.Non-biodegradable detergents...
 
xavier 6 months ago
the hybridization of phosphorus in PCl 5 (in solid state ) is 1)sp 3 2)sp 3 d 2 3)sp 3 d 4)both 1 and 2
 
 
sp3d is the right answer. In excited state, intermixing of a 3s, three 3p and one 3d orbitals gives five half filled sp 3 d hybrid orbitals, which are arranged in trigonal bipyramidal...
 
dolly bhatia one month ago
 
@ krishna option no 3 turns out to be the correct option , here , the orbitals are filled by electrons of five cl atom . there are 5 p-cl sigma bond , three in one plane and make an angle of...
 
Umakant biswal 3 months ago
 
i hope to no.3 because phosphours atom contain in last subshell is 5 electron and not contain a lone pair and here is 5 chlorine atom .then we add up eletron and we get a 10 and we devided...
 
sahabudin ali 2 months ago
 
It should be option 4 as PCl5 exists in [PCl4]+ and [PCl6]- in solid state....as in first case it is Sp3 and that in second it is Sp3d2
 
4 days ago
sir iam a iiit students in RAGIV GANDHI UNIVERSITY OF TECHNOLOGIES, there is a semister it infront of me in 10 days.i don’t know any thing about chemistry.it is a ncert syllubus.please send...
 
 
@ badugu they are ncert books topic , i am mentioning some imp chapter name below 1- COORDINATION COMPOUND ( PART 2 CHEMI ) 2- GENERAL PRINCIPLES OF ORGANIC CHEMISTRY ( 11TH 2ND PART ) 3-...
 
Umakant biswal one month ago
 
Dear Vijay, Go through these topics first as atmost importat ones: Aldehyde and Ketones Biomolecules Alcohols and ethers Coordination Compounds Solid states Electrrochemistry Solutions D and...
 
Vikas TU one month ago
 
@ badugu , kindly be specific in asking the ques , earlier u told that u have ncert syllabus , and i have given the chapters from ncert textbooks only . kindly conform which publication u...
 
Umakant biswal one month ago
How many unpaired electrons are present in superoxide ion?
 
 
But the answer is 3.. As in molecular orbital theory the unpaired electrons in oxygen molecule is 2.. It accepts 1 electron to form superoxide ion.. That electron instead of pairing with 2...
 
Suraj Singh 16 days ago
 
And now I am agree with my solution.. You should check it once.... .. And thanq for the concern... .....
 
Suraj Singh 16 days ago
 
It`s unfortunately wrong..................................... ................. NOť less than 100 char
 
Suraj Singh 17 days ago
View all Questions »

  • Complete JEE Main/Advanced Course and Test Series
  • OFFERED PRICE: R 15,000
  • View Details
Get extra R 3,000 off
USE CODE: MOB20

Get extra R 400 off
USE CODE: MOB20

More Questions On Organic Chemistry

Ask Experts

Have any Question? Ask Experts

Post Question

 
 
Answer ‘n’ Earn
Attractive Gift
Vouchers
To Win!!!
Click Here for details