Options
All
  • Public
  • Public/Protected
  • All
Menu

An implementation of Hybrid Code Networks(*) dialog manager.

(*): Williams, Asadi, Zweig - 2017. Hybrid Code Networks: practical and efficient end-to-end dialog control with supervised and reinforcement learning.

Hierarchy

  • HCN

Index

Constructors

constructor

  • new HCN(__namedParameters: { actions: string[]; dropout: number; featurizers: Featurizer[]; hiddenSize: number; optimizer: Optimizer; temperature: number }): HCN
  • Defines the model.

    To fully initialize the model, run the async init() method.

    Parameters

    • __namedParameters: { actions: string[]; dropout: number; featurizers: Featurizer[]; hiddenSize: number; optimizer: Optimizer; temperature: number }
      • actions: string[]
      • dropout: number
      • featurizers: Featurizer[]
      • hiddenSize: number
      • optimizer: Optimizer
      • temperature: number

    Returns HCN

Properties

Private actions

actions: string[]

Private featurizers

featurizers: Featurizer[]

Private hiddenSize

hiddenSize: number

Private inputSize

inputSize: number

Private lstm

lstm: LSTM

Private lstmC

lstmC: tf.Tensor2D

Private lstmDropout

lstmDropout: number

Private lstmH

lstmH: tf.Tensor2D

Private lstmTemperature

lstmTemperature: number

Private optimizer

optimizer: Optimizer

Private outputSize

outputSize: number

Methods

export

  • export(): Promise<string>
  • Export the models parameters in a JSON format.

    Returns Promise<string>

Private fitStory

Private getActionMask

  • getActionMask(): tf.Tensor1D
  • Get the final action mask resulted from every featurizers.

    Returns tf.Tensor1D

Private getOptimizableFeatures

  • getOptimizableFeatures(features: Tensor[]): tf.Tensor1D
  • Get the embedding vector resulted from every featurizers.

    Parameters

    • features: Tensor[]

    Returns tf.Tensor1D

Private handleAction

  • handleAction(action: string): void
  • Inform every featurizers of the taken action.

    Parameters

    • action: string

    Returns void

Private handleQuery

  • handleQuery(query: string, data?: any): Promise<any[]>
  • Get the data returned from every featurizer's handleQuery method.

    Parameters

    • query: string
    • Optional data: any

    Returns Promise<any[]>

init

  • init(): Promise<void>
  • Initialize the model and its featurizers.

    Returns Promise<void>

load

  • load(json: string): void
  • Load the models parameters from a JSON formatted string.

    Parameters

    • json: string

    Returns void

predict

  • predict(query: string): Promise<{ action: string; confidence: number }>
  • Predict an action resulting from the given query.

    Parameters

    • query: string

      The given query from the user.

    Returns Promise<{ action: string; confidence: number }>

    The predicted action from the model and its confidence.

resetDialog

  • resetDialog(): void
  • Resets the state of the model and its featurizers.

    Returns void

score

  • Evaluate the model using stories.

    Parameters

    • stories: Stories

      Validation stories to evaluate the model.

    Returns Promise<Metrics>

    Validation metrics based on the results from the stories.

train

  • train(__namedParameters: { nEpochs: number; onEpochEnd: (metrics: Metrics) => void; stories: {} }): Promise<Metrics>
  • Trains the model using the training stories.

    Parameters

    • __namedParameters: { nEpochs: number; onEpochEnd: (metrics: Metrics) => void; stories: {} }
      • nEpochs: number
      • onEpochEnd: (metrics: Metrics) => void
      • stories: {}

    Returns Promise<Metrics>

    Metrics collected from the last epoch (that correspond to the trained model).

Legend

  • Class
  • Class with type parameter
  • Constructor
  • Method
  • Function
  • Type alias
  • Private property
  • Private method
  • Enumeration
  • Interface

Generated using TypeDoc