SHARE
TWEET

Untitled

a guest Jun 24th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class EFeatureObjective(bluepyopt.objectives.Objective):
  2.  
  3.     """EPhys feature objective"""
  4.  
  5.     def __init__(self, name, features=None):
  6.         """Constructor
  7.         Args:
  8.             name (str): name of this object
  9.             features (list of eFeatures): features used in the Objective
  10.         """
  11.  
  12.         super(EFeatureObjective, self).__init__(name)
  13.         self.name = name
  14.         self.features = features
  15.  
  16.     def calculate_feature_scores(self, responses):
  17.         """Calculate the scores for the individual features"""
  18.  
  19.         scores = []
  20.         for feature in self.features:
  21.             scores.append(feature.calculate_score(responses))
  22.  
  23.         return scores
  24.  
  25.  
  26. class SingletonObjective(EFeatureObjective):
  27.  
  28.     """Single EPhys feature"""
  29.  
  30.     def __init__(self, name, feature):
  31.         """Constructor
  32.         Args:
  33.             name (str): name of this object
  34.             features (EFeature): single eFeature inside this objective
  35.         """
  36.  
  37.         super(SingletonObjective, self).__init__(name, [feature])
  38.  
  39.     def calculate_score(self, responses):
  40.         """Objective score"""
  41.  
  42.         return self.calculate_feature_scores(responses)[0]
  43.  
  44.     def __str__(self):
  45.         """String representation"""
  46.  
  47.         return '( %s )' % self.features[0]
  48.      
  49. def calculate_feature_scores(self, responses):                                  
  50.          pass
  51.      
  52. def calculate_feature_scores(self, responses):
  53.      super(SingletonObjective, self).calculate_feature_scores(responses)
  54.      
  55. def calculate_score(self, responses):                                              
  56.          """Objective score"""                                                          
  57.  
  58.          return self.calculate_feature_scores(responses)[0]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top