test_feature_selection_insight.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:karura 作者: chakki-works 项目源码 文件源码
def test_insight_regression(self):
        candidates = 4
        X, y = make_regression(
            n_samples=1000, n_features=15, n_informative=candidates,
            n_targets=1)

        df = pd.DataFrame(np.hstack((X, y.reshape([-1, 1]))), columns=["c_{}".format(i) for i in range(X.shape[1])] + ["target"])
        dfe = DataFrameExtension(df, numericals=["target"], target="target")

        insight = FeatureSelectionInsight()
        insight.adopt(dfe)

        print("selected regressor features {}".format(dfe.ftypes.keys()))
        self.assertTrue(candidates <= len(dfe.ftypes) - 1 < candidates * 2)  # -1 is target ftype
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号