Options
All
  • Public
  • Public/Protected
  • All
Menu

A stateful featurizer that turns queries into numerical representations.

abstract

Hierarchy

Index

Properties

Protected actions

actions: any[]

The list of every action the model can take.

Readonly id

id: string

An ID used by models for exportations.

Readonly size

size: number = 1

The size of the vector returned by the featurizer. By default it's set to 1 which is the default for a featurizer that returns no features.

Methods

export

getActionMask

  • getActionMask(): boolean[]
  • Produce an action mask according to featurizer state. (Generally, this method is reimplemented in stateful featurizers)

    Returns boolean[]

    An array of boolean mapping every actions availability.

getOptimizableFeatures

  • getOptimizableFeatures(data: any): tf.Tensor1D
  • Turn the data returned by handleQuery into an embedding vector. This function is used to expose featurizer variables to the model optimizer for training.

    Reimplementing this method is not necessary if your featurizer is not meant to be optimizable through gradient descent. In this case, just return the feature vector directly using the handleQuery method.

    remarks

    It's important to keep this function stateless, it should only depend of its tensor argument and of featurizer's variables.

    Parameters

    • data: any

    Returns tf.Tensor1D

handleAction

  • handleAction(action: any): void

handleQuery

  • handleQuery(query: string, data?: any): Promise<any>
  • Featurizes and handle a text query.

    remarks

    This method can directly return a 1D tensor to provide features to the model. Alternatively, it can returns data of any type if the Featurizer implement a custom getOptimizableFeatures method to handle those data. If this method doesn't return something, no features will be passed to the model.

    Parameters

    • query: string
    • Optional data: any

    Returns Promise<any>

init

  • init(actions: any[]): Promise<void>
  • Initialize the model, can be asynchronous async code.

    This method is executed by the model during it's initialization, it will also set the actions attribute.

    Parameters

    • actions: any[]

    Returns Promise<void>

load

resetDialog

  • resetDialog(): void

Legend

  • Class
  • Class with type parameter
  • Property
  • Method
  • Function
  • Type alias
  • Enumeration
  • Interface
  • Protected property

Generated using TypeDoc