コード例 #1
0
def test_dmlrunner_same_train_job_with_split_1( \
        runner, mnist_filepath):
    split_job = make_split_job(mnist_filepath)
    split_job.hyperparams['split'] = 1
    job_results = runner.run_job(split_job)
    session_filepath = job_results.results['session_filepath']
    datapoint_count = job_results.results['datapoint_count']
    initialize_job = make_initialize_job()
    initial_weights = runner.run_job(initialize_job).results['weights']
    train_job = make_train_job(
                    initial_weights, 
                    session_filepath,
                    datapoint_count
                )
    result = runner.run_job(train_job)
    assert result.status == 'successful'
    results = result.results
    new_weights = results['weights']
    omega = results['omega']
    train_stats = results['train_stats']
    assert result.job.job_type is JobTypes.JOB_TRAIN.name
    assert type(new_weights) == list
    assert type(new_weights[0]) == np.ndarray
    assert type(omega) == int or type(omega) == float
    assert type(train_stats) == dict
コード例 #2
0
def split_dmlresult_obj(config_manager, mnist_filepath):
    model_json = make_model_json()
    runner = DMLRunner(config_manager)
    split_job = make_split_job(
        model_json,
        mnist_filepath,
    )
    split_job.hyperparams['split'] = 0.75
    job_results = runner.run_job(split_job)
    return job_results
コード例 #3
0
def split_dmlresult_obj(config_manager, mnist_uuid, dataset_manager):
    model_json = make_model_json()
    runner = DMLRunner(config_manager)
    mnist_filepath = dataset_manager.get_mappings()[mnist_uuid]
    split_job = make_split_job(
                            model_json, 
                            mnist_filepath,
                        )
    split_job.hyperparams['split'] = 0.75
    job_results = runner.run_job(split_job)
    print(job_results)
    return job_results
コード例 #4
0
def test_dmlrunner_transform_and_split( \
        runner, small_filepath):
    split_job = make_split_job(small_filepath)
    split_job.hyperparams['split'] = 0.75
    job_results = runner.run_job(split_job)
    session_filepath = job_results.results['session_filepath']
    assert os.path.isdir(session_filepath), \
        "Session folder does not exist!"
    train_filepath = os.path.join(session_filepath, 'train.csv')
    test_filepath = os.path.join(session_filepath, 'test.csv')
    assert os.path.isfile(train_filepath) and os.path.isfile(test_filepath), \
        "Training and test set not created!"
    train = pd.read_csv(train_filepath)
    test = pd.read_csv(test_filepath)
    assert len(train) == 6 and len(test) == 2, \
        "Train test split was not performed correctly."
コード例 #5
0
def test_dmlrunner_same_train_job_with_split_1( \
        config_manager, mnist_filepath):
    model_json = make_model_json()
    hyperparams = make_hyperparams(split=1)
    runner = DMLRunner(config_manager)
    initialize_job = make_initialize_job(model_json)
    initial_weights = runner.run_job(initialize_job).results['weights']
    split_job = make_split_job(model_json, mnist_filepath)
    job_results = runner.run_job(split_job)
    session_filepath = job_results.results['session_filepath']
    datapoint_count = job_results.results['datapoint_count']
    train_job = make_train_job(model_json, initial_weights, hyperparams,
                               session_filepath, datapoint_count)
    result = runner.run_job(train_job)
    assert result.status == 'successful'
    results = result.results
    new_weights = results['weights']
    omega = results['omega']
    train_stats = results['train_stats']
    assert result.job.job_type is JobTypes.JOB_TRAIN.name
    assert type(new_weights) == list
    assert type(new_weights[0]) == np.ndarray
    assert type(omega) == int or type(omega) == float
    assert type(train_stats) == dict
コード例 #6
0
def split_dmlresult_obj(runner, mnist_filepath):
    split_job = make_split_job(mnist_filepath, )
    split_job.hyperparams['split'] = 0.75
    job_results = runner.run_job(split_job)
    return job_results