<jupyter_start><jupyter_text>Lazy Predict PlayingPlaying with `lazypredict` ([GitHub](https://github.com/shankarpandala/lazypredict)) to see how well all the classic models do.<jupyter_code>import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
from pathlib import Path
sns.set()
from google.colab import drive
drive.mount('/content/drive')
! pip install lazypredict
DATA_DIR = Path('/content/drive/MyDrive/Work/Delivery/Current/Earthquake_damage/data')
SUBMISSIONS_DIR = Path('drive/MyDrive/Work/Delivery/Current/Earthquake_damage/submissions')
train_values = pd.read_csv(DATA_DIR / 'train_values.csv', index_col='building_id')
train_labels = pd.read_csv(DATA_DIR / 'train_labels.csv', index_col='building_id')
len(train_values) * 0.3
train_values.sample(n=10, random_state=1)
train_labels.sample(n=10, random_state=1)
train_values = pd.get_dummies(train_values)
X_sample = train_values.sample(frac=0.1, random_state=1)
y_sample = train_labels.sample(frac=0.1, random_state=1)
len(X_sample) == len(y_sample)<jupyter_output><empty_output><jupyter_text>The class balance is kept after sampling (which is the most important thing).<jupyter_code>train_labels.value_counts(normalize=True, sort=False)
y_sample.value_counts(normalize=True, sort=False)
from sklearn.model_selection import train_test_split
from sklearn.metrics import f1_score
from lazypredict.Supervised import LazyClassifier

X_train, X_test, y_train, y_test = train_test_split(X_sample,
                                                    y_sample,
                                                    test_size=0.3,
                                                    random_state=123,
                                                    stratify=y_sample)

clf = LazyClassifier(verbose=0, custom_metric=None)

models, predictions = clf.fit(X_train, X_test, y_train, y_test)

print(models)
models.sort_values('F1 Score', ascending=False)
import lightgbm as lgb<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09593169261677549, 'fraction_numerical': 0.011049723756906077, 'mean_word_length': 3.98, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '112763', 'license': 'MIT', 'n_tokens_mistral': 658, 'n_tokens_neox': 640, 'n_words': 124, 'path': 'analysis/4.1_lazy_predict_library.ipynb', 'repo_name': 'theadammurphy/drivendata_earthquake_damage_competition', 'size': '1991'}