예제 #1
0
# That's it, the PCA model has been computed. Now we would like to inspect the results by visualising them. We can do this using the taylor-made plotting function for PCA from the separate [**hoggormPlot** package](https://hoggormplot.readthedocs.io/en/latest/). If we wish to plot the results for component 1 and component 2, we can do this by setting the input argument ``comp=[1, 2]``. The input argument ``plots=[1, 6]`` lets the user define which plots are to be plotted. If this list for example contains value ``1``, the function will generate the scores plot for the model. If the list contains value ``6``, the function will generate a explained variance plot. The hoggormPlot documentation provides a [description of input paramters](https://hoggormplot.readthedocs.io/en/latest/mainPlot.html).

# In[15]:


hop.plot(model, comp=[1, 2], 
         plots=[1, 6])


# It is also possible to generate the same plots one by one with specific plot functions as shown below.

# In[19]:


hop.loadings(model, line=True)


# ---

# ### Accessing numerical results

# Now that we have visualised the PCA results, we may also want to access the numerical results. Below are some examples. For a complete list of accessible results, please see this part of the documentation.  

# In[21]:


# Get scores and store in numpy array
scores = model.X_scores()

# Get scores and store in pandas dataframe with row and column names
예제 #2
0
# Plot cumulative validated explained variance in X.
hop.explainedVariance(model, which=['X'])

# In[10]:

hop.scores(model)

# In[11]:

hop.correlationLoadings(model)

# In[12]:

# Plot X loadings in line plot
hop.loadings(model, weights=False, line=True)

# In[13]:

# Plot regression coefficients
hop.coefficients(model, comp=[3])

# ---

# ### Accessing numerical results

# Now that we have visualised the PCR results, we may also want to access the numerical results. Below are some examples. For a complete list of accessible results, please see this part of the documentation.

# In[14]:

# Get X scores and store in numpy array

hop.scores(model)


# In[11]:


hop.correlationLoadings(model)


# In[12]:


# Plot X loadings in line plot
hop.loadings(model, weights=True, line=True)


# In[13]:


# Plot regression coefficients
hop.coefficients(model, comp=3)


# ---

# ### Accessing numerical results

# Now that we have visualised the PLSR results, we may also want to access the numerical results. Below are some examples. For a complete list of accessible results, please see this part of the documentation.