<jupyter_start><jupyter_text>LOGISTIC REGRESSION MODEL<jupyter_code>#import dependencies
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
# Train the Logistic Regression model on the unscaled data and print the model score
classifier = LogisticRegression()

# Fit our model using the training data
classifier.fit(x_train, y_train)
print(f"Training Data Score: {classifier.score(x_train, y_train)}")
print(f"Testing Data Score: {classifier.score(x_test, y_test)}")<jupyter_output>Training Data Score: 0.6564860426929392
Testing Data Score: 0.5199914929817099<jupyter_text>RandomForest Classifier Model<jupyter_code>#import dependencies
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report, roc_curve
# Train a Random Forest Classifier model and print the model score
rf_clf = RandomForestClassifier(random_state=1)
rf_clf.fit(x_train, y_train)
#classification reports
y_pred = rf_clf.predict(x_test)
print(classification_report(y_test, y_pred))
#model score
print(f"Training Data Score: {rf_clf.score(x_train, y_train)}")
print(f"Testing Data Score: {rf_clf.score(x_test, y_test)}")<jupyter_output>Training Data Score: 1.0
Testing Data Score: 0.6671629094002552<jupyter_text>Scaling the Data<jupyter_code>#import dependencies
from sklearn.preprocessing import StandardScaler
# Scale the data and all features
scaler = StandardScaler().fit(x_train)
x_train_scaled = scaler.transform(x_train)
x_test_scaled = scaler.transform(x_test)


# Train the Logistic Regression model on the scaled data and print the model score
# Create a logistic regression model
classifier_scaled = LogisticRegression()

# Fit our model using the training data
classifier_scaled.fit(x_train_scaled, y_train)
print(f"Training Data Score: {classifier.score(x_train_scaled, y_train)}")
print(f"Testing Data Score: {classifier.score(x_test_scaled, y_test)}")
# Train a Random Forest Classifier model on the scaled data and print the model score
# Train a Random Forest Classifier model and print the model score
rf_clf_scaled = RandomForestClassifier(random_state=42)
rf_clf_scaled.fit(x_train_scaled, y_train)
#classification reports
y_pred = rf_clf_scaled.predict(x_test_scaled)
print(classification_report(y_test, y_pred))
#model score
print(f"Training Data Score: {rf_clf_scaled.score(x_train_scaled, y_train)}")
print(f"Testing Data Score: {rf_clf_scaled.score(x_test_scaled, y_test)}")<jupyter_output>Training Data Score: 1.0
Testing Data Score: 0.6546150574223735
{'fraction_non_alphanumeric': 0.08082408874801902, 'fraction_numerical': 0.029714738510301108, 'mean_word_length': 8.351851851851851, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '2542', 'license': 'ADSL', 'n_tokens_mistral': 907, 'n_tokens_neox': 842, 'n_words': 220, 'path': 'Credit Risk Evaluator.ipynb', 'repo_name': 'memeguerrini/supervised-learning-challenge', 'size': '2524'}