Saltar al contenido principal

Modelos Soportados

godml incluye una librería de modelos listos para usar. Configura el tipo con model.type en el YAML.

Resumen

model.typeAlgoritmoTareaMLflowSageMaker
xgboostXGBoostClasificación / Regresión
random_forestRandomForestClasificación / Regresión
logistic_regressionLogistic RegressionClasificación
lightgbmLightGBMClasificación / Regresión
lstmLSTM (Keras)Series de tiempo
linear_regressionLinear RegressionRegresión

XGBoost

model:
type: xgboost
hyperparameters:
max_depth: 6
eta: 0.3 # learning rate
n_estimators: 200
objective: binary:logistic # o reg:squarederror para regresión
random_state: 42

Random Forest

model:
type: random_forest
hyperparameters:
n_estimators: 100
max_depth: 10 # null = sin límite
max_features: sqrt # sqrt | log2 | null
random_state: 42

Logistic Regression

model:
type: logistic_regression
hyperparameters:
random_state: 42
# max_iter: 1000 — configurado internamente

LightGBM

model:
type: lightgbm
hyperparameters:
n_estimators: 200
max_depth: -1 # -1 = sin límite
random_state: 42

Requiere:

pip install godml[advisor] # incluye lightgbm

LSTM (Series de tiempo)

model:
type: lstm
hyperparameters:
eta: 0.001 # learning rate
n_estimators: 50 # epochs
random_state: 42

Requiere:

pip install godml[deep] # incluye TensorFlow + Keras

AutoTuner

godml ajusta hiperparámetros automáticamente según el dataset antes de entrenar:

model:
type: xgboost
hyperparameters:
max_depth: 6 # punto de partida — el AutoTuner puede ajustarlo

Reglas del AutoTuner:

  • Dataset desbalanceado: ajusta scale_pos_weight automáticamente
  • Dataset pequeño (<500 filas): reduce n_estimators para evitar overfitting
  • Multiclase detectada: cambia objective a multi:softmax

Modelo personalizado

Puedes usar tu propio modelo implementando BaseModel:

mi_modelo.py
from godml.model_service.base_model_interface import BaseModelInterface

class MiModelo(BaseModelInterface):
def train(self, X_train, y_train, X_test, y_test, params):
# tu lógica aquí
model = ...
predictions = ...
return model, predictions
model:
type: mi_modelo
source: local # busca en el proyecto actual

Métricas calculadas automáticamente

Para clasificación binaria:

  • auc — Area Under ROC Curve
  • accuracy — Exactitud
  • f1 — F1-Score
  • precision — Precisión
  • recall — Exhaustividad

Ejemplo: Churn Classification