    import {BaseNeuralNetwork} from 'tensorscript/lib/deep_learning.mjs'

public class | source

# BaseNeuralNetwork

#### Extends:

lib/model_interface.js~TensorScriptModelInterface → BaseNeuralNetwork

#### Implements:

- TensorScriptModelInterface

#### Direct Implemented:

- DeepLearningClassification
,
- DeepLearningRegression
,
- LSTMTimeSeries
,
- LogisticRegression
,
- MultipleLinearRegression

#### Indirect Implemented:

- LSTMMultivariateTimeSeries

Deep Learning with Tensorflow

#### Test:

- BaseNeuralNetwork

## Constructor Summary

Public Constructor
public | constructor(options: {layers: Array<Object>, compile: Object, fit: Object}, properties: *) |

## Member Summary

Public Members
public | model |
public | xShape |
public | yShape |

## Method Summary

Public Methods
public | calculate(matrix: Array<Array<number>>|Array<number>, options: Object): {data: Promise} Predicts new dependent variables |
public abstract | generateLayers(x_matrix: Array<Array<number>>, y_matrix: Array<Array<number>>, layers: Array<Object>) Adds dense layers to tensorflow model |
public | async train(x_matrix: Array<Array<number>>, y_matrix: Array<Array<number>>, layers: Array<Object>, x_text: Array<Array<number>>, y_text: Array<Array<number>>): Object Asynchronously trains tensorflow model |

## Public Constructors

### public constructor(options: {layers: Array<Object>, compile: Object, fit: Object}, properties: *) source

#### Params:

Name | Type | Attribute | Description
options | {layers: Array<Object>, compile: Object, fit: Object} |  | neural network configuration and tensorflow model hyperparameters
properties | * |  | extra instance properties

#### Test:

- BaseNeuralNetwork constructor

## Public Members

### public model source

### public xShape source

### public yShape source

## Public Methods

### public calculate(matrix: Array<Array<number>>|Array<number>, options: Object): {data: Promise} source

Predicts new dependent variables

#### Params:

Name | Type | Attribute | Description
matrix | Array<Array<number>>|Array<number> |  | new test independent variables
options | Object |  | model prediction options

#### Return:

{data: Promise} | returns tensorflow prediction

#### Test:

- BaseNeuralNetwork calculate

### public abstract generateLayers(x_matrix: Array<Array<number>>, y_matrix: Array<Array<number>>, layers: Array<Object>) source

Adds dense layers to tensorflow model

#### Params:

Name | Type | Attribute | Description
x_matrix | Array<Array<number>> |  | independent variables
y_matrix | Array<Array<number>> |  | dependent variables
layers | Array<Object> |  | model dense layer parameters

#### Test:

- BaseNeuralNetwork generateLayers

### public async train(x_matrix: Array<Array<number>>, y_matrix: Array<Array<number>>, layers: Array<Object>, x_text: Array<Array<number>>, y_text: Array<Array<number>>): Object source

Asynchronously trains tensorflow model

#### Params:

Name | Type | Attribute | Description
x_matrix | Array<Array<number>> |  | independent variables
y_matrix | Array<Array<number>> |  | dependent variables
layers | Array<Object> |  | array of model dense layer parameters
x_text | Array<Array<number>> |  | validation data independent variables
y_text | Array<Array<number>> |  | validation data dependent variables

#### Return:

Object | returns trained tensorflow model

#### Test:

- BaseNeuralNetwork train