15. Basics

VELES uses modular paradigm for quick and easy development of Machine Learning algorithms and models.

_images/units_to_workflow.png

User can construct any dataflow algorithm including Neural Network models using the predefined elementary building blocks - Units.

15.1. What is a Model?

The Model or Workflow - a collection of Units connected to each other implementing required algorithms. The class veles.workflow.Workflow is the container for the Model.

The Workflow can be very complex and can execute algorithms iteratively on the dataset. In order to set start and end points in the algorithms the Workflow has a start point and an end point (StartPoint and EndPoint), so that when run() is called, the start point begins the party and the end point’s run ends the party, triggering on_workflow_finished().

15.2. Two ways of running Veles

You can start Veles by two methods:

Both methods execute veles.__main__, and they are absolutely equivalent.

orphan:

15.3. Execution modes

Veles can run workflows in different modes. Operation modes are:

  • Standalone mode (default). Workflow runs on the same computer which Veles was invoked on.
  • Master mode. Veles launches the server node for distributed computation. This involves passing -l / --listen-address command-line argument which specify the bind address and port. The actual communication will be done through ZeroMQ and the opened socket is used only for management.
  • Slave mode. Veles launches the client node which does the actual calculations for it’s master. The corresponding command-line argument is -m / --master-address.

The modes above can be checked using is_standalone, is_master and is_slave veles.units.Unit‘s properties. They are mutually exclusive.

Evaluation modes are:

  • Train mode (default). The workflow is supposed to be trained.
  • Test mode. Activated via --test. The workflow is supposed to be run on unlabeled/untargeted data, thus loaders should fill only the TEST set. It is useless without setting --result-file argument (or writing the code to save the results by hand).

The modes above can be checked using testing veles.units.Unit‘s property. They are mutually exclusive, too.

Overall, we get 3 * 2 = 6 different modes.

orphan:

15.4. Units

Unit is a core concept of VELES. Technically, it is class inherited from Unit and satisfying IUnit interface.

A unit carries some algorithm which is solid and indivisible - it is a building block. For example, it is a single layer of a neural network or a rhythm extraction from music data. A unit can be constructed, initialized and run. When a unit is constructed, it creates it’s output data fields. During the initialization, input data fields are validated and some preparation is done for running. Unit’s run is a reentrant application of the underlying algorithm, which processes inputs and updates outputs. Units connect with each other in two ways: control flow links and data links.

_images/unit.png

The blue unit will not run unless all the three orange predecessors finish to run. This is a control flow. The blue unit takes inputs from orange units’ outputs. This makes units’ running data driven.

Units may unite into a Workflow. Actually, each unit has a workflow property which points to the parent object. Workflows are units, too, so they can also be linked and run, but in a slightly different way. See How to create the Workflow. From beginner to professional..

Distributed calculation is performed using the additional group of methods required by IDistributable (see Distributed units).

15.4.2. Service units

  • Loaders load raw images, pre-process them and make the initial data vectors.
  • Repeater is a dummy unit that should be linked from start_point and from the last unit of the Workflow.
  • Snapshotter makes pickle snapshots from the Workflow each epoch.
  • Plotters are used to draw plots: weight matrices, error for epochs, etc.

More units: Units. Parameters of the units.