diff --git a/rhapsody/utils/settings.py b/rhapsody/utils/settings.py index 1e9a2c0..3df3632 100644 --- a/rhapsody/utils/settings.py +++ b/rhapsody/utils/settings.py @@ -4,6 +4,7 @@ import os import tarfile +import pickle import urllib.request import shutil import sklearn @@ -13,7 +14,7 @@ __all__ = ['DEFAULT_FEATSETS', 'initialSetup', 'getDefaultTrainingDataset', 'getDefaultClassifiers', - 'delSettings', 'getSettings'] + 'importDefaultClassifier', 'delSettings', 'getSettings'] USERHOME = os.getenv('USERPROFILE') or os.getenv('HOME') or './' DEFAULT_WORKING_DIR = os.path.join(USERHOME, 'rhapsody') @@ -232,6 +233,18 @@ def getDefaultClassifiers(): return def_clsfs +def importDefaultClassifier(version): + """Imports the specified classifier and its summary + + :arg version: either 'full', 'reduced' or 'EVmut' + :type version: str + """ + assert version in ['full', 'reduced', 'EVmut'] + with open(getDefaultClassifiers()[version], 'rb') as p: + clsf = pickle.load(p) + return clsf + + def delSettings(): for entry in ['rhapsody_local_folder', 'rhapsody_training_dataset', 'EVmutation_local_folder', 'EVmutation_metrics']: