text_plain_output_1.png
from sklearn.feature_selection import SelectKBest, f_classif

from sklearn.impute import SimpleImputer

from sklearn.linear_model import LogisticRegression

from sklearn.model_selection import train_test_split

from sklearn.pipeline import make_pipeline

from sklearn.preprocessing import StandardScaler

import pandas as pd

import seaborn as sns

train_df = pd.read_csv('../input/tabular-playground-series-sep-2021/train.csv')
test_df = pd.read_csv('../input/tabular-playground-series-sep-2021/test.csv')
sample_df = pd.read_csv('../input/tabular-playground-series-sep-2021/sample_solution.csv')

X, y = (train_df.iloc[:, 1:-1], train_df.iloc[:, -1])
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=33)

results = []
for n_params in range(1, 100):
    pipe = make_pipeline(SimpleImputer(strategy='mean'), StandardScaler(), SelectKBest(f_classif, k=n_params), LogisticRegression(random_state=33))
    pipe.fit(X_train, y_train)
    score = pipe.score(X_test, y_test)
    results.append([n_params, score])

sns.scatterplot(x=[i[0] for i in results], y=[i[1] for i in results])