local variable 'nb_epoch' referenced before assignment for benchmark xgb model on qm9
See original GitHub issueHi,
I am trying to run a XGBoost model on the qm9 dataset, but I run into a “UnboundLocalError: local variable ‘nb_epoch’ referenced before assignment”. The other error that I have run into is there is a 1 missing positional argument with model.
I am trying to run a linear regression.
Code:
import deepchem as dc
from deepchem.molnet import load_qm9
tasks, datasets, transformers = dc.molnet.load_qm9(featurizer= dc.feat.CoulombMatrixEig(max_atoms=50))
train_dataset, valid_dataset, test_dataset = datasets
metric = dc.metrics.Metric(dc.metrics.mae_score)
train_scores, valid_scores, test_scores = benchmark_regression(train_dataset = train_dataset, valid_dataset = valid_dataset, test_dataset = test_dataset, tasks = tasks, transformers = transformers, n_features = 2, metric = metric, model = "xgb_regression")
For reference, I am using the benchmark regression found here: https://github.com/deepchem/deepchem/blob/2313f885cb86a87167e99b875d706abdc6526c35/deepchem/molnet/run_benchmark_models.py#L346
I am using a jupyter notebook, and had ran the benchmark_regression function code in a separate cell. For the function code, I replaced import xgboost xgboost_model = xgboost.XGBRegressor(
with from deepchem.models.gbdt_models.gbdt_model import GBDTModel xgboost_model = GBDTModel(
due to a prior deprecation in line 736.
On a side note, what would be the correct number of features?
Issue Analytics
- State:
- Created 10 months ago
- Comments:6
Top GitHub Comments
Hi @dgodin19. There is a minor fix in your approach. dc_model should be defined as an XGboost model wrapped using GBDTModel instead of wrapping LinearRegression() in SklearnModel. Also, n_features is an optional argument. which is set to 0 by default. It is usually used when users use their own featurizers. Do let me know if you face any errors after making the change. Thank you for pointing out the change in run_benchmark_models.py, appreciate your input.
Hi @maithili232 ,
I still run into “ValueError: GBDTModel is not a supported model instance” with the given snippet.