Please do not mark this as a duplicate of how to call python and sklearn from matlab? as the question is in my opinion not really answered.
Since Matlab Release R2014b I think, it is possible to directly use python from matlab.
In short words, you only have to place py
in front of the python call.
I my setup (after giving matlab the python path with the command pyversion('PATH_TO_PYTHON')
, that is running fine. I can even use dask
multiprocessing. Quite cool. For example, executing py.dask.distributed.Client
results in
Python Client with properties:
asynchronous: 0
cluster: [1×1 py.distributed.deploy.local.LocalCluster]
get_futures_error: [1×1 py.method]
coroutines: [1×1 py.list]
scheduler_file: [1×1 py.NoneType]
loop: [1×1 py.tornado.platform.select.SelectIOLoop]
recreate_error_locally: [1×1 py.method]
refcount: [1×1 py.collections.defaultdict]
extensions: [1×1 py.dict]
scheduler: [1×1 py.distributed.core.rpc]
rpc: [1×1 py.distributed.core.ConnectionPool]
futures: [1×1 py.dict]
scheduler_comm: [1×1 py.distributed.batched.BatchedSend]
status: [1×7 py.str]
connection_args: [1×1 py.dict]
id: [1×43 py.str]
generation: [1×1 py.int]
io_loop: [1×1 py.tornado.platform.select.SelectIOLoop]
security: [1×1 py.distributed.security.Security]
<Client: scheduler='tcp://127.0.0.1:59795' processes=4 cores=4>
Coming back to the question: I have sklearn installed and can use it from the referenced python Installation. It is working the same way as dask. But MATLAB R2017a is not able to find sklearn.
A similiar call to the given above py.sklearn.cluster.dbscan
results in
Undefined variable "py" or class "py.sklearn.cluster.dbscan".
Is there any python expert being able to explain?