Commit 9e2c2fa8 authored by Andrew Quinn's avatar Andrew Quinn

Merge branch 'mh1/variable_name_fix' into 'master'

Variable naming fixes

See merge request !58
parents 76d6cde7 998a6b82
Pipeline #25375 passed with stage
in 2 minutes and 33 seconds
...@@ -344,7 +344,8 @@ class PCA(AbstractAnam): ...@@ -344,7 +344,8 @@ class PCA(AbstractAnam):
""" """
hdf5_outputs = ['npcs', 'data_mean', '_U', '_s', '_VT', hdf5_outputs = ['npcs', 'data_mean', '_U', '_s', '_VT',
'explained_variance', 'components', 'loadings', 'scores'] 'explained_variance', 'explained_variance_ratio',
'components', 'loadings', 'scores']
def __init__(self, data=None, npcs=None): def __init__(self, data=None, npcs=None):
AbstractAnam.__init__(self) AbstractAnam.__init__(self)
...@@ -379,7 +380,7 @@ class PCA(AbstractAnam): ...@@ -379,7 +380,7 @@ class PCA(AbstractAnam):
The components scaled by their contribution to the variance in the The components scaled by their contribution to the variance in the
original data original data
explained_variance_ratio_ : ndarray [npcs] explained_variance_ratio : ndarray [npcs]
The proportion of variance explained by each PC The proportion of variance explained by each PC
""" """
...@@ -394,8 +395,8 @@ class PCA(AbstractAnam): ...@@ -394,8 +395,8 @@ class PCA(AbstractAnam):
# Variance explained metrics # Variance explained metrics
var = self._s ** 2 / (data.shape[0]-1) var = self._s ** 2 / (data.shape[0]-1)
self.explained_variance_ = var[:npcs] self.explained_variance = var[:npcs]
self.explained_variance_ratio_ = var[:npcs] / var.sum() self.explained_variance_ratio = var[:npcs] / var.sum()
# The weights for each original variable in each principal component # The weights for each original variable in each principal component
self.components = self._VT[:npcs, :] # Eigenvectors self.components = self._VT[:npcs, :] # Eigenvectors
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment