def __init__(self, training: combo.variable, num_rand_basis: int, config: Optional[combo.misc.set_config] = None) -> None: self.config = init_config(config) self.new_data = combo.variable() self.centering = Centering(training.X, self.config.learning.epsilon) self.training = combo.variable(X=self.centering(training.X), t=training.t) self._predictor = init_predictor(num_rand_basis=num_rand_basis, config=config) learn(self.predictor, self.training, num_rand_basis=num_rand_basis)
def __init__(self, policy: 'Policy', num_rand_basis: int, config: combo.misc.set_config) -> None: self.policy = policy self.new_data = combo.variable() self.predictor = init_predictor(num_rand_basis=num_rand_basis, config=config) training = self.policy.training self.centering = Centering(training.X, config=config) learn(self.predictor, combo.variable(X=self.centering(training.X), t=training.t), num_rand_basis=num_rand_basis)
def init_test(predictor: combo.base_predictor, test_X: np.ndarray) -> combo.variable: return combo.variable(X=test_X, Z=predictor.get_basis(test_X))
def predictor(self) -> combo.base_predictor: if self.new_data.t is not None and self.new_data.t.shape[0] > 0: update(self._predictor, self.new_data) self.training.add(X=self.new_data.X, t=self.new_data.t, Z=self.new_data.Z) self.new_data = combo.variable() return self._predictor
def __init__(self) -> None: self._training = combo.variable() self._new_data = combo.variable() self._history = combo.search.discrete.history()
def __init__(self, config: Optional[combo.misc.set_config] = None) -> None: super().__init__() self.training = combo.variable() self.history = combo.search.discrete.history() self.config = init_config(config)
def get_score(self, test: combo.variable, score: str) -> np.ndarray: update(self.predictor, self.new_data) self.new_data = combo.variable() return get_score(self.predictor, test, score)