Utility functions used within nntoolkit

The following functions are used within nntoolkit.

Utility functions that can be used in multiple scripts.

nntoolkit.utils.create_boilerplate_semantics_files(neurons)[source]

Create boilerplate files which can contain semantic meaningful values.

Parameters:neurons – A list which gives the number of neurons per layer. The first value of this list is the number of input neurons, the last value is the number of output neurons.
nntoolkit.utils.create_semantics_files(model)[source]

Create semantic input and output files which can contain semantic meaningful values.

Parameters:model (dict) – A neural network model
nntoolkit.utils.get_data(data_file)[source]

Get data as x and y numpy arrays for a tar archive.

Parameters:training_data – The path to a tar file.
Returns:Tuple (x, y), where y might be None in case of success or False in case of error
nntoolkit.utils.get_model(modelfile)[source]

Check if modelfile is valid.

Parameters:modelfile – path to a model.tar file which describes a neural network.
Returns:A dictionary which describes the model if everything seems to be fine. Return False if errors occur.
nntoolkit.utils.get_outputs(output_file)[source]

Parse output_file which is a csv file and defines the semantics of the output of a neural network.

For example, output neuron 1 means class “0” in the MNIST classification task.

nntoolkit.utils.is_valid_file(parser, arg)[source]

Check if arg is a valid file that already exists on the file system.

nntoolkit.utils.is_valid_folder(parser, arg)[source]

Check if arg is a valid file that already exists on the file system.

nntoolkit.utils.write_model(model, model_file_path)[source]

Write model to model_file_path.

Returns:False if it failed.

Previous topic

Activation functions

This Page