The Model class is handling everything concerning the neural network
Model
⊕ new Model(config?: SequentialConfig, fitConfig?: ModelFitConfig): Model
Defined in reimprove/model.ts:47
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:
| Param | Type | Description |
|---|---|---|
Optional config |
SequentialConfig |
- |
Optional fitConfig |
ModelFitConfig |
Returns: Model
● fitConfig: ModelFitConfig
Defined in reimprove/model.ts:47
● model: Model
Defined in reimprove/model.ts:46
getInputSize(): number
Defined in reimprove/model.ts:127
Returns: number
getOutputSize(): number
Defined in reimprove/model.ts:123
Returns: number
▸ addLayer(type: LayerType, config: LayerConfig): void
Defined in reimprove/model.ts:71
Method to just add a layer to the model, concatenating it with the previous ones. deprecated: Please now use NeuralNetwork
Parameters:
| Param | Type | Description |
|---|---|---|
| type | LayerType | a type among DENSE, FLATTEN or CONV2D |
| config | LayerConfig | - |
Returns: void
▸ compile(config: ModelCompileConfig): Model
Defined in reimprove/model.ts:105
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:
| Param | Type | Description |
|---|---|---|
| config | ModelCompileConfig |
- |
Returns: Model
▸ fit(x: Tensor, y: Tensor): Promise<any>
Defined in reimprove/model.ts:114
Parameters:
| Param | Type |
|---|---|
| x | Tensor |
| y | Tensor |
Returns: Promise<any>
▸ loadFromFile(file: string): Promise<void>
Defined in reimprove/model.ts:61
Parameters:
| Param | Type |
|---|---|
| file | string |
Returns: Promise<void>
▸ predict(x: Tensor, config?: ModelPredictConfig): Result
Defined in reimprove/model.ts:110
Parameters:
| Param | Type |
|---|---|
| x | Tensor |
Optional config |
ModelPredictConfig |
Returns: Result
▸ randomOutput(): number
Defined in reimprove/model.ts:118
Returns: number
▸ FromNetwork(network: NeuralNetwork, fitConfig?: ModelFitConfig, name?: string): Model
Defined in reimprove/model.ts:140
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:
| Param | Type | Default value | Description |
|---|---|---|---|
| network | NeuralNetwork | - | - |
Optional fitConfig |
ModelFitConfig |
- | - |
Default value name |
string |
v4() | - |
Returns: Model