v2.0.0
Loading...
Searching...
No Matches
MLLIB::MLTrainer Class Reference

ML training script launcher. More...

#include <ml_trainer.h>

Public Member Functions

 MLTrainer ()
 MLTrainer (const UTILSLIB::PythonRunnerConfig &config)
UTILSLIB::PythonRunnerrunner ()
UTILSLIB::PythonRunnerResult run (const QString &scriptPath, const QStringList &args={})
QStringList checkPrerequisites (const QStringList &packages) const

Detailed Description

ML training script launcher.

ML-specific convenience wrapper over UTILSLIB::PythonRunner.

Adds:

  • Automatic prerequisite checking (Python + required packages).
  • Default scripts directory resolution (scripts/ml/training/).
  • Forwards line/progress callbacks to PythonRunner.

Training logic lives entirely in Python (PyTorch, scikit-learn, …). No Python embedding or linkage is required.

Definition at line 76 of file ml_trainer.h.

Constructor & Destructor Documentation

◆ MLTrainer() [1/2]

MLTrainer::MLTrainer ( )

Construct an MLTrainer with default PythonRunner configuration.

Definition at line 60 of file ml_trainer.cpp.

◆ MLTrainer() [2/2]

MLTrainer::MLTrainer ( const UTILSLIB::PythonRunnerConfig & config)
explicit

Construct an MLTrainer with explicit PythonRunner configuration.

Parameters
[in]configPythonRunner configuration to use.

Definition at line 67 of file ml_trainer.cpp.

Member Function Documentation

◆ checkPrerequisites()

QStringList MLTrainer::checkPrerequisites ( const QStringList & packages) const

Check that the required Python packages are importable.

Parameters
[in]packagesList of package names (e.g. {"torch", "mne"}).
Returns
List of packages that could NOT be imported (empty = all OK).

Definition at line 103 of file ml_trainer.cpp.

◆ run()

PythonRunnerResult MLTrainer::run ( const QString & scriptPath,
const QStringList & args = {} )

Run a training script.

If the PythonRunner is configured with a venvDir and packageDir, the venv is created/updated automatically before the script runs.

Parameters
[in]scriptPathPath to the .py training script.
[in]argsArguments forwarded to the script.
Returns
PythonRunnerResult with exit code, output, and progress.

Definition at line 81 of file ml_trainer.cpp.

◆ runner()

PythonRunner & MLTrainer::runner ( )

Access the underlying PythonRunner for callback/config changes.

Returns
Reference to the PythonRunner instance.

Definition at line 74 of file ml_trainer.cpp.


The documentation for this class was generated from the following files: