Skip to main content

Read Keras Model

Synopsis

这个操作符读入模型创建Keras.

Description

This operator reads sequential models build with the Python library Keras. Currently these models are limited to ones build on tabular (2-dimensional) data sets. To save a model using Keras, call thesave_modelfunction to create a single hdf5 file object. Use this Operators file input port or thekeras model fileparameter to provide the given object file.

Since Keras doesn't store information about encoded labels in the model, the decoding of predicted labels has to be done manually via theavailable class valuesparameter. Another option is to use sklearns label estimator to store and load the given label mappings via the python scripting operator before and after this prediction. This way one can write away the sklearn.preprocessing.LabelEstimator class via the pickle library and load it with the python scripting operator after the prediction to decode the label using the sklearn.preprocessing.LabelEstimator.inverse_transform method.

Differentiation

Input

file

File object containing a Keras (Python library) model, written with its save_model method. As of now the model has to be sequential and trained on tabular (two-dimensional) data.

通过

Connect an ExampleSet to this throughput port to use it's Attribute naming and sorting as the one to be assigned with the loaded model. As of now, Keras doesn't save the Attribute naming and sorting from training in the model, when writing it to disk.

Output

model

A Keras model read from the provided file object converted to a DeepLearning4J model applicable with the "Apply Model" Operator.

通过

Untouched ExampleSet provided at the input throughput port.

Parameters

Keras model file

Provide the file object containing the Keras model saved with thesave_modelfunction. Alternatively use the file input port in combination with the "Open File" Operator to read the model as a RapidMiner file object.

Available class values

If a classification is performed the class values have to be provided using this parameter. Make sure to use the same order of classes used when training the Keras model. Unfortunately the mapping isn't stored yet in the Keras model and hence has to be provided manually.