deephaven.learn#

Deephaven’s learn module provides utilities for efficient data transfer between Deephaven tables and Python objects, as well as a framework for using popular machine-learning / deep-learning libraries with Deephaven tables.

class Input(col_names, gather_func)[source]#

Bases: object

Input specifies how to gather data from a Deephaven table into an object.

Initializes an Input object with the given arguments.

Parameters:
  • col_names (Union[str, List[str]]) – column name or list of column names from which to gather input.

  • gather_func (Callable) – function that determines how input gets transformed into an object.

class Output(col_name, scatter_func, col_type)[source]#

Bases: object

Output specifies how to scatter data from an object into a table column.

Initializes an Output object with the given arguments.

Parameters:
  • col_name (str) – name of the new column that will store results.

  • scatter_func (Callable) – function that determines how data is taken from an object and placed into a Deephaven table column.

  • col_type (Type) – desired data type of the new output column, default is None (no explicit type cast).

learn(table=None, model_func=None, inputs=[], outputs=[], batch_size=None)[source]#

Learn gathers data from multiple rows of the input table, performs a calculation, and scatters values from the calculation into an output table. This is a common computing paradigm for artificial intelligence, machine learning, and deep learning.

Parameters:
  • table (Table) – the Deephaven table to perform computations on.

  • model_func (Callable) – function that performs computations on the table.

  • inputs (List[Input]) – list of Input objects that determine how data gets extracted from the table.

  • outputs (List[Output]) – list of Output objects that determine how data gets scattered back into the results table.

  • batch_size (int) – maximum number of rows for which model_func is evaluated at once.

Return type:

Table

Returns:

a Table with added columns containing the results of evaluating model_func.

Raises:

DHError