Пример #1
0
 def test_score_heuristics(self):
     domain = Domain([ContinuousVariable(c) for c in "abcd"], DiscreteVariable("c", values="ab"))
     a = np.arange(10).reshape((10, 1))
     data = Table(domain, np.hstack([a, a, a, a]), a >= 5)
     self.send_signal("Data", data)
     vizrank = ScatterPlotVizRank(self.widget)
     self.assertEqual([x.name for x in vizrank.score_heuristic()], list("abcd"))
Пример #2
0
 def test_score_heuristics(self):
     domain = Domain([ContinuousVariable(c) for c in "abcd"],
                     DiscreteVariable("e", values="ab"))
     a = np.arange(10).reshape((10, 1))
     data = Table(domain, np.hstack([a, a, a, a]), a >= 5)
     self.send_signal(self.widget.Inputs.data, data)
     vizrank = ScatterPlotVizRank(self.widget)
     self.assertEqual([x.name for x in vizrank.score_heuristic()],
                      list("abcd"))
Пример #3
0
    def test_vizrank(self):
        data = Table("iris")
        self.send_signal(self.widget.Inputs.data, data)
        vizrank = ScatterPlotVizRank(self.widget)
        n_states = len(data.domain.attributes)
        n_states = n_states * (n_states - 1) / 2
        states = [state for state in vizrank.iterate_states(None)]
        self.assertEqual(len(states), n_states)
        self.assertEqual(len(set(states)), n_states)
        self.assertIsNotNone(vizrank.compute_score(states[0]))
        self.send_signal(self.widget.Inputs.data, data[:9])
        self.assertIsNone(vizrank.compute_score(states[0]))

        data = Table("housing")[::10]
        self.send_signal(self.widget.Inputs.data, data)
        vizrank = ScatterPlotVizRank(self.widget)
        states = [state for state in vizrank.iterate_states(None)]
        self.assertIsNotNone(vizrank.compute_score(states[0]))
Пример #4
0
    def test_vizrank(self):
        data = Table("iris")
        self.send_signal(self.widget.Inputs.data, data)
        vizrank = ScatterPlotVizRank(self.widget)
        n_states = len(data.domain.attributes)
        n_states = n_states * (n_states - 1) / 2
        states = [state for state in vizrank.iterate_states(None)]
        self.assertEqual(len(states), n_states)
        self.assertEqual(len(set(states)), n_states)
        self.assertIsNotNone(vizrank.compute_score(states[0]))
        self.send_signal(self.widget.Inputs.data, data[:9])
        self.assertIsNone(vizrank.compute_score(states[0]))

        data = Table("housing")[::10]
        self.send_signal(self.widget.Inputs.data, data)
        vizrank = ScatterPlotVizRank(self.widget)
        states = [state for state in vizrank.iterate_states(None)]
        self.assertIsNotNone(vizrank.compute_score(states[0]))