| 66 | |
| 67 | |
| 68 | def test_mlp(): |
| 69 | y_train_onehot = one_hot(y_train) |
| 70 | y_test_onehot = one_hot(y_test) |
| 71 | |
| 72 | model = NeuralNet( |
| 73 | layers=[ |
| 74 | Dense(256, Parameters(init="uniform", regularizers={"W": L2(0.05)})), |
| 75 | Activation("relu"), |
| 76 | Dropout(0.5), |
| 77 | Dense(128, Parameters(init="normal", constraints={"W": MaxNorm()})), |
| 78 | Activation("relu"), |
| 79 | Dense(2), |
| 80 | Activation("softmax"), |
| 81 | ], |
| 82 | loss="categorical_crossentropy", |
| 83 | optimizer=Adadelta(), |
| 84 | metric="accuracy", |
| 85 | batch_size=64, |
| 86 | max_epochs=25, |
| 87 | ) |
| 88 | model.fit(X_train, y_train_onehot) |
| 89 | predictions = model.predict(X_test) |
| 90 | assert roc_auc_score(y_test_onehot[:, 0], predictions[:, 0]) >= 0.95 |
| 91 | |
| 92 | |
| 93 | def test_gbm(): |