<jupyter_start><jupyter_text>prepro<jupyter_code>do = Data('titanic') 
titanic_data = do.get_data()
preproc = Preprocessing(titanic_data)
preproc.drop('Cabin')
preproc.mean_inputer('Age')
preproc.mode_inputer('Embarked')
preproc.encoding('Sex','Embarked')
titanic_data = preproc.final_df()
titanic_data['Pclass'].unique()<jupyter_output><empty_output><jupyter_text>model<jupyter_code>ml = Model(titanic_data)
X = ml.X_features_drop(['PassengerId','Name','Ticket','Survived'])
X.shape
y = ml.y_target(['Survived'])
X_train, X_test, y_train, y_test = ml.split(X,y,test_size=0.2,random_state=2)
X_train.shape, y_train.shape
model = LogisticRegression()
model.fit(X_train, y_train)
X_train_prediction = model.predict(X_train)

training_data_accuracy = accuracy_score(y_train, X_train_prediction)
print('Accuracy score of training data : ', training_data_accuracy)

X_test_prediction = model.predict(X_test)
test_data_accuracy = accuracy_score(y_test, X_test_prediction)
print('Accuracy score of test data : ', test_data_accuracy)
X.columns
ml.prediction(model = model ,pclass = 3, sex=0, age=35, sibsp=0, parch=0, fare=8.05, embarked=0)
X_test
model.predict(X_test)
y_test.shape, X_test.shape
X.shape, y.shape
f_v = 0
f_m = 0
h_v = 0
h_m = 0
for features, target in zip(X.values, y.values):
    if int(features[1]) == 1 and target[0] == 1:
        f_v += 1
    elif int(features[1]) == 1 and target[0] == 0:
        f_m += 1
    elif int(features[1]) == 0 and target[0] == 1:
        h_v += 1
    elif int(features[1]) == 0 and target[0] == 0:
        h_m += 1
#     print(features[1], target[0])
        
# synthaxe à utiliser pour utilisation en htlm "liste de dict" 
[{"Nombre de femmes ayant survécu":f_v},{"Nombre de femmes n'ayant pas survécu":f_m},{"Nombre d'hommes ayant survécu":h_v},{"Nombre d'hommes n'ayant pas survécu":h_m}]<jupyter_output>0.0 0
1.0 1
1.0 1
1.0 1
0.0 0
0.0 0
0.0 0
0.0 0
1.0 1
1.0 1
1.0 1
1.0 1
0.0 0
0.0 0
1.0 0
1.0 1
0.0 0
0.0 1
1.0 0
1.0 1
0.0 0
0.0 1
1.0 1
0.0 1
1.0 0
1.0 1
0.0 0
0.0 0
1.0 1
0.0 0
0.0 0
1.0 1
1.0 1
0.0 0
0.0 0
0.0 0
0.0 1
0.0 0
1.0 0
1.0 1
1.0 0
1.0 0
0.0 0
1.0 1
1.0 1
0.0 0
0.0 0
1.0 1
0.0 0
1.0 0
0.0 0
0.0 0
1.0 1
1.0 1
0.0 0
0.0 1
1.0 1
0.0 0
1.0 1
0.0 0
0.0 0
1.0 1
0.0 0
0.0 0
0.0 0
0.0 1
1.0 1
0.0 0
1.0 1
0.0 0
0.0 0
1.0 0
0.0 0
0.0 0
0.0 1
0.0 0
0.0 0
0.0 0
0.0 1
1.0 1
0.0 0
0.0 1
1.0 1
0.0 0
1.0 1
1.0 1
0.0 0
0.0 0
1.0 1
0.0 0
0.0 0
0.0 0
0.0 0
0.0 0
0.0 0
0.0 0
0.0 0
0.0 1
1.0 1
0.0 0
1.0 0
0.0 0
0.0 0
0.0 0
0.0 0
0.0 0
1.0 1
0.0 1
0.0 0
1.0 1
0.0 0
1.0 0
0.0 0
1.0 0
1.0 0
0.0 0
0.0 0
0.0 0
0.0 0
1.0 0
0.0 0
0.0 0
0.0 0
1.0 1
0.0 0
0.0 1
0.0 0
0.0 1
1.0 1
0.0 0
0.0 0
0.0 0
1.0 0
1.0 1
0.0 0
0.0 0
1.0 1
0.0 0
0.0 0
0.0 0
1.0 0
1.0 1
1.0 1
0.0 0
0.0 0
0.0 0
0.0 1
1.0 0
0.0 0
0.0 0
0.0 0
1.0 1
0.0 0
0.0 0
0.0 0
0.0 0
1.0 1
0.0 0
0.0 0
0.0 0
0.0 0
1.0 1
0.0 0
0.0 0
0.0 0
0.0 1
1.0 [...]
{'fraction_non_alphanumeric': 0.15627189908899788, 'fraction_numerical': 0.18885774351786966, 'mean_word_length': 2.679123711340206, 'pattern_counts': {'":': 4, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '310346', 'license': 'MIT', 'n_tokens_mistral': 1773, 'n_tokens_neox': 1574, 'n_words': 476, 'path': '.ipynb_checkpoints/notebook_titanic-checkpoint.ipynb', 'repo_name': 'Adriengith/titanicazertyu', 'size': '2854'}