Explain Resulting Components
At the very beginning, we touched on the topic of interpreting the results obtained. First of all, it is worth mentioning that there is no universal method, there is only the possibility of expert evaluation, which depends entirely on how well we know the data we are working with.
We have already mentioned the factor loading matrix. This matrix allows us to evaluate the contribution of each variable to the principal components. Formally, this means that each component is represented by a linear combination of initial variables Xn
and coefficients wn
:
Thus, the loadings - are the coefficients wn
of a linear combination of the initial variables from which the principal components are built.
We have already visualized the factor loading matrix, but now we will get acquainted with a more convenient option. With the help of the pca
library, we can easily create a visualization of loadings in 2D and 3D space:
3D plot:
We create the graphs obtained above using the following code:
from pca import pca
model = pca(n_components = 3)
results = model.fit_transform(X, row_labels = y)
fig, ax = model.plot()
# Scatter 2D model
fig, ax = model.scatter()
fig, ax = model.biplot(n_feat = 4)
# Scatter 3D model
fig, ax = model.scatter()
fig, ax = model.biplot3d()
If we want to specify labels for data classes, add an argument row_labels
with y
value for the function fit_transform()
.
Danke für Ihr Feedback!
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Fragen Sie mich Fragen zu diesem Thema
Zusammenfassen Sie dieses Kapitel
Zeige reale Beispiele
Awesome!
Completion rate improved to 5.26
Explain Resulting Components
Swipe um das Menü anzuzeigen
At the very beginning, we touched on the topic of interpreting the results obtained. First of all, it is worth mentioning that there is no universal method, there is only the possibility of expert evaluation, which depends entirely on how well we know the data we are working with.
We have already mentioned the factor loading matrix. This matrix allows us to evaluate the contribution of each variable to the principal components. Formally, this means that each component is represented by a linear combination of initial variables Xn
and coefficients wn
:
Thus, the loadings - are the coefficients wn
of a linear combination of the initial variables from which the principal components are built.
We have already visualized the factor loading matrix, but now we will get acquainted with a more convenient option. With the help of the pca
library, we can easily create a visualization of loadings in 2D and 3D space:
3D plot:
We create the graphs obtained above using the following code:
from pca import pca
model = pca(n_components = 3)
results = model.fit_transform(X, row_labels = y)
fig, ax = model.plot()
# Scatter 2D model
fig, ax = model.scatter()
fig, ax = model.biplot(n_feat = 4)
# Scatter 3D model
fig, ax = model.scatter()
fig, ax = model.biplot3d()
If we want to specify labels for data classes, add an argument row_labels
with y
value for the function fit_transform()
.
Danke für Ihr Feedback!