Trenuję wieloklasowy klasyfikator LDA z 8 klasami danych.
Podczas treningu otrzymuję ostrzeżenie: „ Zmienne są współliniowe ”
Dostaję dokładność szkolenia ponad 90% .
Korzystam z biblioteki scikits-learn w Pythonie do trenowania i testowania danych Multi-class.
Dostaję też przyzwoitą dokładność testowania (około 85% -95% ).
Nie rozumiem, co oznacza błąd / ostrzeżenie. Proszę pomóż mi.
Ponieważ wydaje mi się, że gui11aume dał ci świetną odpowiedź, chcę dać przykład z nieco innej perspektywy, która może być pouczająca. Weź pod uwagę, że zmienna towarzysząca funkcji dyskryminacyjnej wygląda następująco:
Załóżmy, że najlepsza LDA ma następującą granicę liniową:
lub
These two boundaries are identical but the first one has coefficients1,2,1,−2 for X1 , X2 , X3 , and X4 respectively, while the other has coefficients 0,7,3,−1 .
So the coefficient are quite different but the two equations give the same boundary and identical prediction rule. If one form is good the other is also. But now you can see why gui11ame says the coefficients are uninterpretable.
There are several other ways to express this boundary as well by substituting forX2 to give it the 0 coefficient and the same could be done for X3 or X4 . But in practice the collinearity is approximate. This makes things worse because the noise allows for a unique answer. Very slight perturbations of the data will cause the coefficients to change drastically. But for prediction you are okay because each equation defines almost the same boundary and so LDA will result in nearly identical predictions.
źródło
While the answer that was marked here is correct, I think you were looking for a different explanation to find out what happened in your code. I had the exact same issue running through a model.
Here's whats going on: You're training your model with the predicted variable as part of your data set. Here's an example of what was occurring to me without even noticing it:
In this code, I want to predict the value of 'COL3'... but, if you look at train_X, I'm telling it to retrieve every column except the last one, so its inputting COL1 COL2 and COL3, not COL4, and trying to predict COL3 which is part of train_X.
I corrected this by just moving the columns, manually moved COL3 in Excel to be the last column in my data set (now taking place of COL4), and then:
If you don't want to move it in Excel, and want to just do it by code then:
Note now how I declared train_X, to include all columns except COL3, which is part of train_Y.
I hope that helps.
źródło