dask / dask/dask-ml

Can support score_samples of sklearn.neighbors.KernelDensity in dask_ml.wrappers.ParallelPostFit?

Open
#905 1 comment 0 reactions 0 assignees View on GitHub
Needs Info
Dominant language
Python
Stars
951
Forks
262
PR merge metrics
No merged PRs in 30d

Description

When I run these code will rasie the error, can support score_samples of sklearn.neighbors.KernelDensity in dask_ml.wrappers.ParallelPostFit or
I can do what I need by referring to other code in dask_ml.wrappers and by adding some new code (and ensuring the correct xign of the result)?
```python
from dask.distributed import Client
import joblib
from sklearn.neighbors import KernelDensity
from dask_ml.wrappers import ParallelPostFit
from numpy.random import randint

data = randint(0, 100, (10000, 1))
clf = ParallelPostFit(estimator=KernelDensity())
client = Client(processes=False)
with joblib.parallel_backend('dask'):
clf.fit(data)
d2 = clf.score_samples(data)
```

I get the 'ParallelPostFit' object has no attribute 'score_samples' error.
```python
Traceback (most recent call last):
File "D:\JetBrains\PyCharm 2021.2.3\plugins\python\helpers\pydev\pydevd.py", line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\JetBrains\PyCharm 2021.2.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/~/~/MVABTest.py", line 12, in
d2 = clf.score_samples(data)
AttributeError: 'ParallelPostFit' object has no attribute 'score_samples'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.