Interactive Mode

To enable practical research and development of ForML projects, the framework allows as one of its execution mechanisms to compose and operate its workflows interactively. Generally, this can be utilized within REPL (read-evaluate-print-loop) based terminals or more typically using high-level frontend interfaces like the popular Jupyter notebooks.


ForML still remains grounded in the code-first principle of implementing the ML solution as a software project as opposed to some of the native notebook-first-oriented methodologies. The interactive mode is designed primarily for exploration rather than the implementation of the eventual solution.

This chapter describes the individual tools allowing to use ForML interactively. Please refer to the tutorials for actual examples demonstrating this principle in action.

Project Handle

To operate ForML projects interactively, the framework provides the following programmatic interface allowing one to access the project.Artifact handle using either the function or interactively binding any project.Source instance with a custom pipeline using the .bind() method. str | Path | None = None, package: str | None = None, **modules: Any) Artifact[source]

Getting a programmatic handle to a local ForML project.

path: str | Path | None = None

File system path to the project source package root.

package: str | None = None

Project package name.

**modules: Any

Project component module path mappings.


Project artifact.

class forml.project.Artifact(path: str | Path | None = None, package: str | None = None, **modules: Any)[source]

Project artifact handle.

property components : project.Components

Tuple of all the individual principal components from this project artifact.


Tuple of the project principal components.

property launcher : runtime.Virtual

A runtime launcher configured with a volatile registry preloaded with this artifact.

This can be used to interactively execute the particular actions of the project development life cycle. The linked volatile registry is persistent only during the lifetime of this artifact instance.

See also

See the runtime.Virtual pseudo runner for more details regarding the launcher API.


Virtual launcher instance.

Virtual Launcher

The Virtual launcher represents one of the possible execution mechanisms. It is a wrapper around the low-level runner and feed concepts designed specifically for interactive operations (internally it is also used by the testing framework).

class forml.runtime.Virtual(artifact: project.Artifact)[source]

Custom launcher allowing to execute the provided artifact using the default or an explicit runner in combination with a special pipeline sink to capture and return any output produced by the given action.

All states produced while executing the launcher actions are (temporarily) persisted in an internal model registry implemented by the Volatile provider.

artifact: project.Artifact

Project artifact to be launched.

The available launcher actions are exposed using the following common triggers:

train(lower=None, upper=None) runtime.Virtual.Trained

Trigger the train action.


Accessor of the train-mode features/outcomes outputs.

tune(lower=None, upper=None) None

Trigger the tune action.

apply(lower=None, upper=None) flow.Features

Trigger the apply action.


The apply-mode output.

eval(lower=None, upper=None) float

Trigger the (train-test) eval action.


Evaluation metric value.

Furthermore, these triggers can be accessed using three different approaches:

  1. Directly on the launcher instance:

    >>> launcher_instance.eval()
  2. Using a getitem syntax specifying an explicit runner provider:

    >>> launcher_instance['graphviz'].train()
  3. Using a call syntax specifying both an explicit runner and a list of source feeds providers:

    >>> launcher_instance('dask', ['openlake']).apply()
    [0.31, 0.63, 0.16, 0.87]
class Trained(future: Future)[source]

Lazy accessor of the virtual train-mode features/outcomes segment outputs as returned by the runtime.Virtual.train method.

property features : flow.Features

Get the train-mode features segment values.

property labels : flow.Labels

Get the train-mode labels segment values.