Пример #1
0
 def test_project_cur_default(self):
     data = Table("ionosphere")
     projector = ProjectCUR()
     data_cur = projector(data)
     for i in range(data_cur.X.shape[1]):
         sbtr = (data.X - data_cur.X[:, i][:, None]) == 0
         self.assertTrue(((sbtr.sum(0) == data.X.shape[0])).any())
     self.assertTrue(data_cur.X.shape[1] <= data.X.shape[1])
     self.assertTrue((data.metas == data_cur.metas).all())
     self.assertTrue((data.Y == data_cur.Y).any())
Пример #2
0
 def test_project_cur(self):
     data = self.ionosphere
     projector = ProjectCUR(rank=3, max_error=1)
     data_cur = projector(data)
     for i in range(data_cur.X.shape[1]):
         sbtr = (data.X - data_cur.X[:, i][:, None]) == 0
         self.assertTrue(((sbtr.sum(0) == data.X.shape[0])).any())
     self.assertTrue(data_cur.X.shape[1] <= data.X.shape[1])
     self.assertTrue((data.metas == data_cur.metas).all())
     self.assertTrue((data.Y == data_cur.Y).any())
Пример #3
0
 def createinstance(params):
     rank = params.get("rank", 10)
     max_error = params.get("max_error", 1)
     return ProjectCUR(rank=rank, max_error=max_error)