Package: actarius
Opinionated wrappers for the mlflow tracking API.fromactariusimportNewExperimentRunContents1Features2Installation3Use4Configuration5Contributing5.1Installing for development5.2Running the tests5.3Adding documentation6Credits1Featuresactariusis meant to facilitate the way we logmlflowexperiments inBigPanda, which means the following additions over themlflowtracking API:Automatically loggingstdoutandstderrto file (without hiding them from the terminal/console) and logging this file an easilly readable artifact of the experiment. This supports nested experiment run contexts.Adding a bunch of default tags (currently focused aroundgit).Convenience logging methods for dataframes as CSVs, and of arbitrary Python objects as either Pickle or text files (the latter using their inherent text represention).Warning but not erroring when mlflow is badly- or not configured.2Installationpipinstallactarius3Useactariusprovides a custom context manager that wraps around MLflow code to help you run and track experiments using BigPanda’s conventions.This context manager should be provided with some basic parameters that configure which experiment is being run:fromactariusimportExperimentRunContext,log_dfexpr_databricks_path='Shared/experiments/pattern_generation/run_org'withExperimentRunContext(expr_databricks_path):mlflow.set_tags({'some_tag':45})mlflow.log_params({'alpha':0.5,'beta':0.2})# run experiment code...mlflow.log_metrics({'auc':0.71,'stability':33.43})log_df(my_df)actariusalso provides an experiment object that needs to be closed explicitly:fromactariusimportExperimentRunexpr_databricks_path='Shared/experiments/pattern_generation/run_org'exp_obj=ExperimentRun(expr_databricks_path)exp_obj.set_tags({'some_tag':45})exp_obj.log_params({'alpha':0.5,'beta':0.2})# run experiment code...exp_obj.log_df(my_df)exp_obj.end_run(tags={'another_tag':'test'},params={'log_param_here':4},metrics={'auc':0.71,'stability':33.43},)4Configurationactariuswill fail silently if eithermlflowor the databricks cli is not correctly configured. It will issue a small warning on each experiment logging attempt, however (each closing of an experiment context, and each explicit call to anend_run()method of anactarius.ExperimentRunobject).Additionally, in this case experiment results will be logged into the./mlruns/directory (probably to the./mlruns/0/subdirectory), with random run ids determined and used to create per-run sub-directories.To have the stack trace of the underlying error printed after the warning, simply set the value of theACTARIUS__PRINT_STACKTRACEenvironment variable toTrue. Runing will then commence regularly.5Contributing5.1Installing for developmentClone:gitclonegit@github.com:bigpandaio/actarius.gitInstall in development mode, including test dependencies:cdactariuspipinstall-e'.[test]'5.2Running the testsTo run the tests use:cdactariuspytest5.3Adding documentationThe project is documented using thenumpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings. When documenting code you add to this project, followthese conventions.Additionally, if you update thisREADME.rstfile,  usepython setup.py checkdocsto validate it compiles.6CreditsCreated by Shay Palachy  (shay.palachy@gmail.com).