Skip to content

Files

Latest commit

author
Thomas Triau
Jun 25, 2019
5c45621 · Jun 25, 2019

History

History
262 lines (151 loc) · 6.2 KB

model.md

File metadata and controls

262 lines (151 loc) · 6.2 KB

Globals / Model /

Class: Model

The Model class is handling everything concerning the neural network

Hierarchy

  • Model

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new Model(config?: SequentialArgs, fitConfig?: ModelFitArgs): Model

Defined in reimprove/model.ts:48

The sequential config is truly optional and is to use only if you want to provide a complete tf.layers implementation of your model. Currently only dense layers are supported but convolutions etc will be implemented quickly. The [[ModelFitConfig]] is concerning the steps, steps per epoch etc ... which is how is the model going to train itself, which is handled by TensorFlowJS.

Parameters:

Name Type Description
config? SequentialArgs -
fitConfig? ModelFitArgs

Returns: Model


Properties

fitConfig

fitConfig: ModelFitArgs

Defined in reimprove/model.ts:48


model

model: LayersModel

Defined in reimprove/model.ts:47


Accessors

FitConfig

set FitConfig(fitConfig: ModelFitArgs): void

Defined in reimprove/model.ts:147

Parameters:

Name Type
fitConfig ModelFitArgs

Returns: void


InputSize

get InputSize(): number

Defined in reimprove/model.ts:143

Returns: number


OutputSize

get OutputSize(): number

Defined in reimprove/model.ts:139

Returns: number


Methods

addLayer

addLayer(type: LayerType, config: LayerConfig): void

Defined in reimprove/model.ts:87

Method to just add a layer to the model, concatenating it with the previous ones.

deprecated Please now use NeuralNetwork

Parameters:

Name Type Description
type LayerType a type among DENSE, FLATTEN or CONV2D
config LayerConfig -

Returns: void


compile

compile(config: ModelCompileArgs): Model

Defined in reimprove/model.ts:121

To compile the model, refer to [[ModelCompileConfig]] to know exactly what to use, but essentially, give the optimizer ('sgd', 'crossEntropy' , ...) and the loss function ('meanSquaredError', ...), see TFJS's documentation for the exhaustive list.

Parameters:

Name Type
config ModelCompileArgs

Returns: Model


export

export(destination: string, place: string): Promise<void>

Defined in reimprove/model.ts:77

Export model to as destination.

Parameters:

Name Type Default Description
destination string - Can be one of 'downloads' (triggers browser download) [default], 'localstorage', 'indexeddb' or in http request 'http', 'https'.
place string "downloads" -

Returns: Promise<void>


fit

fit(x: Tensor, y: Tensor): Promise<any>

Defined in reimprove/model.ts:130

Parameters:

Name Type
x Tensor
y Tensor

Returns: Promise<any>


predict

predict(x: Tensor, config?: ModelPredictConfig): Result

Defined in reimprove/model.ts:126

Parameters:

Name Type
x Tensor
config? ModelPredictConfig

Returns: Result


randomOutput

randomOutput(): number

Defined in reimprove/model.ts:134

Returns: number


Static FromNetwork

FromNetwork(network: NeuralNetwork, fitConfig?: ModelFitArgs, name: string): Model

Defined in reimprove/model.ts:160

Static method to create a Model from a NeuralNetwork. The fit config is optional as well as the name. It returns a prepared model, but not compiled.

constructor

Parameters:

Name Type Default
network NeuralNetwork -
fitConfig? ModelFitArgs -
name string v4()

Returns: Model


Static loadFromFile

loadFromFile(file: string | object): Promise<Model>

Defined in reimprove/model.ts:62

Parameters:

Name Type
file string | object

Returns: Promise<Model>