Skip to content

supervised

Supervised

The base class for all supervised tasks.

Attributes
  • verbose: A boolean value indicating the verbosity mode.

init

Initialize the instance of the class.

Args
  • verbose: A boolean of whether the search process will be printed to stdout. (optional, default = False)

fit

Find the best neural architecture for classifying the training data and train it. Based on the given dataset, the function will find the best neural architecture for it. The dataset must be in numpy.ndarray format. So the training data should be passed through x_train, y_train.

Args
  • x_train: A numpy.ndarray instance containing the training data or the training data combined with the validation data.

  • y_train: A numpy.ndarray instance containing the labels of the training data. or the label of the training data combined with the validation label.

  • time_limit: The time limit for the search in seconds.

  • cts:

predict

Return the results for the testing data predicted by the best neural architecture. Dependent on the results of the fit() function.

Args
  • x_test: An instance of numpy.ndarray containing the testing data.
Returns

evaluate

Return the accuracy score between predict value and y_test.

Args
  • x_test: An instance of numpy.ndarray containing the testing data

  • y_test: An instance of numpy.ndarray containing the labels of the testing data

Returns

SearchSupervised

The base class for all supervised tasks using neural architecture search. Inherits from Supervised class.

Attributes
  • verbose: A boolean value indicating the verbosity mode.

final_fit

Final training after finding the best neural architecture.

Args
  • x_train: A numpy.ndarray of training data.

  • y_train: A numpy.ndarray of training targets.

  • x_test: A numpy.ndarray of testing data.

  • y_test: A numpy.ndarray of testing targets.

  • trainer_args: A dictionary containing the parameters of the ModelTrainer constructor. (optional, default = None)

  • retrain: A boolean of whether reinitialize the weights of the model. (optional, default = False)

DeepTaskSupervised

Inherits from SearchSupervised class.

Attributes
  • verbose: A boolean value indicating the verbosity mode. (optional, default = False)

  • path: A string indicating the path to a directory where the intermediate results are saved. (optional, default = None)

  • resume: A boolean. If True, the classifier will continue to previous work saved in path. Otherwise, the classifier will start a new search. (optional, default = False)

  • searcher_args: A dictionary containing the parameters for the searcher's init function. (optional, default = None)

  • search_type: A constant denoting the type of hyperparameter search algorithm that must be used. (optional, default = BayesianSearcher)

init

Initialize the instance of a DeepTaskSupervised class. The classifier will be loaded from the files in 'path' if parameter 'resume' is True. Otherwise it would create a new one.

Args
  • verbose: A boolean of whether the search process will be printed to stdout.

  • path: A string. The path to a directory, where the intermediate results are saved.

  • resume: A boolean. If True, the classifier will continue to previous work saved in path. Otherwise, the classifier will start a new search.

  • searcher_args: A dictionary containing the parameters for the searcher's init function.

  • search_type: A constant denoting the type of hyperparameter search algorithm that must be used.

fit

Find the best neural architecture for classifying the training data and train it. Based on the given dataset, the function will find the best neural architecture for it. The dataset must be in numpy.ndarray format. The training and validation data should be passed through x, y. This method will automatically split the training and validation data into training and validation sets.

Args
  • x: A numpy.ndarray instance containing the training data or the training data combined with the validation data.

  • y: A numpy.ndarray instance containing the labels of the training data. or the label of the training data combined with the validation label.

  • time_limit: The time limit for the search in seconds. (optional, default = None, which turns into 24 hours in method)

  • cts:

final_fit

Final training after found the best architecture.

Args
  • x_train: A numpy.ndarray of training data.

  • y_train: A numpy.ndarray of training targets.

  • x_test: A numpy.ndarray of testing data.

  • y_test: A numpy.ndarray of testing targets.

  • trainer_args: A dictionary containing the parameters of the ModelTrainer constructor.

  • retrain: A boolean indicating whether or not to reinitialize the weights of the model.

export_keras_model

Exports the best Keras model to the given filename.

Args
  • model_file_name: A string of the filename to which the best model will be exported

  • cts:

predict

Return predict results for the testing data.

Args
  • x_test: An instance of numpy.ndarray containing the testing data.
Returns

evaluate

Return the accuracy score between predict value and y_test. Predict the labels for the testing data. Calculate the accuracy metric between the predicted and actual labels of the testing data.

Args
  • x_test: An instance of numpy.ndarray containing the testing data

  • y_test: An instance of numpy.ndarray containing the labels of the testing data

Returns

SingleModelSupervised

The base class for all supervised tasks that do not use neural architecture search. Inheirits from Supervised class.

Attributes
  • verbose: A boolean of whether the search process will be printed to stdout.

  • path: A string value indicating the path to the directory where the intermediate model results are stored

  • graph: The graph form of the learned model.

  • data_transformer: A transformer class to process the data. (See example ImageDataTransformer.)

init

Initialize the instance of the SingleModelSupervised class.

Args
  • verbose: A boolean of whether the search process will be printed to stdout. (optional, default = False)

  • path: A string. The path to a directory, where the intermediate results are saved. (optional, default = None)

predict

Return the predicted labels for the testing data.

Args
  • x_test: An instance of numpy.ndarray containing the testing data.
Returns

evaluate

Return the accuracy score between predict value and y_test. Predict the labels for the testing data. Calculate the accuracy metric between the predicted and actual labels of the testing data.

Args
  • x_test: An instance of numpy.ndarray containing the testing data

  • y_test: An instance of numpy.ndarray containing the labels of the testing data

Returns

save

Exports the Keras model to the given filename.

Args
  • model_path: A string of the path to which the model will be saved

  • cts:

PortableDeepSupervised

The basis class for exported keras model Inheirits from SingleModelSupervised class and abc module.

Attributes
  • graph: The graph form of the learned model.

  • y_encoder: The encoder of the label. (See example OneHotEncoder.)

  • data_transformer: A transformer class to process the data. (See example ImageDataTransformer.)

  • verbose: A boolean of whether the search process will be printed to stdout.

  • path: A string value indicating the path to the directory where the intermediate model results are stored

init

Initialize the instance of the PortableDeepSupervised class.

Args
  • graph: The graph form of the learned model.

  • y_encoder: The encoder of the label. See example as OneHotEncoder

  • data_transformer: A transformer class to process the data. See example as ImageDataTransformer.

  • verbose: A boolean of whether the search process will be printed to stdout.

  • path: A string. The path to a directory, where the intermediate results are saved.

fit

Trains the model on the given dataset.

Args
  • x: A numpy.ndarray instance containing the training data or the training data combined with the validation data.

  • y: A numpy.ndarray instance containing the label of the training data. or the label of the training data combined with the validation label.

  • trainer_args: A dictionary containing the parameters of the ModelTrainer constructor.

  • retrain: A boolean of whether reinitialize the weights of the model.