Skip to content

apollon.pool

pool

The pool of intrusion detection classifiers that Apollon selects from.

Every arm of the bandit is a scikit-learn classifier. The default pool is the one used in the paper: Random Forest, Decision Tree, Gaussian Naive Bayes, Logistic Regression and a Multi-Layer Perceptron. Any other classifier with fit/predict/predict_proba can be added.

make_arm

make_arm(name: str, random_state: int | None = None) -> ClassifierMixin

Build one unfitted arm from its short name (see :data:ARMS).

Source code in src/apollon/pool.py
def make_arm(name: str, random_state: int | None = None) -> ClassifierMixin:
    """Build one unfitted arm from its short name (see :data:`ARMS`)."""
    try:
        return ARMS[name.upper()](random_state)
    except KeyError:
        raise ValueError(f"unknown arm {name!r}; available: {', '.join(ARMS)}") from None

make_pool

make_pool(names: Iterable[str] = DEFAULT_POOL, random_state: int | None = None) -> list[ClassifierMixin]

Build a pool of unfitted arms from their short names.

Source code in src/apollon/pool.py
def make_pool(
    names: Iterable[str] = DEFAULT_POOL, random_state: int | None = None
) -> list[ClassifierMixin]:
    """Build a pool of unfitted arms from their short names."""
    return [make_arm(n, random_state) for n in names]

default_arms

default_arms(random_state: int | None = None) -> list[ClassifierMixin]

The classifier pool of the paper: RF, DT, NB, LR and MLP.

Source code in src/apollon/pool.py
def default_arms(random_state: int | None = None) -> list[ClassifierMixin]:
    """The classifier pool of the paper: RF, DT, NB, LR and MLP."""
    return make_pool(DEFAULT_POOL, random_state)