Skip to content
项目

关于

XCSF learning classifier system: rule-based online evolutionary machine learning

人工智能与机器学习

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
0

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

XCSF learning classifier system

Latest Version PyPI package Linux Build MacOS Build Windows Build DOI

XCSF is an accuracy-based learning classifier system for online supervised and reinforcement learning. Rather than fitting a single global model, it uses an evolutionary algorithm to design a population of rules, each of which matches a region of the input space and predicts with its own simple model (for example, a linear regression or a small neural network).

This repository provides a C implementation that can be built as a stand-alone binary or used as a Python library with a scikit-learn-style interface. See the project wiki for features, build instructions, and usage.

Quick start

Installation

pip install xcsf

Minimal example

Fit y = sin(2πx) using local linear models:

import numpy as np
import xcsf


def f(x):
    return np.sin(2 * np.pi * x)


rng = np.random.default_rng(1)
X_train = rng.random((1000, 1))
X_test = np.linspace(0, 1, 200).reshape(-1, 1)

xcs = xcsf.XCS(
    x_dim=1,
    y_dim=1,
    n_actions=1,
    pop_size=500,
    max_trials=20000,
    random_state=1,
    loss_func="mse",
    e0=0.0001,
    alpha=1,
    prediction={"type": "rls_linear"},
)

xcs.fit(X_train, f(X_train), verbose=False)
print(f"Test MSE: {xcs.score(X_test, f(X_test)):.1e}")  # ~3.1e-05

For more Python examples, see the python folder, which contains scripts and the equivalent notebooks.

Contributing

Contributions to this repository are very welcome.

See our contributing guide for details.

探索相关项目

加载中…