Skip to content
This repository has been archived by the owner on Sep 10, 2020. It is now read-only.

Commit

Permalink
Replace get_dict() with __dict__
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero committed Nov 28, 2016
1 parent 4fc9d54 commit 5a47434
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions fpsd/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,8 @@ def __init__(self, model_timestamp, world, model_type,
self.k = k
self.feature_scaling = feature_scaling
self.db = database.ModelStorage(test=False)

def get_dict(self):
"""Get config options as a dict"""

return {"hyperparameters": self.hyperparameters,
"model_type": self.model_type,
"world_type": self.world_type,
"observed_world_fraction": self.frac_obs,
"numfolds": self.k,
"train_class_balance": 'DEFAULT',
"base_rate": 'DEFAULT'}
self.train_class_balance = 'DEFAULT'
self.base_rate = 'DEFAULT'

def train_single_fold(self, x_train, y_train):
"""Trains a model and saves it as self.trained_model
Expand Down Expand Up @@ -161,7 +152,7 @@ def train_eval_all_folds(self, x_val, y_val):
avg_metrics = evaluation.get_average_metrics(metrics_all_folds)
# Save results of experiment (model evaluation averaged over all
# folds) into the database
self.db.save_full_model(avg_metrics, self.model_timestamp, self.get_dict())
self.db.save_full_model(avg_metrics, self.model_timestamp, self.__dict__)

def pickle_results(self, pkl_file, to_save):
with open(pkl_file, 'wb') as f:
Expand Down

0 comments on commit 5a47434

Please sign in to comment.