Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Initialize the sequential model
- model2 <- keras_model_sequential()
- # Add layers to model
- model2 %>%
- layer_dense(units = 8, activation = 'relu', input_shape = c(4)) %>%
- layer_dense(units = 5, activation = 'relu') %>%
- layer_dense(units = 3, activation = 'softmax')
- # Compile the model
- model2 %>% compile(
- loss = 'categorical_crossentropy',
- optimizer = 'adam',
- metrics = 'accuracy'
- )
- # Fit the model to the data
- history2 = model2 %>% fit(
- iris.training, iris.trainLabels,
- epochs = 200, batch_size = 5,
- validation_split = 0.2
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement