![]() model %>% layer_conv_2d (filters = 32, kernel_size = c ( 3, 3 ), activation = 'relu', ![]() # this applies 32 convolution filters of size 3x3 each. Library ( keras ) # generate dummy data x_train % round ( ) %>% matrix (nrow = 100, ncol = 1 ) %>% to_categorical (num_classes = 10 ) x_test % round ( ) %>% matrix (nrow = 20, ncol = 1 ) %>% to_categorical (num_classes = 10 ) # create model model (100, 100, 3) tensors. ![]() Metrics = c ( 'accuracy' ) ) # train model %>% fit ( x_train, y_train, epochs = 20, batch_size = 128 ) # evaluate score % evaluate ( x_test, y_test, batch_size = 128 ) ![]() Optimizer = optimizer_sgd (lr = 0.01, decay = 1e-6, momentum = 0.9, nesterov = TRUE ), Library ( keras ) # generate dummy data x_train % round ( ) %>% matrix (nrow = 1000, ncol = 1 ) %>% to_categorical (num_classes = 10 ) x_test % round ( ) %>% matrix (nrow = 100, ncol = 1 ) %>% to_categorical (num_classes = 10 ) # create model model % layer_dense (units = 64, activation = 'relu', input_shape = c ( 20 ) ) %>% layer_dropout (rate = 0.5 ) %>% layer_dense (units = 64, activation = 'relu' ) %>% layer_dropout (rate = 0.5 ) %>% layer_dense (units = 10, activation = 'softmax' ) %>% compile (
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |