Skip to content

Usage – Command line interface

Nikkel Mollenhauer edited this page Jul 24, 2022 · 7 revisions

The recommerce framework offers a command line interface (CLI) through a locally installable pip package. This page will give an introduction into its correct usage. For an installation guide, please refer to the Quick Start Guide.

Available commands

The list of available commands can be viewed at any time by running the

recommerce --help

command in your terminal. The command's output is also listed below.

Command Argument Description
-h, --help Show this help message and exit
-c, --command One of training exampleprinter or agent_monitoring Choose and run the specified task.
-d, --datapath Valid path to an existing directory, as string Provide the path where recommerce will look for and save data. Relative paths are supported.
--get-datapath Will print the currently set datapath.
-g, --get-defaults Default files, such as configuration files and trained models will be copied to your datapath.
-gdu, --get-defaults-unpack Works the same as --get-defaults, but also unpacks the default files so they are in the correct relative locations to be used by recommerce. WARNING: Any existing files with the same name as the default files will be overwritten!
-v, --version Show program's version number and exit.

Tasks

--command

Most of the tasks that can be performed through the recommerce simulation framework are offered as commands through the CLI. To perform a task, simply run the following command in your terminal:

recommerce --command <command>

where <command> is one of training, exampleprinter or agent_monitoring.

For an in-depth explanation of the various tasks that can be performed, also see the tasks and examples pages.

Datapath

--datapath, --get-datapath

The datapath is a directory within the user's local filesystem to which recommerce will need read and write access. From this directory, recommerce will read all of its data, such as configuration files and trained models used to initialize reinforcement learning agents. The datapath is also used as the output directory for logging files, visualizations of collected metrics and trained models.

During installation of the recommerce package, the datapath will be automatically set to the current working directory. At any point, the datapath can be changed by using

recommerce --datapath <path>

where <path> is a valid path to an existing directory. Please note that any existing files from the previous datapath are NOT moved to the new datapath.

The current datapath will always be printed to the terminal when using any command, but can also be viewed without performing any other action by using

recommerce --get-datapath

Default files

--get-defaults, --get-defaults-unpack

The recommerce package includes a number of default files, such as configuration files and trained models. The configuration files can be used to quickly get started with an experiment without needing to manually create them, instead, they can be used directly or modified according to the user's needs.

The selection of pre-trained models can be used in the same way, to start a monitoring session without needing to train a new model first. It should however be noted that the pre-trained models offered through this command are not necessarily the best performing models, so they should only be used for testing purposes.

When using

recommerce --get-defaults

the default files will be copied to a folder called default_files within the users datapath, but they cannot be used directly, as recommerce requires configuration files to be in a folder called configuration_files, and trained models to be within the data folder.

To circumvent the need to manually copy and move files after performing the above command, the following command can be used:

recommerce --get-defaults-unpack

which will copy the default files as before, but also place them in the correct directories. The downside of this command and the reason why the simpler version above exists is that any existing files with the same name as one of the default files will be overwritten by this command, so it should be used with caution.