dask / dask/dask-ml

make_classification_df date functionality has single repeated value

Open
#845 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
951
Forks
262
PR merge metrics
No merged PRs in 30d

Description

**What happened**:
When running `dask_ml.datasets.make_classification_df` with a date range, the generated date column only has a *single value*, duplicated to length `chunks` (not `n_samples` as expected)

This seems to all be related to [this line here](https://github.com/dask/dask-ml/blob/3ef1c84fe02889d354247f72f476ae49a42bf321/dask_ml/datasets.py#L454) where it creates an array of length `len(X_df)` from a single value generated by [datasets.random_date](https://github.com/dask/dask-ml/blob/3ef1c84fe02889d354247f72f476ae49a42bf321/dask_ml/datasets.py#L384)

**What you expected to happen**:
we should be seeing
- *many* randomly selected dates from within the date range `dates`
- the date column should be of length `n_samples`, not `chunks`

**Minimal Complete Verifiable Example**:

```python
from dask_ml.datasets import make_classification_df
from datetime import date

X, y = make_classification_df(
n_samples=100,
n_features=5,
random_state=123,
chunks=10,
dates=(date(2020, 1, 1), date(2021, 1, 1)),
)

X["date"].compute().value_counts()
```

returns

```
2020-02-27 10
Name: date, dtype: int64
```

**Anything else we need to know?**:

**Environment**:

- Dask version: 2021.7.1
- Python version: 3.9.6
- Operating System: linux (ubuntu)
- Install method (conda, pip, source): pip

Contributor guide

Open the contributing guide

Research direction

Run the provided make_classification_df example and inspect dask_ml/datasets.py around random_date and the date-column handling near line 454. Confirm the fix produces randomly selected dates across the requested range and a date column with n_samples rows rather than chunks rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.