示例#1
0
 def compute_score(self, state):
     attrs = [self.attrs[i] for i in state]
     domain = Domain(attributes=attrs, class_vars=[self.attr_color])
     data = self.data.transform(domain)
     projector = RadViz()
     projection = projector(data)
     radviz_xy = projection(data)
     y = projector.preprocess(data).Y
     return -self._evaluate_projection(radviz_xy, y)
示例#2
0
 def compute_score(self, state):
     attrs = [self.attrs[i] for i in state]
     domain = Domain(attributes=attrs, class_vars=[self.attr_color])
     data = self.data.transform(domain)
     projector = RadViz()
     projection = projector(data)
     radviz_xy = projection(data)
     y = projector.preprocess(data).Y
     return -self._evaluate_projection(radviz_xy, y)
示例#3
0
    def test_discrete_features(self):
        table = self.titanic[::10]
        projector = RadViz()
        self.assertRaises(ValueError, projector, table)

        table = table.transform(Domain(table.domain.attributes[1:]))
        projector = RadViz()
        projection = projector(table)
        embedding = projection(table[::10])
        self.assertEqual(np.sum(embedding), -17)
示例#4
0
 def clear(self):
     if self.model_selected:
         self.model_selected.clear()
     if self.model_other:
         self.model_other.clear()
     super().clear()
     self.projector = RadViz()
示例#5
0
 def test_radviz(self):
     table = self.iris
     table = table.transform(Domain(table.domain.attributes[2:]))
     projector = RadViz()
     projection = projector(table)
     embedding = projection(table)
     self.assertEqual(len(embedding), len(table))
     self.assertTrue(np.isnan(embedding.X).any())
     np.testing.assert_array_equal(embedding[:100], projection(table[:100]))
示例#6
0
 def clear(self):
     super().clear()
     self.projector = RadViz()