{"library":"river","title":"River","description":"River is a Python library for online machine learning, stream processing, and incremental learning. It provides a comprehensive set of estimators, transformers, and metrics that process data one sample at a time, with built-in drift detection and model evaluation. Current version 0.24.2, released irregularly (several releases per year).","language":"python","status":"active","last_verified":"Mon Apr 27","install":{"commands":["pip install river"],"cli":null},"imports":["from river import metrics","from river import linear_model"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom river import stream, linear_model, metrics, preprocessing\n\n# Simulate a stream of data (dicts)\nX_y = [\n    ({'a': 1, 'b': 2}, 3.0),\n    ({'a': 4, 'b': 5}, 9.0),\n    ({'a': 7, 'b': 8}, 15.0),\n]\n\nmodel = preprocessing.StandardScaler() | linear_model.LinearRegression()\nmetric = metrics.MAE()\n\nfor x, y in stream.iter_array(X_y):  # stream.iter_array expects tuples (x_dict, y)\n    y_pred = model.predict_one(x)\n    if y_pred is not None:\n        metric.update(y, y_pred)\n    model.learn_one(x, y)\n\nprint(f'MAE: {metric.get():.4f}')","lang":"python","description":"Basic online learning with a pipeline and metric.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}