v2.0.0
Loading...
Searching...
No Matches
ml_trainer.h File Reference

MLLIB::MLTrainer convenience wrapper that drives Python training scripts via UTILSLIB::PythonRunner. More...

#include "ml_global.h"
#include <utils/python_runner.h>
#include <QString>
#include <QStringList>
Include dependency graph for ml_trainer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MLLIB::MLTrainer
 Launches Python training scripts via UTILSLIB::PythonRunner with automatic venv handling and prerequisite checks. More...

Namespaces

namespace  MLLIB
 Tensors, model abstraction, ONNX Runtime inference and Python training drivers used across mne-cpp.

Detailed Description

MLLIB::MLTrainer convenience wrapper that drives Python training scripts via UTILSLIB::PythonRunner.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.2.0
Date
April 2026

Inference in mne-cpp goes through ONNX Runtime, but training itself stays in Python where the ecosystem lives (PyTorch, scikit-learn, MNE-Python). MLLIB::MLTrainer is the thin C++ side that launches those scripts as child processes, optionally inside a managed virtual environment, without embedding a Python interpreter or linking against libpython.

The class adds three things on top of the generic UTILSLIB::PythonRunner: prerequisite checking via isPackageAvailable so callers can fail fast with a useful message, automatic delegation to runInVenv when a venvDir is configured (which creates and updates the venv before the script runs), and convention-friendly defaults that match the scripts/ml/training/ layout shipped with the repository. The whole class is compiled out under WASMBUILD because QProcess is not available in the Qt-for-WASM port.

Definition in file ml_trainer.h.