Error When Applying Random Forest + ECFP4 to ChEMBL 5thresh Subset
- Dominant language
- Python
- Stars
- 7k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
## 🐛 Bug
Happy New Year!
I encountered the following error when applying random forest + ECFP4 to ChEMBL 5thresh subset.
> File "/home/ubuntu/anaconda3/envs/deepchem/lib/python3.6/site-packages/sklearn/utils/validation.py", line 196, in _num_samples
" a valid collection." % x)
TypeError: Singleton array array(138.18465906) cannot be considered a valid collection.
To reproduce the error, you can use the following code snippet.
```python
import deepchem as dc
import numpy as np
from deepchem.molnet import load_chembl
from sklearn.ensemble import RandomForestRegressor
tasks, all_dataset, transformers = load_chembl(featurizer='ECFP', splitter='scaffold',
set='5thresh', reload=False)
train_set, val_set, test_set = all_dataset
metric = dc.metrics.Metric(dc.metrics.rms_score, np.mean)
def rf_model_builder(model_dir):
sklearn_model = RandomForestRegressor(
n_estimators=10,
criterion='mae',
min_samples_split=32,
bootstrap=False)
return dc.models.SklearnModel(sklearn_model)
model = dc.models.SingletaskToMultitask(tasks, rf_model_builder)
model.fit(train_set)
```
@peastman Can you take a look? Thanks.
## Environment
* OS: Linux
* Python version: 3.6
* DeepChem version: Master
* RDKit version (optional):
* TensorFlow version (optional):
* PyTorch version (optional):
* Any other relevant information:
Contributor guide
Assessment
This issue has not been assessed yet.