Exemplo n.º 1
0
    def test_error__set_data_numeric(self):
        with pytest.raises(TypeError):
            mfe = MFE()
            mfe._set_data_numeric(True)

        with pytest.raises(TypeError):
            mfe = MFE()
            mfe.X = np.array([])
            mfe._set_data_numeric(True)
Exemplo n.º 2
0
    def test_errors__fill_col_ind_by_type(self):
        X, y = load_xy(0)
        with pytest.raises(TypeError):
            mfe = MFE()
            mfe._fill_col_ind_by_type()

        X = [[1, 2, 'a', 'b']] * 10 + [[3, 4, 'c', 'd']] * 10
        y = [0] * 10 + [1] * 10

        mfe = MFE()
        mfe.X, mfe.y = np.array(X), np.array(y)
        mfe._fill_col_ind_by_type(cat_cols=None)
        assert mfe._attr_indexes_cat == ()

        mfe = MFE()
        mfe.X, mfe.y = np.array(X), np.array(y)
        mfe._fill_col_ind_by_type(cat_cols="auto", check_bool=True)
        assert len(mfe._attr_indexes_cat) == 4

        mfe = MFE()
        mfe.X, mfe.y = np.array(X), np.array(y)
        mfe._fill_col_ind_by_type(cat_cols=[2, 3])
        assert mfe._attr_indexes_cat == (2, 3)
Exemplo n.º 3
0
 def test_error_empty_data_2(self):
     with pytest.raises(TypeError):
         X, y = load_xy(0)
         model = MFE().fit(X=X.values, y=y.values)
         model.X = None
         model.extract()