<jupyter_start><jupyter_text>Development NotebookI use this notebook as a development tool.  Preliminaries<jupyter_code>%load_ext lab_black<jupyter_output><empty_output><jupyter_text>Imports<jupyter_code>import numpy as np
import pandas as pd
import os

import sklearn
from sklearn.datasets import load_iris
from also_anomaly_detector import AlsoAnomalyDetector<jupyter_output><empty_output><jupyter_text>Data<jupyter_code>iris = load_iris()

X = iris.get("data")
y = iris.get("target")

matrix = np.c_[X, y]<jupyter_output><empty_output><jupyter_text>ImplementationThis is where functions and classes are implemented.<jupyter_code>from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor<jupyter_output><empty_output><jupyter_text>SandboxThis is where functions and classes are tested.<jupyter_code>clf = AlsoAnomalyDetector(max_depth=2, verbose=False)
clf.fit(
    X,
)
X.shape
clf.residuals.shape
clf.rrses
np.minimum([1, 1, 8], np.ones(3) * 3)
clf.scores.min(), clf.scores.mean(), clf.scores.max(),
clf.scores[clf.labels == 1]
clf.n_anomalies<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10733944954128441, 'fraction_numerical': 0.006422018348623854, 'mean_word_length': 8.570175438596491, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '459694', 'license': 'MIT', 'n_tokens_mistral': 425, 'n_tokens_neox': 403, 'n_words': 74, 'path': 'note/dev-nb.ipynb', 'repo_name': 'eliavw/also-anomaly-detector', 'size': '1090'}