Quick Start MLHub
See the Platform Guide for getting started in Ubuntu. Then get started with:
$ pip3 install mlhub
After this completes the ml command should be available. Type ml at the prompt, then enter. If the command is not found you may need to log out and back in again or even reboot. If the command is still not found then try the following to ensure the path is setup properly and then login in again:
$ echo 'PATH=~/.local/bin:$PATH' >> ~/.bashrc
Once you have a working ml command you can configure the command itself and check what packages are available.
$ ml configure
$ ml available
Once working you will be able to run the Hello World example which is the rain model. This uses the free and open source R statistical software package. You’ll need Python3 installed too, but you will probably already have it if you were able to run the pip3 command above.
The TL;DR version is below. Note that you type the command
ml ... and that everything from the
# to the end of the line is ignored (it’s a comment):
$ ml install rain # Install the model named 'rain'. $ ml demo rain # Run the demonstration of the pre-built model. $ ml display rain # Graphical display of pre-built model. $ ml score rain # Interact with the model to predict rain.
The following lists the commands generally available for each package and a brief description of each:
$ ml # Show a usage message. $ ml available # List of pre-buld models on the MLHub. $ ml installed # List of pre-built models installed locally $ ml install rain # Install the pre-built model named 'rain'. $ ml remove rain # Remove locally installed pre-built model. $ ml remove # Remove the local MLHub folder. $ ml readme rain # View background information about the model. $ ml configure rain # Install any required packages. $ ml commands rain # List of commands supported by the model. $ ml demo rain # Run the demonstration of the pre-built model $ ml print rain # Textual summary of the pre-built model. $ ml display rain # Graphical display of pre-built model. $ ml score rain # Interactive model or run model on own data. $ ml train rain # Supply own data and re-fit a model.
Different pre-built model packages will have different system dependencies and these will be installed by the configure command.
The simplest examples of installing models is to install from the mlhub.ai catalogue. The available packages are listed using the available command. Choose one of the available packages by name and install it. MLHub will know from where to obtain the package.
$ ml install rain
We can install a MLHub package from github. In this way a package developer simply adds MLHUB.yaml and the appropriate Python or R scripts to their github repository to turn their repo into a MLHub package. The example below will access https://github.com/gjwgit/rain. Currently only github is supported though contributions to https://github.com/mlhubber/mlhub are welcome to support bitbucket and gitlab and git repositories in general.
$ ml install gjwgit/rain
A git repository may contain multiple MLHub packages, like the Microsoft Recommenders best practice repository at https://github.com/gjwgit/recommenders. In this case we point mlhub to the specific configuration files.
$ ml install gjwgit/recommenders:mlhub/sar.yaml
$ ml readme sar
$ ml install gjwgit/recommenders:mlhub/rbm.yaml
$ ml readme rbm
Commands Auto Completion
The bash shell on Linux supports command line auto-completion which is pretty handy. You can download ml.bash from the MLHub and place the file into /etc/bash_completion.d/ or for later versoins of bash, into ~/.local/share/bash-completion/completions/
$ wget https://mlhub.ai/ml.bash
$ sudo install -m 0644 ml.bash /etc/bash_completion.d/
OR (for bash --version > 4.3)
$ mkdir -p ~/.local/share/bash-completion/completions/
$ mv ml.bash ~/.local/share/bash-completion/completions/
Restart the shell for the auto-completion to take effect. Then type ‘ml ‘ then the beginnings of a command, like ‘a’, and then TAB to auto-complete. Auto-completion also works for model names.