Exemple #1
0
def compute_features_from_aes_for_test_set():
    test_x, ids = TestSetLoader.load('../data')
    config = load_configuration('../config/caes.json')
    scaes = StackedAutoencoders(config, warm_start=True)
    test_x = scaes.get_features(test_x)
    np.save('../data/test_x.npy', test_x)
    np.save('../data/test_ids.npy', ids)
Exemple #2
0
def predict_with_mlp():
    model = Sequential()
    model.add(Dense(33, 64))
    model.add(Activation('sigmoid'))
    # model.add(Dropout(0.2))
    model.add(Dense(64, 128))
    model.add(Activation('sigmoid'))
    # model.add(Dropout(0.2))
    model.add(Dense(128, 128))
    model.add(Dense(128, 1, init='glorot_uniform'))
    model.add(Activation('linear'))
    model.load_weights('../data/mlp_params.hdf5')
    # sgd = SGD(lr=1.e-5, decay=1e-6, momentum=0.9, nesterov=True)
    model.compile(loss='mean_squared_error', optimizer='rmsprop')

    with open('../data/parameters.pkl', 'rb') as f:
        max_val, min_val = pickle.load(f)

    test_x, ids = TestSetLoader.load('../data')

    test_x = (test_x - min_val) / (max_val - min_val)

    predicted = model.predict(test_x)
    generate_submission(ids, predicted, '../data/submission.csv')