ictonyx.loggers
MLflow and other experiment logging integrations.
- class ictonyx.loggers.BaseLogger(verbose=True, print_params=False, print_metrics=False)[source]
Bases:
objectBase experiment logger with in-memory history tracking.
Stores parameters and per-step metrics in a history dict. All
log_*methods for artifacts, models, and figures are no-ops in the base class — subclasses (e.g.MLflowLogger) override them to persist data to external systems.This class is used as the default logger when no tracker is passed to
ExperimentRunner.- Parameters:
- history
Dict with keys
'params'(Dict) and'metrics'(List of{'key', 'value', 'step'}dicts).
- log_artifact(artifact_path, artifact_name=None)[source]
Logs an artifact (file) - base implementation does nothing.
- log_model(model, artifact_path='model')[source]
Logs a model - base implementation does nothing.
- Parameters:
artifact_path (str)
- log_figure(figure, artifact_name)[source]
Logs a matplotlib figure - base implementation does nothing.
- Parameters:
artifact_name (str)
- class ictonyx.loggers.MLflowLogger(run_name=None, experiment_name='ictonyx_experiment', tracking_uri=None, verbose=True)[source]
Bases:
BaseLoggerExperiment logger backed by MLflow.
Extends
BaseLoggerto persist parameters, metrics, artifacts, models, and figures to an MLflow tracking server. Creates a new MLflow run on initialization and ends it onend_run().Requires
mlflow. Install withpip install mlflow.- Parameters:
run_name (str | None) – Optional display name for this MLflow run.
experiment_name (str) – MLflow experiment name. Created if it does not exist. Default
'ictonyx_experiment'.tracking_uri (str | None) – MLflow tracking server URI. If
None, uses the localmlruns/directory. DefaultNone.verbose (bool) – Print logging activity to stdout. Default
True.
- Raises:
ImportError – If
mlflowis not installed.
- __init__(run_name=None, experiment_name='ictonyx_experiment', tracking_uri=None, verbose=True)[source]
Initialize MLflow logger.
- log_model(model, artifact_path='model', **kwargs)[source]
Log a model to MLflow using the framework-appropriate flavor.
- Parameters:
artifact_path (str)
- log_figure(figure, artifact_name)[source]
Logs a matplotlib figure as an artifact.
- Parameters:
artifact_name (str)
- log_confusion_matrix(cm_df, artifact_name='confusion_matrix.csv')[source]
Logs a confusion matrix DataFrame.
- log_training_history(history, artifact_name='training_history.csv')[source]
Logs training history as both metrics and artifact.
- log_study_summary(results)[source]
Log statistical summary of a completed study to the parent run.
Logs mean and SD for all tracked validation metrics, and mean and SD for all tracked test metrics when test data is present.
- Parameters:
results (Any) – A VariabilityStudyResults object from run_study() or variability_study().
- Return type:
None
- get_run_url()[source]
Return the MLflow UI URL for this run.
For remote tracking servers, uses the configured tracking URI directly. For local file-based tracking (
file://), defaults tohttp://localhost:5000— the standardmlflow uiaddress. Override with theMLFLOW_UI_URLenvironment variable when serving the UI on a non-default host or port.- Return type: