mlreflect.models package

Submodules

mlreflect.models.model_helpers module

mlreflect.models.model_helpers.create_save_directory(directory_name: str)[source]
mlreflect.models.model_helpers.make_save_path(model_directory: str, time_stamp: str)[source]
mlreflect.models.model_helpers.make_tensorboard_callback(model_directory: str, time_stamp: str, graphs_subdirectory: str = 'tb_graphs')[source]

mlreflect.models.simple_model module

class mlreflect.models.simple_model.SimpleModel(directory_name: str, n_input: int, n_output: int)[source]

Bases: object

train(input_train: numpy.ndarray, output_train: Union[pandas.core.frame.DataFrame, numpy.ndarray], input_val: numpy.ndarray, output_val: Union[pandas.core.frame.DataFrame, numpy.ndarray], epochs=60)[source]
train_with_generator(data_generator_train, data_generator_val, epochs=60)[source]

mlreflect.models.trained_model module

class mlreflect.models.trained_model.DefaultTrainedModel[source]

Bases: mlreflect.models.trained_model.TrainedModel

Populated TrainedModel container for a single layer on a Si/SiOx substrate.

class mlreflect.models.trained_model.TrainedModel[source]

Bases: object

Container object for trained keras models. Contains other information necessary to predict reflectivity data.

Object can be loaded from variables or from a saved .h5 file.

Properties:

sample: keras_model: q_values: ip_mean: ip_std:

from_file(file_name: str, **kwargs)[source]

Populates the TrainedModel container with data saved in the given .h5 file.

Parameters

file_name – Full path to the .h5 file that contains the saved data.

from_variable(model: tensorflow.python.keras.engine.training.Model, sample: mlreflect.data_generation.multilayer.MultilayerStructure, q_values: numpy.ndarray, ip_mean: numpy.ndarray, ip_std: numpy.ndarray)[source]

Populates the TrainedModel container with the given arguments.

Parameters
  • model – Trained keras model.

  • sample – MultiLayer object of the sample structure that what used for training

  • q_values – q values that were used for training

  • ip_mean – Mean values of all training inputs used for input standardization.

  • ip_std – Standard deviation of all training inputs used for input standardization.

property ip_mean
property ip_std
property keras_model
property q_values
property sample
save_model(file_name: str)[source]

Saves the data in the TrainedModel container to an .h5 file.

Parameters

file_name – Full path to the .h5 file.

Module contents

class mlreflect.models.DefaultTrainedModel[source]

Bases: mlreflect.models.trained_model.TrainedModel

Populated TrainedModel container for a single layer on a Si/SiOx substrate.

class mlreflect.models.TrainedModel[source]

Bases: object

Container object for trained keras models. Contains other information necessary to predict reflectivity data.

Object can be loaded from variables or from a saved .h5 file.

Properties:

sample: keras_model: q_values: ip_mean: ip_std:

from_file(file_name: str, **kwargs)[source]

Populates the TrainedModel container with data saved in the given .h5 file.

Parameters

file_name – Full path to the .h5 file that contains the saved data.

from_variable(model: tensorflow.python.keras.engine.training.Model, sample: mlreflect.data_generation.multilayer.MultilayerStructure, q_values: numpy.ndarray, ip_mean: numpy.ndarray, ip_std: numpy.ndarray)[source]

Populates the TrainedModel container with the given arguments.

Parameters
  • model – Trained keras model.

  • sample – MultiLayer object of the sample structure that what used for training

  • q_values – q values that were used for training

  • ip_mean – Mean values of all training inputs used for input standardization.

  • ip_std – Standard deviation of all training inputs used for input standardization.

property ip_mean
property ip_std
property keras_model
property q_values
property sample
save_model(file_name: str)[source]

Saves the data in the TrainedModel container to an .h5 file.

Parameters

file_name – Full path to the .h5 file.