Beispiel #1
0
    def setUp(self):
        np.random.seed(1)
        res = random_multimodal(num_microbes=8,
                                num_metabolites=8,
                                num_samples=150,
                                latent_dim=2,
                                sigmaQ=2,
                                microbe_total=1000,
                                metabolite_total=10000,
                                seed=1)
        (self.microbes, self.metabolites, self.X, self.B, self.U, self.Ubias,
         self.V, self.Vbias) = res
        n, d1 = self.microbes.shape
        n, d2 = self.metabolites.shape

        self.microbes = biom.Table(self.microbes.values.T,
                                   self.microbes.columns, self.microbes.index)
        self.metabolites = biom.Table(self.metabolites.values.T,
                                      self.metabolites.columns,
                                      self.metabolites.index)
        U_ = np.hstack((np.ones((self.U.shape[0], 1)), self.Ubias, self.U))
        V_ = np.vstack((self.Vbias, np.ones((1, self.V.shape[1])), self.V))

        uv = U_ @ V_
        h = np.zeros((d1, 1))
        self.exp_ranks = clr_inv(np.hstack((h, uv)))
Beispiel #2
0
 def setUp(self):
     # build small simulation
     res = random_multimodal(
         num_microbes=100, num_metabolites=1000, num_samples=300,
         latent_dim=2, sigmaQ=2,
         microbe_total=5000, metabolite_total=10000, seed=1
     )
     (self.microbes, self.metabolites, self.X, self.B,
      self.U, self.Ubias, self.V, self.Vbias) = res
     num_train = 10
     self.trainX = self.microbes.iloc[:-num_train]
     self.testX = self.microbes.iloc[-num_train:]
     self.trainY = self.metabolites.iloc[:-num_train]
     self.testY = self.metabolites.iloc[-num_train:]