Mulitple Linear Regression with Tensorflow

implements

  {BaseNeuralNetwork}

### Hierarchy

- BaseNeuralNetwork
  - MultipleLinearRegression

## Index

### Constructors

- constructor

### Properties

- compiled
- getInputShape
- layers
- model
- reshape
- settings
- tf
- tokenizer
- trained
- type
- xShape
- yShape

### Methods

- calculate
- exportConfiguration
- generateLayers
- importConfiguration
- loadModel
- predict
- saveModel
- train
- getInputShape
- reshape

## Constructors

### constructor

- new MultipleLinearRegression(options?: TensorScriptOptions, properties?: TensorScriptProperties): MultipleLinearRegression

- Overrides BaseNeuralNetwork.constructor

  - Defined in src/multiple_linear_regression.ts:9

  #### Parameters

  - ##### Default value options: TensorScriptOptions = {}

    neural network configuration and tensorflow model hyperparameters

  - ##### Default value properties: TensorScriptProperties = {}

    extra instance properties

  #### Returns MultipleLinearRegression

## Properties

### compiled

compiled: boolean

Inherited from TensorScriptModelInterface.compiled

- Defined in src/model_interface.ts:136

### getInputShape

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

Inherited from TensorScriptModelInterface.getInputShape

- Defined in src/model_interface.ts:138

#### Type declaration

- - (...args: any[]): any

  - #### Parameters

    - ##### Rest ...args: any[]

    #### Returns any

### Optional layers

layers: TensorScriptLayers | TensorScriptSavedLayers

Inherited from TensorScriptModelInterface.layers

- Defined in src/model_interface.ts:141

### model

model: any

Inherited from TensorScriptModelInterface.model

- Defined in src/model_interface.ts:132

### reshape

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

Inherited from TensorScriptModelInterface.reshape

- Defined in src/model_interface.ts:137

#### Type declaration

- - (...args: any[]): any

  - #### Parameters

    - ##### Rest ...args: any[]

    #### Returns any

### settings

settings: TensorScriptOptions

Inherited from TensorScriptModelInterface.settings

- Defined in src/model_interface.ts:131

### tf

tf: any

Inherited from TensorScriptModelInterface.tf

- Defined in src/model_interface.ts:134

### tokenizer

tokenizer: any

Inherited from TensorScriptModelInterface.tokenizer

- Defined in src/model_interface.ts:133

### trained

trained: boolean

Inherited from TensorScriptModelInterface.trained

- Defined in src/model_interface.ts:135

### type

type: string

Inherited from TensorScriptModelInterface.type

- Defined in src/model_interface.ts:130

### Optional xShape

xShape: number[]

Inherited from TensorScriptModelInterface.xShape

- Defined in src/model_interface.ts:139

### Optional yShape

yShape: number[]

Inherited from TensorScriptModelInterface.yShape

- Defined in src/model_interface.ts:140

## Methods

### calculate

- calculate(input_matrix: Matrix | Vector, options?: PredictionOptions): any

- Inherited from BaseNeuralNetwork.calculate

  Overrides TensorScriptModelInterface.calculate

  - Defined in src/base_neural_network.ts:76

  Predicts new dependent variables

  override

  #### Parameters

  - ##### input_matrix: Matrix | Vector

  - ##### Optional options: PredictionOptions

    model prediction options

  #### Returns any

  returns tensorflow prediction

### exportConfiguration

- exportConfiguration(): TensorScriptContext

- Inherited from TensorScriptModelInterface.exportConfiguration

  - Defined in src/model_interface.ts:266

  #### Returns TensorScriptContext

### generateLayers

- generateLayers(x_matrix: Matrix, y_matrix: Matrix, layers: TensorScriptLayers): void

- Overrides BaseNeuralNetwork.generateLayers

  - Defined in src/multiple_linear_regression.ts:39

  Adds dense layers to tensorflow regression model

  override

  #### Parameters

  - ##### x_matrix: Matrix

    independent variables

  - ##### y_matrix: Matrix

    dependent variables

  - ##### layers: TensorScriptLayers

    model dense layer parameters

  #### Returns void

### importConfiguration

- importConfiguration(configuration: TensorScriptContext): void

- Inherited from TensorScriptModelInterface.importConfiguration

  - Defined in src/model_interface.ts:277

  #### Parameters

  - ##### configuration: TensorScriptContext

  #### Returns void

### loadModel

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

- Inherited from TensorScriptModelInterface.loadModel

  - Defined in src/model_interface.ts:316

  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

- predict(input_matrix: Matrix | Vector | InputTextArray, options?: PredictionOptions): Promise<any>

- Inherited from TensorScriptModelInterface.predict

  - Defined in src/model_interface.ts:342

  Returns prediction values from tensorflow model

  #### Parameters

  - ##### input_matrix: Matrix | Vector | InputTextArray

    new test independent variables

  - ##### Default value options: PredictionOptions = {}

  #### Returns Promise<any>

  predicted model values

### saveModel

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

- Inherited from TensorScriptModelInterface.saveModel

  - Defined in src/model_interface.ts:329

  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

- train(x_matrix: Matrix, y_matrix: Matrix, layers: TensorScriptLayers, x_test: Matrix, y_test: Matrix): Promise<any>

- Inherited from BaseNeuralNetwork.train

  Overrides TensorScriptModelInterface.train

  - Defined in src/base_neural_network.ts:50

  Asynchronously trains tensorflow model

  override

  #### Parameters

  - ##### x_matrix: Matrix

    independent variables

  - ##### y_matrix: Matrix

    dependent variables

  - ##### layers: TensorScriptLayers

    array of model dense layer parameters

  - ##### x_test: Matrix

  - ##### y_test: Matrix

  #### Returns Promise<any>

  returns trained tensorflow model

### Static getInputShape

- getInputShape(matrix?: any): Shape

- Inherited from TensorScriptModelInterface.getInputShape

  - Defined in src/model_interface.ts:247

  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

- reshape(array: Vector, shape: Shape): Matrix | Vector

- Inherited from TensorScriptModelInterface.reshape

  - Defined in src/model_interface.ts:182

  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 Matrix | Vector

  returns a matrix with the defined shape