Keras Models
6 nodes
On this page 6
Build Keras Model
FunctionMakes a model of the layers between an input and an output.
Signature
BuildKerasModel -> Keras Model
input: KerasTensor
output: KerasTensor
name: TextKerasModel BuildKerasModel(
KerasTensor input,
KerasTensor output,
string name)Parameters
| name | type | default | description |
|---|---|---|---|
| input | KerasTensor | — | The Input the network starts from. |
| output | KerasTensor | — | The last layer's tensor. |
| name | Text | — | A name for the model; empty for Keras's own. |
Returns
| Model | Keras Model |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Keras Models
- Package
- Machine Learning
Load Keras Model
FunctionLoads a model saved in Keras's .keras format, by this package or by Python's Keras.
Signature
LoadKerasModel(path: Text) -> Keras Model
KerasModel LoadKerasModel(string path)
Parameters
| name | type | default | description |
|---|---|---|---|
| path | Text | — | The .keras file. |
Returns
| Model | Keras Model |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Keras Models
- Package
- Machine Learning
Predict One
FunctionThe model's answer for one example.
Signature
PredictOne -> Number Array
model: Keras Model
features: Number Arraydouble[] PredictOne(KerasModel model, double[] features)
Parameters
| name | type | default | description |
|---|---|---|---|
| model | Keras Model | — | A trained model. |
| features | Number Array | — | The example's numbers, in the order it was trained on. |
Returns
| Outputs | Number Array |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Keras Models
- Package
- Machine Learning
Predict With Keras Model
FunctionThe model's answers for the rows of a table, as a table with one column per output.
Signature
PredictWithKerasModel -> Table
model: Keras Model
data: Table
features: Text ArrayTable PredictWithKerasModel(
KerasModel model,
Table data,
string[] features)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Keras Model | — | A trained model. |
| data | Table | — | The rows. |
| features | Text Array | — | The columns it sees, in the order it was trained on. |
Returns
| Predictions | Table |
- Ships with
- Divooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Keras Models
- Package
- Machine Learning
Save Keras Model
FunctionSaves a model in Keras's .keras format: its layers, weights and training setup in one file.
Signature
SaveKerasModel(model: Keras Model, path: Text) -> Text
string SaveKerasModel(KerasModel model, string path)
Parameters
| name | type | default | description |
|---|---|---|---|
| model | Keras Model | — | The model. |
| path | Text | — | The file to write, ending in .keras. |
Returns
| Path | Text |
- Ships with
- Divooka Compute
- Graph kinds
- Events Routine StateMachineState
- Declared by
- Keras Models
- Package
- Machine Learning
Train Keras Model
FunctionTrains a model on the rows of a table: some columns are what it sees, others what it should answer.
Signature
TrainKerasModel -> (Model: Keras Model, losses: Number Array, validationLosses: Number Array)
model: Keras Model
data: Table
features: Text Array
labels: Text Array
loss: Text
optimizer: Text
learningRate: Number
epochs: Integer
batchSize: Integer
validationShare: Number
seed: IntegerKerasModel TrainKerasModel(
KerasModel model,
Table data,
string[] features,
string[] labels,
string loss,
string optimizer,
double learningRate,
int epochs,
int batchSize,
double validationShare,
int seed,
out double[] losses,
out double[] validationLosses)Parameters
| name | type | default | description |
|---|---|---|---|
| model | Keras Model | — | The model; training changes it. |
| data | Table | — | The training rows. |
| features | Text Array | — | The columns it sees, in the order of its input. |
| labels | Text Array | — | The columns it should answer. For sparse_categorical_crossentropy, one column of class numbers 0, 1, 2... |
| loss | Text | — | What it minimizes: mse or mae for numbers, binary_crossentropy for yes or no, sparse_categorical_crossentropy for one of several classes. |
| optimizer | Text | — | adam, sgd, rmsprop, adamw... |
| learningRate | Number | — | How big each step is. |
| epochs | Integer | — | How many times to go through the data. |
| batchSize | Integer | — | How many rows each step sees. |
| validationShare | Number | — | The share of rows, taken from the end, kept back to measure the model on rows it has not trained on; 0 for none. |
| seed | Integer | — | Makes the run repeatable: the starting weights, the shuffling and dropout. |
Returns
| Model | Keras Model |
| losses | Number Array |
| validationLosses | Number Array |
- Ships with
- Divooka Compute
- Graph kinds
- Events Routine StateMachineState
- Declared by
- Keras Models
- Package
- Machine Learning