Skip to content
Projects

xcsf-dev/xcsf has 37 GitHub stars and 14 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-09 20:49 UTC. Last push 2026-11-03.

How these counts are measured

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

Measured star growth

in 24h
0
in 7 days
Update delayed
in 15 days
Update delayed
in 1 month
Update delayed

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

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.

Explore related projects