def __init__(self, recommender_data): self.data = recommender_data self._recommendations = None self.method = 'Base' #if not hasattr(self.data, 'test'): # print 'Submitted data is unprepared. Processing...' # self.data.prepare() self._topk = defaults.get_config(['topk'])['topk'] self.filter_seen = defaults.get_config(['filter_seen'])['filter_seen'] self.switch_positive = defaults.get_config(['switch_positive'])['switch_positive'] self.predict_negative = defaults.get_config(['predict_negative'])['predict_negative']
def __init__(self, recommender_data): self.data = recommender_data self._recommendations = None self.method = 'Base' #if not hasattr(self.data, 'test'): # print 'Submitted data is unprepared. Processing...' # self.data.prepare() self._topk = defaults.get_config(['topk'])['topk'] self.filter_seen = defaults.get_config(['filter_seen'])['filter_seen'] self.switch_positive = defaults.get_config(['switch_positive' ])['switch_positive'] self.predict_negative = defaults.get_config(['predict_negative' ])['predict_negative']
def _set_defaults(self, params=None): # [1:] omits undersacores in properties names params = params or [prop[1:] for prop in self._config] config_vals = defaults.get_config(params) for name, value in config_vals.items(): internal_name = '_{}'.format(name) setattr(self, internal_name, value)
def _set_defaults(self, params=None): #[1:] omits undersacores in properties names params = params or [prop[1:] for prop in self._config] config_vals = defaults.get_config(params) for name, value in config_vals.iteritems(): internal_name = '_{}'.format(name) setattr(self, internal_name, value)
def get_default(name): return defaults.get_config([name])[name]
def default_configuration(cls): params = [prop[1:] for prop in cls._config] return defaults.get_config(params)