merlin.systems.dag.ops.session_filter.FilterCandidates#

class merlin.systems.dag.ops.session_filter.FilterCandidates(filter_out: str, input_col: Optional[str] = None)[source]#

Bases: PipelineableInferenceOperator

This operator takes the input column and filters out elements of that column based on the supplied criteria.

__init__(filter_out: str, input_col: Optional[str] = None) FilterCandidates[source]#

_summary_

Parameters:
  • filter_out (str) – the name of the column to use to filter out

  • input_col (str, optional) – The target column to filter on, by default None

Returns:

A class object is instantiated with param values passed.

Return type:

FilterCandidates

Methods

__init__(filter_out[, input_col])

_summary_

column_mapping(col_selector)

Compute which output columns depend on which input columns

compute_column_schema(col_name, input_schema)

compute_input_schema(root_schema, ...)

Compute the input schema of this node given the root, parents, and dependencies schemas of all ancestor nodes.

compute_output_schema(input_schema, col_selector)

Compute the input schema of this node given the root, parents and dependencies schemas of all ancestor nodes.

compute_selector(input_schema, selector[, ...])

Provides a hook method for sub-classes to override to implement custom column selection logic.

create_node(selector)

_summary_

export(path, input_schema, output_schema[, ...])

Export the class object as a config and all related files to the user defined path.

from_config(config, **kwargs)

Instantiate a class object given a config.

from_model_registry(registry, **kwargs)

Loads the InferenceOperator from the provided ModelRegistry.

from_path(path, **kwargs)

Loads the InferenceOperator from the path where it was exported after training.

load_artifacts(artifact_path)

Hook method that provides a way to load saved artifacts for the operator

output_column_names(col_selector)

Given a set of columns names returns the names of the transformed columns this operator will produce

save_artifacts([artifact_path])

Save artifacts required to be reload operator state from disk

transform(col_selector, transformable)

Transform input dataframe to output dataframe using function logic.

validate_schemas(parents_schema, ...[, ...])

Attributes

dependencies

dynamic_dtypes

export_name

Provides a clear common english identifier for this operator.

exportable_backends

is_subgraph

label

output_dtype

output_properties

output_tags

scalar_shape

supported_formats

supports

Returns what kind of data representation this operator supports

classmethod from_config(config, **kwargs) FilterCandidates[source]#

Instantiate a class object given a config.

Parameters:

config (dict) –

Return type:

Class object instantiated with config values

property dependencies#
compute_input_schema(root_schema: Schema, parents_schema: Schema, deps_schema: Schema, selector: ColumnSelector) Schema[source]#

Compute the input schema of this node given the root, parents, and dependencies schemas of all ancestor nodes.

Parameters:
  • root_schema (Schema) – The schema representing the input columns to the graph

  • parents_schema (Schema) – A schema representing all the output columns of the ancestors of this node.

  • deps_schema (Schema) – A schema representing the dependencies of this node.

  • selector (ColumnSelector) – A column selector representing a target subset of columns necessary for this node’s operator

Returns:

A schema that has the correct representation of all the incoming columns necessary for this node’s operator to complete its transform.

Return type:

Schema

Raises:

ValueError – Cannot receive more than one input for this node

compute_output_schema(input_schema: Schema, col_selector: ColumnSelector, prev_output_schema: Optional[Schema] = None) Schema[source]#

Compute the input schema of this node given the root, parents and dependencies schemas of all ancestor nodes.

Parameters:
  • input_schema (Schema) – The schema representing the input columns to the graph

  • col_selector (ColumnSelector) – A column selector representing a target subset of columns necessary for this node’s operator

  • prev_output_schema (Schema) – A schema representing the output of the previous node.

Returns:

A schema object representing all outputs of this node.

Return type:

Schema

validate_schemas(parents_schema, deps_schema, input_schema, output_schema, strict_dtypes=False)[source]#
transform(col_selector: ColumnSelector, transformable: Transformable) Transformable[source]#

Transform input dataframe to output dataframe using function logic.

Parameters:

df (DictArray) – Input tensor dictionary, data that will be manipulated

Returns:

Transformed tensor dictionary

Return type:

DictArray

export(path: str, input_schema: Schema, output_schema: Schema, params: Optional[dict] = None, node_id: Optional[int] = None, version: int = 1, backend: str = 'ensemble')[source]#

Export the class object as a config and all related files to the user defined path.

Parameters:
  • path (str) – Artifact export path

  • input_schema (Schema) – A schema with information about the inputs to this operator

  • output_schema (Schema) – A schema with information about the outputs of this operator

  • params (dict, optional) – Parameters dictionary of key, value pairs stored in exported config, by default None

  • node_id (int, optional) – The placement of the node in the graph (starts at 1), by default None

  • version (int, optional) – The version of the model, by default 1

Returns:

  • Ensemble_config (dict)

  • Node_configs (list)