Exemple #1
0
        parallel_model.fit(Xtrain,
                           Ytrain,
                           validation_data=(Xvalid, Yvalid),
                           epochs=1000,
                           batch_size=64,
                           verbose=2,
                           callbacks=[early_stopping])

    # generate parallel data for test
    Xtrain, Ytrain, Xtest, Ytest = parallel_data_generator_for_test(
        X_train, Y_train, X_test, Y_test, len(models))

    # model evaluation
    print("Model Name %s" % name)
    print("Training...")
    run_test(models, parallel_model, Xtrain, Ytrain, y_train)
    print("Testing...")
    run_test(models, parallel_model, Xtest, Ytest, y_test)

    # parallel model saving
    print("Model Data and CSV Saving...")
    save_model(models, parallel_model, model_dir, dataset)

    # intermediate feature extraction
    print('Intermediate Feature Extracting...')
    intermediate_output_tarin = feature_predict(models, model_schema, Xtrain)
    intermediate_output_test = feature_predict(models, model_schema, Xtest)

    # save feature as csv
    csv_save(dataset, y_train, intermediate_output_tarin, y_test,
             intermediate_output_test, models, feature_dir)
Exemple #2
0
                    Xtrain, Ytrain = X_train[train_idx], Y_train[train_idx]
                    Xvalid, Yvalid = X_train[valid_idx], Y_train[valid_idx]
                    # fitting parallel model
                    print('Parallel DNN Training...')
                    model.fit(Xtrain,
                              Ytrain,
                              validation_data=(Xvalid, Yvalid),
                              epochs=1000,
                              batch_size=128,
                              verbose=2,
                              callbacks=[early_stopping])

                # model evaluation
                print("Model Name %s" % name)
                print("Training...")
                run_test(name, model, X_train, Y_train, y_train)
                print("Testing...")
                run_test(name, model, X_test, Y_test, y_test)

                # parallel model saving
                print("Model Data and CSV Saving...")
                save_model(name, model, model_dir, dataset)

                # intermediate feature extraction
                print('Intermediate Feature Extracting...')
                intermediate_output_tarin = feature_predict(
                    name, model, model_schema, X_train)
                intermediate_output_test = feature_predict(
                    name, model, model_schema, X_test)

                # save feature as csv