<jupyter_start><jupyter_text>regularizehttps://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html<jupyter_code>from sklearn.preprocessing import StandardScaler
import numpy as np
import seaborn as sns
import scipy.stats as stats
import spacepy.toolbox as tb
import matplotlib.pyplot as plt

sns.set(font_scale=1.5)
%matplotlib inline
np.random.seed(123)
data = np.random.normal(10, 3.4, size=100)
sns.distplot(data)
h, b = np.histogram(data, bins=7)
b = tb.bin_edges_to_center(b)
plt.plot(b, h)
d = np.vstack((b,h)).T
scaler = StandardScaler()
print(scaler.fit(d))
scaler.mean_
scaler.scale_
trans = scaler.transform(d)
plt.plot(trans[:,0], trans[:,1])
plt.plot(b, h)
scaler.inverse_transform(trans)
plt.plot(trans[:,0], trans[:,1])
plt.plot(b, h)
plt.plot(scaler.inverse_transform(trans)[:,0], scaler.inverse_transform(trans)[:,1]+0.4)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1557285873192436, 'fraction_numerical': 0.02335928809788654, 'mean_word_length': 7.256880733944954, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '117122', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 370, 'n_tokens_neox': 360, 'n_words': 61, 'path': 'Transforms/scikit-learn regularize.ipynb', 'repo_name': 'balarsen/pymc_learning', 'size': '899'}