<jupyter_start><jupyter_text>Read Data<jupyter_code>df = pd.read_pickle(DF_PATH)<jupyter_output><empty_output><jupyter_text>Spliting Data<jupyter_code>Y = df["TenYearCHD"]
X = df.drop('TenYearCHD',axis=1)
X_train, X_test, Y_train, Y_test = train_test_split(X,Y, test_size=0.20, random_state = 0)
X_train.shape<jupyter_output><empty_output><jupyter_text>Train models<jupyter_code># Modeling step Test differents algorithms 
NFOLDS=5
SEED=0
kf = KFold( n_splits= NFOLDS, random_state=SEED, shuffle=True)
random_state = 42
classifiers = []
classifiers.append(SVC(random_state=random_state))
classifiers.append(KNeighborsClassifier())
classifiers.append(LogisticRegression(random_state = random_state,warm_start=True))


cv_results = []
for classifier in classifiers :
    cv_results.append(cross_val_score(classifier, X_train, y = Y_train, scoring = "accuracy", cv = kf, n_jobs=-1))

cv_means = []
cv_std = []
for cv_result in cv_results:
    cv_means.append(cv_result.mean())
    cv_std.append(cv_result.std())

cv_res = pd.DataFrame({"CrossValMeans":cv_means,"CrossValerrors": cv_std,"Algorithm":["SVC","KNeighboors","LogisticRegression"]})

g = sns.barplot("CrossValMeans","Algorithm",data = cv_res, palette="Set3",orient = "h",**{'xerr':cv_std})    
g.set_xlabel("Mean Accuracy")
g = g.set_title("Cross validation scores")
plt.show()<jupyter_output>C:\Python39\lib\site-packages\seaborn\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  warnings.warn(
{'fraction_non_alphanumeric': 0.13116726835138387, 'fraction_numerical': 0.010830324909747292, 'mean_word_length': 7.798941798941799, 'pattern_counts': {'":': 3, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '597937', 'license': 'MIT', 'n_tokens_mistral': 623, 'n_tokens_neox': 595, 'n_words': 111, 'path': 'notebooks/Classification_1/04a_predict.ipynb', 'repo_name': 'D-Zineb/Internship_ml_1A', 'size': '1662'}