<jupyter_start><jupyter_text>Credit Card Fraud DetectionAnonymized credit card transactions labeled as fraudulent or genuineThe datasets contains transactions made by credit cards in September 2013 by european cardholders, https://www.kaggle.com/mlg-ulb/creditcardfraud<jupyter_code>credit = pd.read_csv('../data/creditcard.csv', header=None, names=list(range(1, 31)) + ['Class'])
credit.head(5)
from sklearn.model_selection import train_test_split
X = credit.drop('Class', axis=1).values
y = credit.Class.values
X.shape, y.shape
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)   
X_train.shape, X_test.shape, y_train.shape, y_test.shape
from sklearn.linear_model import LogisticRegression
clf = LogisticRegression(random_state=0).fit(X_train, y_train)
y_hat = clf.predict(X_test)
from sklearn.metrics import roc_auc_score
roc_auc_score(y_test, y_hat)
y_test[:10], y_hat[:10]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11158798283261803, 'fraction_numerical': 0.017167381974248927, 'mean_word_length': 7.256637168141593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '177329', 'license': 'Apache-2.0', 'n_tokens_mistral': 343, 'n_tokens_neox': 325, 'n_words': 72, 'path': 'notebooks/python-classification.ipynb', 'repo_name': 'VolodymyrOrlov/rust4ml', 'size': '932'}