LRA Example

In this section we demonstrate using Phylanx with the Python frontend. In addition, power users can also interface with Phylanx by writing PhySL code or C++ directly. We will describe these interfaces in following sections.

Using Phylanx with the Python Frontend

In order to take advantage of Phylanx, users can decorate their Python code with Python decorators which will interpret and execute the code block in Phylanx. An example of this technique can be found in the LRA (Linear Regression Algorithm) example below.

As shown in the example above, users import Phylanx and encapsulate their code in a @Phylanx decorator. The NumPy commands will additionally be converted into Phylanx primitives when placed in a Phylanx decorator. When encapsulated, the code will be transformed into AST which represents the operations to be performed.

Using Phylanx with PhySL

Note

This section is for power users. We encourage our users to take advantage of the user friendly Python Frontend. All functionality made available through this interface is as available in our Python Frontend.

The Phylanx AST can be directly constructed using PhySL, or Phylanx Specification Language. This small language allows users to compile a raw string which produces an AST when it is compiled.

An example of using this interface can be found below: