Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. # Initialize the sequential model
  2. model2 <- keras_model_sequential()
  3.  
  4. # Add layers to model
  5. model2 %>%
  6. layer_dense(units = 8, activation = 'relu', input_shape = c(4)) %>%
  7. layer_dense(units = 5, activation = 'relu') %>%
  8. layer_dense(units = 3, activation = 'softmax')
  9.  
  10. # Compile the model
  11. model2 %>% compile(
  12. loss = 'categorical_crossentropy',
  13. optimizer = 'adam',
  14. metrics = 'accuracy'
  15. )
  16.  
  17. # Fit the model to the data
  18. history2 = model2 %>% fit(
  19. iris.training, iris.trainLabels,
  20. epochs = 200, batch_size = 5,
  21. validation_split = 0.2
  22. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement