Search code examples
pythonmachine-learningfunctional-programmingmlflowcontextmanager

How to use MLFlow in a functional style / functional programming?


Is there a reliable way to use MLFlow in a functional style? As it is not possible to pass the run ID for example to the function which logs a parameter, I wonder whether it is possible to seperate code executed in my MLFLow run into multiple pure fuctions. Have I overlooked something, or is it simply not possible?

So far I have looked up the documentation and did not find a way to pass the run id to a MLFlow log function, neither for parameters, nor metrics or anything else.


Solution

  • The solution is to use the mlflow.client module instead of the mlflow module as stated in the documentation of the mlflow client:

    The mlflow.client module provides a Python CRUD interface to MLflow Experiments, Runs, Model Versions, and Registered Models. This is a lower level API that directly translates to MLflow REST API calls. For a higher level API for managing an “active run”, use the mlflow module.

    @Andre: Thanks for pointing me in the right direction.