def setUp(self): self.rand = np.random.RandomState(1968486074) self.n_factors = 9 self.f = funcsfa.SFA() self.n_samples = 221 self.n_features = 37 self.X_a = self.rand.normal(0, 1, (self.n_samples, 30)) self.X_b = self.rand.normal(0, 1, (self.n_samples, 7)) self.data_one = funcsfa.DataMatrix(self.X_a) self.data_two = funcsfa.StackedDataMatrix( [funcsfa.DataMatrix(self.X_a), funcsfa.DataMatrix(self.X_b)])
def setUp(self): self.n_samples = 400 self.n_features = [2000, 180] self.n_factors = 10 self.rand = np.random.RandomState(856273263) self.B_a = self.rand.normal(0, 0.9, (self.n_features[0], self.n_factors)) self.B_b = self.rand.normal(0, 1.1, (self.n_features[1], self.n_factors)) Zvar = np.linspace(10, 1, self.n_factors) Zvar = Zvar / np.mean(Zvar) self.Z = self.rand.normal(0, np.sqrt(Zvar), (self.n_samples, self.n_factors)) self.data = funcsfa.StackedDataMatrix([ funcsfa.DataMatrix(np.dot(self.Z, self.B_a.T)), funcsfa.DataMatrix(np.dot(self.Z, self.B_b.T)) ]) self.f = funcsfa.SFA()
def setUp(self): self.rand = np.random.RandomState(1273641113) self.n_factors = 9 self.f = funcsfa.SFA() self.n_samples = 514 samples = [f'n{i}' for i in range(self.n_samples)] self.n_features = 107 + 49 f1 = [f'f1_{i}' for i in range(107)] f2 = [f'f2_{i}' for i in range(49)] self.X_a = self.rand.normal(0, 1, (self.n_samples, 107)) self.Xw_a = self.rand.normal(0, 1, (self.n_samples, 107)) self.X_b = self.rand.normal(0, 1, (self.n_samples, 49)) self.Xw_b = self.rand.normal(0, 1, (self.n_samples, 49)) self.data = funcsfa.StackedDataMatrix( [ funcsfa.DataMatrix(self.X_a, samples, f1, self.Xw_a), funcsfa.DataMatrix(self.X_b, samples, f2, self.Xw_b) ], ['a', 'b'], ) self.data.to_netcdf('test_roundtrip.nc') self.data2 = funcsfa.StackedDataMatrix.from_netcdf('test_roundtrip.nc')