Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TextEmbedding

Text Embedding with Tensorflow Universal Sentence Encoder (USE)

implements

{TensorScriptModelInterface}

Hierarchy

Index

Constructors

constructor

  • new TextEmbedding(options?: TensorScriptOptions, properties?: TensorScriptProperties): TextEmbedding

Properties

compiled

compiled: boolean

getInputShape

getInputShape: (...args: any[]) => any

Type declaration

    • (...args: any[]): any
    • Parameters

      • Rest ...args: any[]

      Returns any

Optional getTimeseriesShape

getTimeseriesShape: (x_timeseries: undefined | NestedArray<any>) => Shape

Type declaration

    • (x_timeseries: undefined | NestedArray<any>): Shape
    • Parameters

      • x_timeseries: undefined | NestedArray<any>

      Returns Shape

Optional layers

layers: TensorScriptLayers | TensorScriptSavedLayers

Optional loss

loss: number

model

model: any

reshape

reshape: (...args: any[]) => any

Type declaration

    • (...args: any[]): any
    • Parameters

      • Rest ...args: any[]

      Returns any

settings

settings: TensorScriptOptions

tf

tf: any

tokenizer

tokenizer: any

trained

trained: boolean

type

type: string

Optional xShape

xShape: number[]

Optional yShape

yShape: number[]

Methods

calculate

  • calculate(input_array: InputTextArray, options?: {}): any
  • Calculates sentence embeddings

    override

    Parameters

    • input_array: InputTextArray

      new test independent variables

    • options: {} = ...

      model prediction options

    Returns any

    returns tensorflow prediction

exportConfiguration

  • exportConfiguration(): TensorScriptContext

importConfiguration

  • importConfiguration(configuration: TensorScriptContext): void

loadModel

  • loadModel(options: string): Promise<any>

predict

  • predict(input_array: InputTextArray, options?: PredictionOptions): Promise<Vector | Matrix>

saveModel

  • saveModel(options: string): Promise<any>

train

  • train(): Promise<any>

Static getInputShape

  • getInputShape(matrix?: any): Shape

Static reshape

  • reshape(array: Vector, shape: Shape): Vector | Matrix
  • Reshapes an array

    function
    example

    const array = [ 0, 1, 1, 0, ]; const shape = [2,2]; TensorScriptModelInterface.reshape(array,shape) // => [ [ 0, 1, ], [ 1, 0, ], ];

    Parameters

    • array: Vector

      input array

    • shape: Shape

      shape array

    Returns Vector | Matrix

    returns a matrix with the defined shape