Skip to content

Commit

Permalink
Merge pull request #10 from ThiagoPanini/docs-linreg
Browse files Browse the repository at this point in the history
Updating docs on LinearRegressor class on trainer module
  • Loading branch information
Thiago Panini authored May 11, 2021
2 parents 4e1fd47 + 67f7e04 commit 102d13f
Show file tree
Hide file tree
Showing 22 changed files with 706 additions and 651 deletions.
14 changes: 7 additions & 7 deletions examples/linear_regression/linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer
from mlcomposer.transformers import FiltraColunas, ModificaTipoPrimitivo, \
EliminaDuplicatas, DynamicLogTransformation, DynamicScaler, \
DummiesEncoding, AgrupamentoCategoricoFinal, LogTransformation
from mlcomposer.transformers import ColumnSelection, DtypeModifier, \
DropDuplicates, DynamicLogTransformation, DynamicScaler, \
DummiesEncoding, CategoricalMapper, LogTransformation

# Modelagem dos dados
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression, Lasso, Ridge, ElasticNet
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestRegressor
from mlcomposer.trainer import RegressorLinear
from mlcomposer.trainer import LinearRegressor


"""
Expand Down Expand Up @@ -112,8 +112,8 @@

# Pipeline inicial de preparação de dados
initial_prep_pipeline = Pipeline([
('col_filter', FiltraColunas(features=INITIAL_FEATURES)),
('cat_agrup', AgrupamentoCategoricoFinal(cat_dict=CAT_GROUP_DICT, other_tag=OTHER_TAG)),
('col_filter', ColumnSelection(features=INITIAL_FEATURES)),
('cat_agrup', CategoricalMapper(cat_dict=CAT_GROUP_DICT, other_tag=OTHER_TAG)),
('log_target', LogTransformation(cols_to_log=TARGET))
])

Expand Down Expand Up @@ -276,7 +276,7 @@
"""

# Instanciando trainer e aplicando treinamento
trainer = RegressorLinear()
trainer = LinearRegressor()

# Realizando treinamento e avaliação dos modelos
trainer.training_flow(set_regressors, X_train_prep, y_train, X_val_prep, y_val,
Expand Down
Binary file modified examples/linear_regression/output/imgs/feature_importances.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions examples/linear_regression/output/metrics/metrics.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
model,approach,mae,mse,rmse,r2,total_time,anomesdia_datetime
LinearRegression,Treino 5 K-folds,0.096,0.043,0.188,0.713,0.922,2021-04-21 20:59:16.814030
LinearRegression,Validation set,0.092,0.019,0.139,0.896,0.002,2021-04-21 20:59:16.814030
DecisionTreeRegressor,Treino 5 K-folds,0.152,0.047,0.216,0.686,0.486,2021-04-21 20:59:16.814030
DecisionTreeRegressor,Validation set,0.147,0.042,0.206,0.773,0.001,2021-04-21 20:59:16.814030
Lasso,Treino 5 K-folds,0.189,0.065,0.254,0.572,0.213,2021-04-21 20:59:16.814030
Lasso,Validation set,0.201,0.08,0.283,0.569,0.003,2021-04-21 20:59:16.814030
Ridge,Treino 5 K-folds,0.091,0.02,0.14,0.871,0.244,2021-04-21 20:59:16.814030
Ridge,Validation set,0.094,0.019,0.138,0.898,0.006,2021-04-21 20:59:16.814030
ElasticNet,Treino 5 K-folds,0.184,0.062,0.248,0.592,0.192,2021-04-21 20:59:16.814030
ElasticNet,Validation set,0.194,0.074,0.272,0.604,0.006,2021-04-21 20:59:16.814030
LinearRegression,Treino 5 K-folds,0.096,0.043,0.188,0.713,0.839,2021-05-10 23:14:37.989762
LinearRegression,Validation set,0.092,0.019,0.139,0.896,0.008,2021-05-10 23:14:37.989762
DecisionTreeRegressor,Treino 5 K-folds,0.152,0.047,0.216,0.686,0.468,2021-05-10 23:14:37.989762
DecisionTreeRegressor,Validation set,0.147,0.042,0.206,0.773,0.001,2021-05-10 23:14:37.989762
Lasso,Treino 5 K-folds,0.189,0.065,0.254,0.572,0.19,2021-05-10 23:14:37.989762
Lasso,Validation set,0.201,0.08,0.283,0.569,0.019,2021-05-10 23:14:37.989762
Ridge,Treino 5 K-folds,0.091,0.02,0.14,0.871,0.285,2021-05-10 23:14:37.989762
Ridge,Validation set,0.094,0.019,0.138,0.898,0.01,2021-05-10 23:14:37.989762
ElasticNet,Treino 5 K-folds,0.184,0.062,0.248,0.592,0.298,2021-05-10 23:14:37.989762
ElasticNet,Validation set,0.194,0.074,0.272,0.604,0.013,2021-05-10 23:14:37.989762
528 changes: 264 additions & 264 deletions examples/linear_regression/output/metrics/top_features.csv

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
774 changes: 405 additions & 369 deletions mlcomposer/trainer.py

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,42 @@ cffi==1.14.5
chardet==4.0.0
colorama==0.4.4
cryptography==3.4.7
cycler==0.10.0
docutils==0.17
idna==2.10
importlib-metadata==3.10.1
jeepney==0.6.0
joblib==0.14.1
keyring==23.0.1
kiwisolver==1.3.1
llvmlite==0.36.0
matplotlib==3.4.1
-e git+https://github.com/ThiagoPanini/pylearn.git@913f7e6fe7069232cccb14fe7b1afcec1a2b1a3f#egg=mlcomposer
numba==0.53.1
numpy==1.18.5
packaging==20.9
pandas==1.1.5
Pillow==8.2.0
pkg-resources==0.0.0
pkginfo==1.7.0
pycparser==2.20
Pygments==2.8.1
pyparsing==2.4.7
python-dateutil==2.8.1
python-dotenv==0.17.0
pytz==2021.1
readme-renderer==29.0
requests==2.25.1
requests-toolbelt==0.9.1
rfc3986==1.4.0
scikit-learn==0.23.2
scipy==1.6.2
seaborn==0.10.0
SecretStorage==3.3.1
shap==0.37.0
six==1.15.0
slicer==0.0.3
threadpoolctl==2.1.0
tqdm==4.60.0
twine==3.4.1
urllib3==1.26.4
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# Criando setup
setup(
name='mlcomposer',
version='0.0.11',
version='0.1.0',
author='Thiago Panini',
author_email='thipanini94@gmail.com',
packages=find_packages(),
Expand Down

0 comments on commit 102d13f

Please sign in to comment.