Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preprocessing.StandardScaler.learn_one returns None #1608

Open
arevalirio opened this issue Sep 5, 2024 · 1 comment
Open

preprocessing.StandardScaler.learn_one returns None #1608

arevalirio opened this issue Sep 5, 2024 · 1 comment

Comments

@arevalirio
Copy link

Versions

river version: 0.21.2
Python version: 3.9.19
Operating system: Windows 10 22H2

Describe the bug

The preprocessing.StandardScaler.learn_one method returns None

Steps/code to reproduce

# Sample code to reproduce the problem
# Please do your best to provide a Minimal, Reproducible Example: https://stackoverflow.com/help/minimal-reproducible-example

import random
from river import preprocessing

random.seed(42)
X = [{'x': random.uniform(8, 12), 'y': random.uniform(8, 12)} for _ in range(6)]
for x in X:
print(x)

scaler = preprocessing.StandardScaler(with_std=False)

for x in X:
scaler.learn_one(x).transform_one(x)

@MaxHalford
Copy link
Member

This is expected. You have to do this:

import random
from river import preprocessing

random.seed(42)
X = [{'x': random.uniform(8, 12), 'y': random.uniform(8, 12)} for _ in range(6)]
for x in X:
    print(x)

scaler = preprocessing.StandardScaler(with_std=False)

for x in X:
    scaler.learn_one(x)
    scaler.transform_one(x)

I hope this is ok 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants