Divooka Reference

Keras Models

6 nodes

On this page 6

Build Keras Model

Function

Makes a model of the layers between an input and an output.

Signature
BuildKerasModel -> Keras Model
    input: KerasTensor
    output: KerasTensor
    name: Text
KerasModel BuildKerasModel(
    KerasTensor input,
    KerasTensor output,
    string name)

Parameters

nametypedefaultdescription
inputKerasTensor—The Input the network starts from.
outputKerasTensor—The last layer's tensor.
nameText—A name for the model; empty for Keras's own.

Returns

ModelKeras Model
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Keras Models
Package
Machine Learning

Load Keras Model

Function

Loads 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

nametypedefaultdescription
pathText—The .keras file.

Returns

ModelKeras Model
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Keras Models
Package
Machine Learning

Predict One

Function

The model's answer for one example.

Signature
PredictOne -> Number Array
    model: Keras Model
    features: Number Array
double[] PredictOne(KerasModel model, double[] features)

Parameters

nametypedefaultdescription
modelKeras Model—A trained model.
featuresNumber Array—The example's numbers, in the order it was trained on.

Returns

OutputsNumber Array
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Keras Models
Package
Machine Learning

Predict With Keras Model

Function

The 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 Array
Table PredictWithKerasModel(
    KerasModel model,
    Table data,
    string[] features)

Parameters

nametypedefaultdescription
modelKeras Model—A trained model.
dataTable—The rows.
featuresText Array—The columns it sees, in the order it was trained on.

Returns

PredictionsTable
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Keras Models
Package
Machine Learning

Save Keras Model

Function

Saves 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

nametypedefaultdescription
modelKeras Model—The model.
pathText—The file to write, ending in .keras.

Returns

PathText
Ships with
Divooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Keras Models
Package
Machine Learning

Train Keras Model

Function

Trains 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: Integer
KerasModel 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

nametypedefaultdescription
modelKeras Model—The model; training changes it.
dataTable—The training rows.
featuresText Array—The columns it sees, in the order of its input.
labelsText Array—The columns it should answer. For sparse_categorical_crossentropy, one column of class numbers 0, 1, 2...
lossText—What it minimizes: mse or mae for numbers, binary_crossentropy for yes or no, sparse_categorical_crossentropy for one of several classes.
optimizerText—adam, sgd, rmsprop, adamw...
learningRateNumber—How big each step is.
epochsInteger—How many times to go through the data.
batchSizeInteger—How many rows each step sees.
validationShareNumber—The share of rows, taken from the end, kept back to measure the model on rows it has not trained on; 0 for none.
seedInteger—Makes the run repeatable: the starting weights, the shuffling and dropout.

Returns

ModelKeras Model
lossesNumber Array
validationLossesNumber Array
Ships with
Divooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Keras Models
Package
Machine Learning