def fit(self, X, y=None, prefit=False): assert (y is None) or self.rows, 'If over features, cant use y' if not self.rows: X = X.T self.n = X.shape[0] self.D = np.sign(np.random.randn(self.n)) self.srht_const = np.sqrt(self.n / self.k) self.S = np.random.choice(self.n, self.k, replace=False) if prefit: if len(X.shape) == 1: self.transform_1d(X) else: self.transform(X, y) export_wisdom(self.wisdom_file)
def __del__(self): export_wisdom(self.wisdom_file)