def learn_model_from_data(dataset_directory, working_directory):
    dataset = AccelerationDataset(dataset_directory)
    mlpmodel = MLPMeasurementModel(working_directory)

    mlpmodel.train(dataset)

    dataset.save_labels(os.path.join(working_directory, "labels.txt"))
    neon2iosmlp.convert(mlpmodel.model_path, os.path.join(working_directory, "weights.raw"))

    return mlpmodel.model_path
Exemple #2
0
def learn_model_from_data(dataset, working_directory, model_name):
    """Use MLP to train the dataset and generate result in working_directory"""
    model_trainer = MLPMeasurementModelTrainer(working_directory)

    trained_model = model_trainer.train(dataset)

    dataset.save_labels(os.path.join(working_directory, model_name + '_model.labels.txt'))
    neon2iosmlp.convert(model_trainer.model_path, os.path.join(working_directory, model_name + '_model.weights.raw'))

    layers = model_trainer.layers(dataset, trained_model)
    neon2iosmlp.write_layers_to_file(layers, os.path.join(working_directory, model_name + '_model.layers.txt'))

    return model_trainer, trained_model
def learn_model_from_data(dataset, working_directory, model_name):
    """Use MLP to train the dataset and generate result in working_directory"""
    model_trainer = MLPMeasurementModelTrainer(working_directory)

    trained_model = model_trainer.train(dataset)

    dataset.save_labels(
        os.path.join(working_directory, model_name + '_model.labels.txt'))
    neon2iosmlp.convert(
        model_trainer.model_path,
        os.path.join(working_directory, model_name + '_model.weights.raw'))

    layers = model_trainer.layers(dataset, trained_model)
    neon2iosmlp.write_layers_to_file(
        layers,
        os.path.join(working_directory, model_name + '_model.layers.txt'))

    return model_trainer, trained_model