<commit_before>import os
import sys
sys.path.insert(0, os.path.abspath('..'))

from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn import metrics

from aorun.models import Model
from aorun.layers import Dense
from aorun.layers import Activation
from aorun.optimizers import SGD

X, y = datasets.load_boston(return_X_y=True)
X = X.astype('float32')
y = y.astype('float32')
X = StandardScaler().fit_transform(X)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)

model = Model(
    Dense(10, input_dim=X_train.shape[-1]),
    Activation('relu'),
    Dense(10),
    Activation('relu'),
    Dense(1)
)

sgd = SGD(lr=0.005)
history = model.fit(X_train, y_train, loss='mse', optimizer=sgd, n_epochs=500)
y_pred = model.forward(X_test)
print('r2_score:', metrics.r2_score(y_test, y_pred))
print('mean_absolute_error:', metrics.mean_absolute_error(y_test, y_pred))
print('mean_squared_error:', metrics.mean_squared_error(y_test, y_pred))<commit_msg>clean regression example<commit_after>import os
import sys
sys.path.insert(0, os.path.abspath('..'))

from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn import metrics

from aorun.models import Model
from aorun.layers import Dense
from aorun.layers import Activation
from aorun.optimizers import SGD

X, y = datasets.load_boston(return_X_y=True)
X = StandardScaler().fit_transform(X).astype('float32')
y = StandardScaler().fit_transform(y).astype('float32')
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)

model = Model(
    Dense(100, input_dim=X_train.shape[-1]),
    Activation('relu'),
    Dense(100),
    Activation('relu'),
    Dense(1)
)

sgd = SGD(lr=0.1)
history = model.fit(X_train, y_train, loss='mse', optimizer=sgd, n_epochs=500)
y_pred = model.forward(X_test)
print('r2_score:', metrics.r2_score(y_test, y_pred))
print('mean_absolute_error:', metrics.mean_absolute_error(y_test, y_pred))
print('mean_squared_error:', metrics.mean_squared_error(y_test, y_pred))
{'fraction_non_alphanumeric': 0.1275011633317822, 'fraction_numerical': 0.02047463936714751, 'mean_word_length': 6.6512455516014235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '1964901', 'n_tokens_mistral': 821, 'n_tokens_neox': 795, 'n_words': 161}