Skip to content

Installation

The core package, colearn, contains only the MachineLearningInterface and a simple driver that implements the Collective Learning Protocol. To install only the core package:

pip install colearn

To make collective learning easier to use we have defined extra packages with helpers for model development in Keras and Pytorch.

To install with Keras/Pytorch extras:

pip install colearn[keras]
pip install colearn[pytorch]

To install both the Keras and Pytorch extras use:

pip install colearn[all]

To run stand-alone examples:

 python -m colearn_examples.ml_interface.run_demo
For more examples see the Examples Page

Installing From Source

Alternatively, to install the latest code from the repo:

  1. Download the source code from github:
    git clone https://github.com/fetchai/colearn.git && cd colearn
    
  2. Create and launch a clean virtual environment with Python 3.7. (This library has currently only been tested with Python 3.7).

    pipenv --python 3.7 && pipenv shell
    

  3. Install the package from source:

    pip install -e .[all]
    

  4. Run one of the examples:
    python colearn_examples/ml_interface/pytorch_mnist.py
    

If you are developing the colearn library then install it in editable mode so that new changes are effective immediately:

pip install -e .[all]

Running the tests

Tests can be run with:

tox

Documentation

To run the documentation, first install mkdocs and plugins:

pip install .[docs] 

Then run:

mkdocs serve