Skip to content

Commit ee23b9a

Browse files
authored
Merge pull request #10 from olivercliff/fast_compute
Included fast compute option that uses a reduced number of statistics
2 parents c47ebb1 + ea7c27b commit ee23b9a

File tree

2 files changed

+980
-3
lines changed

2 files changed

+980
-3
lines changed

pyspi/calculator.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ class Calculator():
3333
The location of the YAML configuration file. See :ref:`Using a reduced SPI set`, defaults to :code:`'</path/to/pyspi>/pyspi/config.yaml'`
3434
"""
3535

36-
def __init__(self,dataset=None,name=None,labels=None,configfile=os.path.dirname(os.path.abspath(__file__)) + '/config.yaml'):
36+
def __init__(self,dataset=None,name=None,labels=None,fast=False,configfile=None):
3737
self._spis = {}
38-
self._load_yaml(configfile)
3938

39+
if configfile is None:
40+
if fast is True:
41+
configfile = os.path.dirname(os.path.abspath(__file__)) + '/fast_config.yaml'
42+
else:
43+
configfile = os.path.dirname(os.path.abspath(__file__)) + '/config.yaml'
44+
self._load_yaml(configfile)
4045

4146
duplicates = [name for name, count in Counter(self._spis.keys()).items() if count > 1]
4247
if len(duplicates) > 0:
@@ -621,7 +626,7 @@ def get_feature_matrix(self,sthresh=0.8,dthresh=0.2,dropduplicates=True):
621626
# Drop measures based on NaN threshold
622627
num_snans = sthresh*fm.shape[1]
623628
fm = fm.dropna(axis=0,thresh=num_snans)
624-
# return fm
629+
return fm
625630

626631
@staticmethod
627632
def _verify_classes(classes):

0 commit comments

Comments
 (0)