Skip to content

Canvas#

lit.sdk.model.canvas #

This module provides functionality for managing model canvases in the LIT platform. A model canvas is a no-code representation of a machine learning model, allowing users to define, modify, and manage model configurations.

Canvas #

Represents a model canvas, the no-code representation of a machine learning model.

inputs property #

Retrieves the names of the inputs to the canvas.

Returns:

Type Description
list[str]

A list input names.

Examples:

>>> canvas = Asset("contoso", "demo")
>>> canvas.inputs
[['90_1daybar_lp%'],
['RSI14TA_day'],
['vwap2060_day'],
['20sma_day'],
['ATR14_day']]

name = name instance-attribute #

The name of the canvas.

outputs property #

Retrieves the names of the outputs from the canvas.

Returns:

Type Description
list[str]

A list input names.

Examples:

>>> canvas = Asset("contoso", "demo")
>>> canvas.outputs
[{'component_name': '',
  'label_index': 4,
  'gaussian_noise': 0.5,
  'dropout': 0.5,
  'class_weighting': 1,
  'activation': 'auto',
  'feature': 'long_updown'}]

path instance-attribute #

The path to the JSON representation of the canvas on disk.

team = team instance-attribute #

The name of a team.

__init__(team, name=None, path=None) #

Initializes a new instance of Canvas.

Parameters:

Name Type Description Default
team str

The team which owns the Canvas.

required
name str

The name of the Canvas.

None

duplicate() #

Duplicates a canvas.

Raises:

Type Description
LitModelError

If an error occurred while duplicating the canvas.

Returns:

Type Description
Canvas

The duplicated canvas.

get_available_components() #

List available components that can be added to a design canvas.

Raises:

Type Description
LitModelError

If an error occurred while listing the available components.

Returns:

Type Description
list

a list of components.

Examples:

>>> canvas = Canvas('contoso', 'demo')
>>> available_components = canvas.get_available_components()

remove() #

Removes a canvas permanently.

Raises:

Type Description
LitModelError

If an error occurred while deleting the canvas.

train(device, session_name=None, temp_canvas=False) #

Starts a new experiment.

Parameters:

Name Type Description Default
device str

The name of a device; e.g. gpu4

required

Raises:

Type Description
LitModelError

If an error occurred while starting the experiment.

Returns:

Name Type Description
session_name str

The name of the screen session running the experiment.

transpile() #

Compiles a design canvas.

Raises:

Type Description
LitModelError

If an error occurred while [ACTION].

Returns:

Type Description
Functional

A Tensorflow Keras model.

Examples:

Compile the canvas named 'demo' for the team named 'contoso' to a Tensorflow Keras model.

>>> canvas = Canvas('contoso', 'demo')
>>> model = canvas.transpile()
>>> model
<keras.src.models.Functional at 0x7f3ed7193850>

create_canvas(team, project, asset, features) #

Create a new design canvas.

Parameters:

Name Type Description Default
team str

The name of the team.

required
project str

The name of the project.

required
asset str

Name of production asset.

required
features list[str]

List of features.

required

Raises:

Type Description
LitModelError

If an error occurred while [ACTION].

Returns:

Name Type Description
Canvas Canvas

Canvas object

Examples:

>>> create_canvas('contoso', 'my_project')
Canvas(team="contoso", name="my_project")

get_canvases(team) #

Get the saved design canvases for a given team.

Parameters:

Name Type Description Default
team str

The name of the team.

required

Raises:

Type Description
LitModelError

If an error occurred while [ACTION].

Returns:

Type Description
list[Canvas]

A list of canvas objects.

Examples:

Get the path of the first saved definition file for team 'contoso'.

>>> canvases = get_canvases('contoso')
>>> canvases[0].path
/data/contoso/definitions/demo.json