Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TensorScriptModelInterface

Base class for tensorscript models

interface

TensorScriptModelInterface

property

{Object} settings - tensorflow model hyperparameters

property

{Object} model - tensorflow model

property

{Object} tf - tensorflow / tensorflow-node / tensorflow-node-gpu

property

{Function} reshape - static reshape array function

property

{Function} getInputShape - static TensorScriptModelInterface

Hierarchy

Index

Constructors

constructor

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(matrix: Vector | Matrix | InputTextArray): Calculation
  • Predicts new dependent variables

    abstract

    Parameters

    • matrix: Vector | Matrix | InputTextArray

      new test independent variables

    Returns Calculation

    returns tensorflow prediction

exportConfiguration

  • exportConfiguration(): TensorScriptContext

importConfiguration

  • importConfiguration(configuration: TensorScriptContext): void

loadModel

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

predict

  • predict(input_matrix?: Vector | Matrix | InputTextArray | PredictionOptions, options?: PredictionOptions): Promise<any>
  • Returns prediction values from tensorflow model

    Parameters

    • Optional input_matrix: Vector | Matrix | InputTextArray | PredictionOptions

      new test independent variables

    • Optional options: PredictionOptions

    Returns Promise<any>

    predicted model values

saveModel

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

train

  • train(x_matrix: Matrix, y_matrix?: Matrix, layers?: TensorScriptLayers, x_test?: Matrix, y_test?: Matrix): Promise<LayersModel>
  • train(x_matrix: Matrix, y_matrix: Matrix): Promise<Matrix>
  • Asynchronously trains tensorflow model, must be implemented by tensorscript class

    abstract

    Parameters

    • x_matrix: Matrix

      independent variables

    • Optional y_matrix: Matrix

      dependent variables

    • Optional layers: TensorScriptLayers
    • Optional x_test: Matrix
    • Optional y_test: Matrix

    Returns Promise<LayersModel>

    returns trained tensorflow model

  • Parameters

    • x_matrix: Matrix
    • y_matrix: Matrix

    Returns Promise<Matrix>

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