bigdl.keras package¶
Submodules¶
bigdl.keras.ToBigDLHelper module¶
bigdl.keras.backend module¶
-
class
bigdl.keras.backend.
KerasModelWrapper
(kmodel)[source]¶ -
evaluate
(x, y, batch_size=32, sample_weight=None, is_distributed=False)[source]¶ Evaluate a model by the given metrics. :param x: ndarray or list of ndarray for local mode. RDD[Sample] for distributed mode :param y: ndarray or list of ndarray for local mode and would be None for cluster mode. :param batch_size :param is_distributed: run in local mode or distributed mode. NB: if is_distributed=true, x should be RDD[Sample] and y should be None :return:
-
fit
(x, y=None, batch_size=32, nb_epoch=10, verbose=1, callbacks=None, validation_split=0.0, validation_data=None, shuffle=True, class_weight=None, sample_weight=None, initial_epoch=0, is_distributed=False)[source]¶ Optimize the model by the given options
Parameters: x – ndarray or list of ndarray for local mode. RDD[Sample] for distributed mode :param y: ndarray or list of ndarray for local mode and would be None for cluster mode. is_distributed: used to control run in local or cluster. the default value is False. NB: if is_distributed=true, x should be RDD[Sample] and y should be None :param is_distributed: Whether to train in local mode or distributed mode :return: A Numpy array or RDD[Sample] of predictions.
-
predict
(x, batch_size=None, verbose=None, is_distributed=False)[source]¶ Generates output predictions for the input samples, processing the samples in a batched way.
# Arguments x: the input data, as a Numpy array or list of Numpy array for local mode. as RDD[Sample] for distributed mode is_distributed: used to control run in local or cluster. the default value is False # Returns A Numpy array or RDD[Sample] of predictions.
-
bigdl.keras.converter module¶
-
class
bigdl.keras.converter.
DefinitionLoader
(kmodel)[source]¶ -
classmethod
from_hdf5_path
(hdf5_path)[source]¶ Parameters: hdf5_path – hdf5 path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. Returns: BigDL Model
-
classmethod
-
class
bigdl.keras.converter.
WeightLoader
[source]¶ -
static
load_weights_from_hdf5
(kmodel, filepath, by_name=False)[source]¶ Loads all layer weights from a HDF5 save file. filepath can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. If by_name is False (default) weights are loaded based on the network’s execution order topology, meaning layers in the execution seq should be exactly the same the architecture
If by_name is True, weights are loaded into layers only if they share the same name. This is useful for fine-tuning or transfer-learning models where some of the layers have changed.
-
static
-
class
bigdl.keras.converter.
WeightsConverter
[source]¶ Convert keras weights to bigdl weights The shape of weights would be changed if using different backend, so we only test against TensorFlow backend. TODO: Support th backend as well.