From 269b4c59fcb12d1c24fea7b9e15c7b63aa9939e0 Mon Sep 17 00:00:00 2001 From: Eduardo Carvalho Date: Wed, 4 Dec 2019 09:33:23 +0100 Subject: [PATCH] fix: regression gpu integration an typos --- pytorch_tabnet/tab_model.py | 4 ++-- regression_example.ipynb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pytorch_tabnet/tab_model.py b/pytorch_tabnet/tab_model.py index e430ad87..97bd37c2 100644 --- a/pytorch_tabnet/tab_model.py +++ b/pytorch_tabnet/tab_model.py @@ -502,7 +502,7 @@ def train_batch(self, data, targets): batch_outs = {'loss': loss_value, 'y_preds': output, 'y': targets, - 'batch_importance': M_explain.sum(dim=0).detach().numpy()} + 'batch_importance': M_explain.sum(dim=0).cpu().detach().numpy()} return batch_outs def predict_epoch(self, loader): @@ -774,7 +774,7 @@ def train_batch(self, data, targets): batch_outs = {'loss': loss_value, 'y_preds': output, 'y': targets, - 'batch_importance': M_explain.sum(dim=0).detach().numpy()} + 'batch_importance': M_explain.sum(dim=0).cpu().detach().numpy()} return batch_outs def predict_epoch(self, loader): diff --git a/regression_example.ipynb b/regression_example.ipynb index 713c4d08..c4ccb9f0 100644 --- a/regression_example.ipynb +++ b/regression_example.ipynb @@ -279,7 +279,7 @@ " n_estimators=1000,\n", " verbosity=0,\n", " silent=None,\n", - " objective='binary:logistic',\n", + " objective='reg:linear',\n", " booster='gbtree',\n", " n_jobs=-1,\n", " nthread=None,\n", @@ -310,11 +310,11 @@ "outputs": [], "source": [ "preds = np.array(clf_xgb.predict(X_valid))\n", - "valid_auc = mean_squared_error(y_pre=preds, y_true=y_valid)\n", + "valid_auc = mean_squared_error(y_pred=preds, y_true=y_valid)\n", "print(valid_auc)\n", "\n", "preds = np.array(clf_xgb.predict(X_test))\n", - "test_auc = mean_squared_error(y_pre=preds, y_true=y_test)\n", + "test_auc = mean_squared_error(y_pred=preds, y_true=y_test)\n", "print(test_auc)" ] }