Esempio n. 1
0
    def test_threshold(self):
        p = Prim(TestPrimInitMethod.df,
                 lambda x: x["x1"] * x["x2"] + 0.3 * x["x3"] > 0.5)
        box = p.find_box()
        output = str(box)

        self.assertEqual(output, TestPrimInitMethod.expected_output)
Esempio n. 2
0
 def test_threshold(self):
     p = Prim(TestPrimInitMethod.df,
              lambda x : x["x1"]*x["x2"] + 0.3*x["x3"] > 0.5)
     box = p.find_box()
     output = str(box)
     
     self.assertEqual(output, TestPrimInitMethod.expected_output)
Esempio n. 3
0
 def test_init_numpy(self):
     df = TestPrimInitMethod.df.to_records(index=False)
     response = TestPrimInitMethod.response.values
     p = Prim(df, response, threshold=0.5, threshold_type=">")
     box = p.find_box()
     output = str(box)
     
     self.assertEqual(output, TestPrimInitMethod.expected_output)
Esempio n. 4
0
 def setUpClass(cls):
     cls.df = pd.DataFrame(np.random.rand(1000, 3),
                           columns=["x1", "x2", "x3"])
     cls.response = cls.df["x1"]*cls.df["x2"] + 0.3*cls.df["x3"]
     
     p = Prim(cls.df, cls.response, threshold=0.5, threshold_type=">")
     box = p.find_box()
     cls.expected_output = str(box)
Esempio n. 5
0
    def test_init_numpy(self):
        df = TestPrimInitMethod.df.to_records(index=False)
        response = TestPrimInitMethod.response.values
        p = Prim(df, response, threshold=0.5, threshold_type=">")
        box = p.find_box()
        output = str(box)

        self.assertEqual(output, TestPrimInitMethod.expected_output)
Esempio n. 6
0
    def setUpClass(cls):
        cls.df = pd.DataFrame(np.random.rand(1000, 3),
                              columns=["x1", "x2", "x3"])
        cls.response = cls.df["x1"] * cls.df["x2"] + 0.3 * cls.df["x3"]

        p = Prim(cls.df, cls.response, threshold=0.5, threshold_type=">")
        box = p.find_box()
        cls.expected_output = str(box)
Esempio n. 7
0
 def test_string(self):
     df = copy.deepcopy(TestPrimInitMethod.df)
     df["y"] = df["x1"]*df["x2"] + 0.3*df["x3"]
     
     p = Prim(df, "y", threshold=0.5, threshold_type=">")
     box = p.find_box()
     output = str(box)
     
     self.assertEqual(output, TestPrimInitMethod.expected_output)
Esempio n. 8
0
 def test_function(self):
     p = Prim(TestPrimInitMethod.df,
              lambda x : x["x1"]*x["x2"] + 0.3*x["x3"],
              threshold=0.5,
              threshold_type=">")
     box = p.find_box()
     output = str(box)
     
     self.assertEqual(output, TestPrimInitMethod.expected_output)
Esempio n. 9
0
    def test_string(self):
        df = copy.deepcopy(TestPrimInitMethod.df)
        df["y"] = df["x1"] * df["x2"] + 0.3 * df["x3"]

        p = Prim(df, "y", threshold=0.5, threshold_type=">")
        box = p.find_box()
        output = str(box)

        self.assertEqual(output, TestPrimInitMethod.expected_output)
Esempio n. 10
0
    def test_function(self):
        p = Prim(TestPrimInitMethod.df,
                 lambda x: x["x1"] * x["x2"] + 0.3 * x["x3"],
                 threshold=0.5,
                 threshold_type=">")
        box = p.find_box()
        output = str(box)

        self.assertEqual(output, TestPrimInitMethod.expected_output)