Exemple #1
0
 def two_pass(self):
     X = square_tensor_gen(self.n,
                           self.rank,
                           dim=self.dim,
                           typ=self.gen_typ,
                           noise_level=self.noise_level)
     start_time = time.time()
     sketch = Sketch(X, self.k, random_seed=None)
     sketchs, _, = sketch.get_sketchs()
     sketch_time = time.time() - start_time
     start_time = time.time()
     sketch_two_pass = SketchTwoPassRecover(X, sketchs, self.rank)
     X_hat, _, _ = sketch_two_pass.recover()
     recover_time = time.time() - start_time
     rerr = eval_mse(X, X_hat)
     return (sketch_time, recover_time), rerr
Exemple #2
0
 def one_pass(self):
     X = square_tensor_gen(self.n,
                           self.rank,
                           dim=self.dim,
                           typ=self.gen_typ,
                           noise_level=self.noise_level)
     start_time = time.time()
     sketch = Sketch(X, self.k, s=self.s, random_seed=self.random_seed)
     sketchs, core_sketch, = sketch.get_sketchs()
     sketch_time = time.time() - start_time
     start_time = time.time()
     sketch_one_pass = SketchOnePassRecover(sketchs, core_sketch,
                                            self.Tinfo_bucket,
                                            self.Rinfo_bucket)
     X_hat, _, _ = sketch_one_pass.recover()
     recover_time = time.time() - start_time
     rerr = eval_mse(X, X_hat)
     return (sketch_time, recover_time), rerr