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

Add river online ML package #218

Merged
merged 1 commit into from
Mar 2, 2025
Merged

Add river online ML package #218

merged 1 commit into from
Mar 2, 2025

Conversation

BurnySc2
Copy link
Contributor

  • Add river package
  • Fix poetry version to <2.0.0 because export command has been moved to a poetry plugin
Requirements Changes Report
=========================

New Packages:
------------
river: 0.22.0

@BurnySc2 BurnySc2 requested a review from lladdy January 26, 2025 12:53
@vschmidt91
Copy link

vschmidt91 commented Jan 26, 2025

Some quick-and-dirty performance results from the ladder.

Setup:

  • example river model (1000+ params, see below)
  • run 10 training steps per game iteration
  • client.game_step = 2

Code

model = (
    pp.StandardScaler() |
    nn.MLPRegressor(
        hidden_dims=(30,),
        activations=(
            nn.activations.ReLU,
            nn.activations.ReLU,
            nn.activations.Identity
        ),
        optimizer=optim.SGD(1e-3),
        seed=42
    )
)

def on_step():

    # ...

    start = time.time()
    for _ in range(10):
        xb = pd.DataFrame(np.random.uniform(size=(10, 100)))
        yb = pd.DataFrame(np.random.uniform(size=(10, 10)))
        y_pred = model.predict_many(xb)
        model.learn_many(xb, yb)

    model.predict_many(xb)
    end = time.time()
    print(f"model training took: {round((end - start) * 1000, 3)}ms")

Results

https://aiarena.net/matches/3538285/
https://aiarena.net/matches/3538286/
https://aiarena.net/matches/3538287/

Average frametime (reported by AIArena): 14-16 ms
Min-Max frametime (measured): 10-20 ms

@lladdy
Copy link
Contributor

lladdy commented Jan 28, 2025

Nice, thanks for the writeup @vschmidt91.
Looks good to me.

@lladdy lladdy merged commit 3fdfdd4 into master Mar 2, 2025
1 check passed
@lladdy lladdy deleted the add-river-package branch March 2, 2025 13:43
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

Successfully merging this pull request may close these issues.

3 participants