Commit 998a6b82 authored by Mark Hymers's avatar Mark Hymers

Variable naming fixes

Signed-off-by: Mark Hymers's avatarMark Hymers <mark.hymers@ynic.york.ac.uk>
parent 76d6cde7
Pipeline #25374 passed with stage
in 2 minutes and 14 seconds
......@@ -344,7 +344,8 @@ class PCA(AbstractAnam):
"""
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):
AbstractAnam.__init__(self)
......@@ -379,7 +380,7 @@ class PCA(AbstractAnam):
The components scaled by their contribution to the variance in the
original data
explained_variance_ratio_ : ndarray [npcs]
explained_variance_ratio : ndarray [npcs]
The proportion of variance explained by each PC
"""
......@@ -394,8 +395,8 @@ class PCA(AbstractAnam):
# Variance explained metrics
var = self._s ** 2 / (data.shape[0]-1)
self.explained_variance_ = var[:npcs]
self.explained_variance_ratio_ = var[:npcs] / var.sum()
self.explained_variance = var[:npcs]
self.explained_variance_ratio = var[:npcs] / var.sum()
# The weights for each original variable in each principal component
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