Registry / ai-ml / dask-ml

dask-ml

JSON →
library2025.1.0pypypi✓ verified 86d ago

A library for distributed and parallel machine learning built on top of Dask and scikit-learn. Current version is 2025.1.0, with releases roughly a few times a year.

pip install dask-ml
INSTALL
IMPORT
SIG · DASK-ML
D
dask-ml
ai-mlpythonv2025.1.0
Install
22.6s avg
Import
7684ms
Disk
730MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2025.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 22.6s · import 7.684s · 717MB
730MB installed
● package 730MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LogisticRegression
from dask_ml.linear_model import LogisticRegression
from dask_ml.models import LogisticRegression
wrong module path
train_test_split
from dask_ml.model_selection import train_test_split
from sklearn.model_selection import train_test_split
sklearn's API returns numpy arrays
preprocessing
from dask_ml.preprocessing import StandardScaler
from sklearn.preprocessing import StandardScaler
sklearn's StandardScaler does not work on Dask arrays

Basic usage: load data with Dask, split, train a logistic regression model, and compute accuracy.

import dask.dataframe as dd from dask_ml.linear_model import LogisticRegression from dask_ml.model_selection import train_test_split # Create a Dask DataFrame from a CSV df = dd.read_csv('data.csv') X = df[['feature1', 'feature2']].to_dask_array(lengths=True) y = df['label'].to_dask_array(lengths=True) # Train-test split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) # Fit model model = LogisticRegression() model.fit(X_train, y_train) # Score accuracy = model.score(X_test, y_test) print(accuracy.compute())
Debug
Known issues
breakingdask-ml 2024.3.20+ requires dask-expr; old dataframes from dask<2024.3 may break.
fix
Update dask to latest or pin dask-ml<2024.3.20.
affects: >=2024.3.20
deprecateddask_ml.cluster.KMeans is deprecated; use dask_ml.cluster.KMeans from dask-ml but it's being replaced by dask array's native k-means.
fix
Consider using sklearn's KMeans on dask arrays via map_blocks.
affects: >=2025.1.0
gotchatrain_test_split from dask_ml.model_selection requires Dask DataFrames; passing pandas DataFrame gives unexpected results.
fix
Convert pandas DataFrame to dask DataFrame using dask.dataframe.from_pandas() before splitting.
affects: all
gotchaMany estimators do not support Dask arrays with unknown chunk sizes; call .compute_chunk_sizes() first.
fix
Call .compute_chunk_sizes() on the Dask array before fitting.
affects: all
Errors
Common errors & fixes
ValueError: could not broadcast input array from shape (X,) into shape (Y,)
Mismatched chunk sizes in Dask array during fit.
fix
Ensure all input Dask arrays have known chunk sizes: X = X.compute_chunk_sizes()
TypeError: Only Dask DataFrames are supported; got pandas DataFrame
Passed a pandas DataFrame to dask_ml.model_selection functions.
fix
Convert using ddf = dask.dataframe.from_pandas(df, npartitions=...)
ModuleNotFoundError: No module named 'dask_ml.models'
Wrong import path for estimators.
fix
Use correct submodule, e.g., from dask_ml.linear_model import LogisticRegression
Upgrade
Version history
2025.1.0latest on PyPI · released Feb 8, 2025
Audit
Dependencies
daskrequiredcore distributed computing framework
scikit-learnrequiredAPI compatibility and underlying algorithms
pandasrequireddata handling
numpyrequiredarray operations
distributedoptionaloptional distributed scheduler
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
dask-ml — pip install dask-ml · libregistry