Your task is to train a simple multi layer perceptron (lrn("classif.mlp")) with 2 hidden layers with 100 neurons each. Set the batch size to 32, the learning rate to 0.001 and the number of epochs to 20. Then, resample the learner on the task with a cross-validation with 5 folds and evaluate the results using classification error and false positive rate (FPR). Is the result good?
Hint
The parameter for the learning rate is opt.lr
While the classification error is low, this is not a good measure due to the imbalanced class distribution. This is confirmed by the FPR, which is relatively high.
Question 2: Preprocessing
In the previous question, we have operated on the ilpd_num task where we excluded the categorical gender column. This was done because the MLP learner operates on numeric features only. You will now create a more complex GraphLearner that also incudes one-hot encoding of the gender column before applying the MLP. Resample this learner on the original ilpd task and evaluate the results using the same measures as before.
Hint
Concatenate po("encode") with a lrn("classif.mlp") using %>>% to create the GraphLearner. For available options on the encoding, see po("encode")$help().
Instead of resampling a single learner, the goal is now to compare the performance of the MLP with a simple classification tree. Create a benchmark design and compare the performance of the two learners.
Hint
Create a classification tree via lrn("classif.rpart"). A benchmark design can be created via benchmark_grid(). To run a benchmark, pass the design to benchmark().
<TaskClassif:dt> (150 x 2)
* Target: Species
* Properties: multiclass
* Features (1):
- lt (1): x
Question 5: Custom Architecture
Create a network with one hidden layer with 100 neurons and a sigmoid activation function by assempling PipeOps in a Graph. Convert the Graph to a Learner and train the network for 10 epochs using Adam with a learning rate of 0.001 and a batch size of 32.