Skip to content

Commit

Permalink
style: format code with Autopep8, Black, ClangFormat, dotnet-format, …
Browse files Browse the repository at this point in the history
…Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf

This commit fixes the style issues introduced in 53d59f0 according to the output
from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java
Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt,
Scalafmt, StandardJS, StandardRB, swift-format and Yapf.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored May 11, 2024
1 parent 53d59f0 commit 4ebb53c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions learning_improvement/model_training.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import xgboost as xgb
from sklearn.model_selection import train_test_split


class ModelTraining:
def __init__(self, data, target_column):
self.data = data
Expand All @@ -13,21 +14,29 @@ def train_model(self, model_file):
X = self.data.drop(self.target_column, axis=1)
y = self.data[self.target_column]

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)

dtrain = xgb.DMatrix(X_train, label=y_train)
dtest = xgb.DMatrix(X_test, label=y_test)

params = {
'objective': 'reg:squarederror',
'eval_metric': 'rmse',
'max_depth': 6,
'eta': 0.1,
'subsample': 0.8,
'colsample_bytree': 0.8
"objective": "reg:squarederror",
"eval_metric": "rmse",
"max_depth": 6,
"eta": 0.1,
"subsample": 0.8,
"colsample_bytree": 0.8,
}

model = xgb.train(params, dtrain, num_boost_round=1000, evals=[(dtest, 'test')], early_stopping_rounds=50)
model = xgb.train(
params,
dtrain,
num_boost_round=1000,
evals=[(dtest, "test")],
early_stopping_rounds=50,
)

model.save_model(model_file)

Expand Down

0 comments on commit 4ebb53c

Please sign in to comment.