def init(self, boot_spec): # TODO: do the 1D version shape = boot_spec.get_observations().shape() if len(shape) > 2: msg = 'BGDSagent only work with 2D or 1D signals.' raise UnsupportedSpec(msg) min_width = np.min(shape) if min_width <= 5: msg = ('BGDSagent thinks this shape is too' 'small to compute gradients: %s' % str(shape)) raise UnsupportedSpec(msg) self.is2D = len(boot_spec.get_observations().shape()) == 2 self.is1D = len(boot_spec.get_observations().shape()) == 1 ExpSwitcher.init(self, boot_spec) self.count = 0 self.y_deriv = DerivativeBox() self.bgds_estimator = BGDSEstimator() self.model = None self.y_disag = Expectation() self.y_disag_s = Expectation() self.u_stats = [] self.last_y0 = None self.last_y = None self.rd = RemoveDoubles(0.5)
def init(self, boot_spec): ExpSwitcher.init(self, boot_spec) if len(boot_spec.get_observations().shape()) != 1: raise UnsupportedSpec('I assume 1D signals.') self.y_stats = MeanCovariance() self.y_dot_stats = MeanCovariance() self.y_dot_sgn_stats = MeanCovariance() self.y_dot_abs_stats = MeanCovariance() self.count = 0 self.y_deriv = DerivativeBox()