componentAnalysis.pca: componentAnalysis.pca

Description Format Details Active bindings Methods Author(s) Examples

Description

Performs a pca anlysis on a given dataset. The explained variance ratio is calculated and used to indicate the optimal number of components for a pca.

Format

[R6::R6Class] object.

Details

Performs a pca anlysis on a given dataset. The explained variance ratio is calculated and used to indicate the optimal number of components for a pca.

Active bindings

rslt_pca

Returns the instance variable rslt.pca (list)

df_pca

Returns the instance variable df_pca (tibble::tibble)

df_components

Returns the instance variable df_components (tibble::tibble)

nComp

Returns the instance varibale nComp (integer)

verbose

Returns the instance variable verbose (logical)

Methods

Public methods


Method new()

Creates and returns a new componentAnalysis.pca object.

Usage
componentAnalysis.pca$new(verbose = FALSE)
Arguments
verbose

Makes the class chatty. Default is FALSE. (logical)

Returns

A new R6 object of type componentAnalysis.pca. (pguXAI::componentAnalysis.pca)


Method finalize()

Clears the heap and indicates that instance of componentAnalysis.pca is removed from heap.

Usage
componentAnalysis.pca$finalize()

Method print()

Prints instance variables of a componentAnalysis.pca object.

Usage
componentAnalysis.pca$print()
Returns

string


Method train()

trains the model

Usage
componentAnalysis.pca$train(obj = "tbl_df")
Arguments
obj

The data to be analyzed. (tibble::tibble)


Method evr_overview_plot()

Plots the explained variance ration of the analysis.

Usage
componentAnalysis.pca$evr_overview_plot()
Returns

(ggplot2::ggplot)


Method evr_detail_plot()

Plots the eigenvalues of the analysis.

Usage
componentAnalysis.pca$evr_detail_plot()
Returns

(ggplot2::ggplot)


Method cos2_corrplot()

Plots the quality of representation of the variables on factor map.

Usage
componentAnalysis.pca$cos2_corrplot()
Returns

(ggplot2::ggplot)


Method cos2_barplot()

Plots the quality of representation of the variables on factor map.

Usage
componentAnalysis.pca$cos2_barplot()
Returns

(ggplot2::ggplot)


Method contrib_corrplot()

Maps the attributes contribution to each component.

Usage
componentAnalysis.pca$contrib_corrplot()
Returns

(ggplot2::ggplot)


Method contrib_barplot()

Plots the quality of representation of the variables on factor map.

Usage
componentAnalysis.pca$contrib_barplot()
Returns

(ggplot2::ggplot)


Method clone()

The objects of this class are cloneable with this method.

Usage
componentAnalysis.pca$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Sebastian Malkusch, malkusch@med.uni-frankfurt.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(tidyverse)
library(pguXAI)

main = function(){
  # load data set and remove class labels
  df_data <- iris %>%
    dplyr::select(-Species)

  # define true class labels
  classes_true <- iris$Species

  # run principle component analysis
  ca <- pguXAI::componentAnalysis.pca$new()
  ca$train(obj=df_data)

  # plot results
  ca$evr_overview_plot()

  ca$evr_detail_plot() %>%
    show()

  ca$cos2_corrplot() %>%
    show()

  ca$cos2_barplot()

  ca$contrib_corrplot() %>%
    show()

  ca$contrib_barplot()

  fin <- "done"
  fin
}

main()

SMLMS/pguXAI documentation built on Aug. 15, 2020, 7:09 a.m.