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 rfecv_sklearn_example(image="rfecv_sklearn_example.png"): X, y = make_classification( n_samples=1000, n_features=25, n_informative=3, n_redundant=2, n_repeated=0, n_classes=8, n_clusters_per_class=1, random_state=0, ) _, ax = plt.subplots() oz = RFECV(SVC(kernel="linear", C=1), ax=ax) oz.fit(X, y) oz.poof(outpath=os.path.join(IMAGES, image))