Options
All
  • Public
  • Public/Protected
  • All
Menu

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: NestedArray<any> | undefined) => Shape

Type declaration

Optional layers

model

model: any

reshape

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

Type declaration

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

      • Rest ...args: any[]

      Returns any

settings

tf

tf: any

tokenizer

tokenizer: any

trained

trained: boolean

type

type: string

Optional xShape

xShape: number[]

Optional yShape

yShape: number[]

Methods

calculate

  • Predicts new dependent variables

    abstract

    Parameters

    Returns Calculation

    returns tensorflow prediction

exportConfiguration

  • Returns TensorScriptContext

importConfiguration

  • Parameters

    Returns void

loadModel

  • loadModel(options: string): Promise<any>
  • Loads a saved tensoflow / keras model, this is an alias for

    see

    https://www.tensorflow.org/js/guide/save_load#loading_a_tfmodel

    Parameters

    • options: string

      tensorflow load model options

    Returns Promise<any>

    tensorflow model

predict

  • Returns prediction values from tensorflow model

    Parameters

    Returns Promise<any>

    predicted model values

saveModel

  • saveModel(options: string): Promise<any>
  • saves a tensorflow model, this is an alias for

    see

    https://www.tensorflow.org/js/guide/save_load#save_a_tfmodel

    Parameters

    • options: string

      tensorflow save model options

    Returns Promise<any>

    tensorflow model

train

  • Asynchronously trains tensorflow model, must be implemented by tensorscript class

    abstract

    Parameters

    Returns Promise<LayersModel>

    returns trained tensorflow model

Static getInputShape

  • getInputShape(matrix?: any): Shape
  • Returns the shape of an input matrix

    function
    example

    const input = [ [ 0, 1, ], [ 1, 0, ], ]; TensorScriptModelInterface.getInputShape(input) // => [2,2]

    see

    {https://stackoverflow.com/questions/10237615/get-size-of-dimensions-in-array}

    Parameters

    • Default value matrix: any = []

      input matrix

    Returns Shape

    returns the shape of a matrix (e.g. [2,2])

Static reshape

  • Reshapes an array

    function
    example

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

    Parameters

    Returns Matrix | Vector

    returns a matrix with the defined shape