xpflow

raw JSON →
0.8 verified Sat May 09 auth: no python

A lightweight Python library for representing and managing machine learning experiments with class-based definitions. Current version 0.8, updated infrequently.

pip install xpflow
error AttributeError: 'MyExperiment' object has no attribute 'run'
cause Experiment subclass missing a 'run' method, or method signature mismatch.
fix
Define a 'run(self)' method in your experiment class.
error TypeError: run() missing 1 required positional argument: 'xp'
cause run() called without an experiment instance.
fix
Call run(experiment_instance) instead of run().
gotcha Experiment class attributes must be type-annotated; untyped attributes may be ignored or cause errors.
fix Always annotate fields with types (e.g., int, str, float).
gotcha The run() function expects an instance of Experiment, not a class. Passing the class itself will raise an AttributeError.
fix Instantiate the experiment class before passing to run: run(MyExperiment())
deprecated The 'sequential' decorator introduced in v0.3 was removed in v0.8. Code using it will break.
fix Remove @sequential decorator; use class-based inheritance instead.

Define an experiment as a class inheriting from Experiment, then call run() to execute.

from xpflow import Experiment, Xp, run

class MyExperiment(Experiment):
    hyperparam1: int = 10
    hyperparam2: str = "default"

    def run(self):
        return self.hyperparam1 * len(self.hyperparam2)

if __name__ == "__main__":
    xp = MyExperiment()
    result = run(xp)
    print(result)