def rfecv_quick_method(image="rfecv_quick_method.png"): X, y = load_credit() _, ax = plt.subplots() cv = StratifiedKFold(5) visualizer = rfecv(RandomForestClassifier(), X=X, y=y, ax=ax, cv=cv, scoring='f1_weighted') visualizer.show(outpath=os.path.join(IMAGES, image))
def rfecv_credit_example(image="rfecv_credit.png"): X, y = load_credit() _, ax = plt.subplots() cv = StratifiedKFold(5) oz = RFECV(RandomForestClassifier(), ax=ax, cv=cv, scoring="f1_weighted") oz.fit(X, y) oz.poof(outpath=os.path.join(IMAGES, image))
def test_rank1d_quick_method(self): """ Test Rank1d quick method """ X, y = load_credit() viz = rank1d(X, y, show=False) assert isinstance(viz, Rank1D) self.assert_images_similar(viz, tol=0.1)
def rfecv(): X, y = load_credit() model = RandomForestClassifier(n_estimators=10) oz = RFECV(model, cv=3, scoring="f1_weighted", ax=newfig()) oz.fit(X, y) savefig(oz, "rfecv_sklearn_example")
def pca(): X, y = load_credit() colors = np.array(["r" if yi else "b" for yi in y]) oz = PCA(scale=True, color=colors, proj_dim=3) oz.fit_transform(X, y) savefig(oz, "pca_projection_3d")
def rank2d(): X, y = load_credit() oz = Rank2D(algorithm="covariance", ax=newfig()) oz.fit_transform(X, y) savefig(oz, "rank2d_covariance")
def rank1d(): X, y = load_credit() oz = Rank1D(algorithm="shapiro", ax=newfig()) oz.fit_transform(X, y) savefig(oz, "rank1d_shapiro")