From a918a2e33620f5c8fce59ee0649c44d312d05b33 Mon Sep 17 00:00:00 2001 From: Nate George Date: Sun, 24 Mar 2019 23:00:30 -0600 Subject: [PATCH 1/5] change to allow R version 3.4 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f0e9d76..7b9a31f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,7 +7,7 @@ Description: Visualize neural net architectures using the 'ggraph' and 'Diagramm Creates and plots a graph using the layer and node information. URL: https://github.com/andrie/deepviz, https://andrie.github.io/deepviz/index.html BugReports: https://github.com/andrie/deepviz/issues -Depends: R (>= 3.5) +Depends: R (>= 3.4) License: MIT + file LICENSE Suggests: rmarkdown, From b01353108b1dfb5667fa022034d91f51de3789fd Mon Sep 17 00:00:00 2001 From: nateGeorge Date: Mon, 15 Apr 2019 22:00:49 -0600 Subject: [PATCH 2/5] minor fix to get sequential layers --- R/model_nodes.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/model_nodes.R b/R/model_nodes.R index 39884e3..a036b94 100644 --- a/R/model_nodes.R +++ b/R/model_nodes.R @@ -6,7 +6,9 @@ model_nodes <- function(x){ assert_that(is.keras_model(x)) if (is.keras_model_sequential(x)) { - model_layers <- x$get_config()$layers + # Before the CRAN release of keras on 4-5-2019, + # this was x$get_config()$layers + model_layers <- x$get_config() l_name <- map_chr(model_layers, ~purrr::pluck(., "config", "name")) } else { model_layers <- x$get_config()$layers @@ -28,4 +30,3 @@ model_nodes <- function(x){ activation = l_activation ) } - From 0e4373276c3526dc9fcb3752520d93ccaf573920 Mon Sep 17 00:00:00 2001 From: nateGeorge Date: Mon, 15 Apr 2019 22:02:33 -0600 Subject: [PATCH 3/5] fix typo --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index b497d6b..102a122 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,11 @@ Add some more layers and plot ``` r model <- keras_model_sequential() %>% - layer_conv_2d(filters = 16, kernel_size = c(3, 3)) %>% - layer_max_pooling_2d() %>% + layer_conv_2d(filters = 16, kernel_size = c(3, 3)) %>% + layer_max_pooling_2d() %>% layer_dense(10, input_shape = 4) %>% layer_dense(10, input_shape = 4) %>% - layer_dropout(0.25) %>% + layer_dropout(0.25) %>% layer_dense(2, activation = "sigmoid") model %>% plot_model() @@ -70,7 +70,7 @@ model %>% plot_model() ## plot\_model() with network models -Construct a network model using the `keras` function API, using the +Construct a network model using the `keras` functional API, using the example from ``` r @@ -101,28 +101,28 @@ model <- local({ model #> Model #> ___________________________________________________________________________ -#> Layer (type) Output Shape Param # Connected to +#> Layer (type) Output Shape Param # Connected to #> =========================================================================== -#> main_input (InputLayer) (None, 100) 0 +#> main_input (InputLayer) (None, 100) 0 #> ___________________________________________________________________________ -#> embedding_1 (Embedding) (None, 100, 512) 5120000 main_input[0][0] +#> embedding_1 (Embedding) (None, 100, 512) 5120000 main_input[0][0] #> ___________________________________________________________________________ -#> lstm_1 (LSTM) (None, 32) 69760 embedding_1[0][0] +#> lstm_1 (LSTM) (None, 32) 69760 embedding_1[0][0] #> ___________________________________________________________________________ -#> aux_input (InputLayer) (None, 5) 0 +#> aux_input (InputLayer) (None, 5) 0 #> ___________________________________________________________________________ -#> concatenate_1 (Concaten (None, 37) 0 lstm_1[0][0] -#> aux_input[0][0] +#> concatenate_1 (Concaten (None, 37) 0 lstm_1[0][0] +#> aux_input[0][0] #> ___________________________________________________________________________ -#> dense_6 (Dense) (None, 64) 2432 concatenate_1[0][0] +#> dense_6 (Dense) (None, 64) 2432 concatenate_1[0][0] #> ___________________________________________________________________________ -#> dense_7 (Dense) (None, 64) 4160 dense_6[0][0] +#> dense_7 (Dense) (None, 64) 4160 dense_6[0][0] #> ___________________________________________________________________________ -#> dense_8 (Dense) (None, 64) 4160 dense_7[0][0] +#> dense_8 (Dense) (None, 64) 4160 dense_7[0][0] #> ___________________________________________________________________________ -#> main_output (Dense) (None, 1) 65 dense_8[0][0] +#> main_output (Dense) (None, 1) 65 dense_8[0][0] #> ___________________________________________________________________________ -#> aux_output (Dense) (None, 1) 33 lstm_1[0][0] +#> aux_output (Dense) (None, 1) 33 lstm_1[0][0] #> =========================================================================== #> Total params: 5,200,610 #> Trainable params: 5,200,610 @@ -143,7 +143,7 @@ model %>% plot_model() ### Logistic regression: ``` r -c(4, 1) %>% +c(4, 1) %>% plot_deepviz() ``` @@ -152,7 +152,7 @@ c(4, 1) %>% ### One hidden layer: ``` r -c(4, 10, 1) %>% +c(4, 10, 1) %>% plot_deepviz() ``` @@ -161,7 +161,7 @@ c(4, 10, 1) %>% ### A multi-layer perceptron (two hidden layers): ``` r -c(4, 10, 10, 1) %>% +c(4, 10, 10, 1) %>% plot_deepviz() ``` @@ -170,7 +170,7 @@ c(4, 10, 10, 1) %>% ### Multi-class classification ``` r -c(4, 10, 10, 3) %>% +c(4, 10, 10, 3) %>% plot_deepviz() ``` From a6b3a83e9c8681fe618ea3bd626a38005ceaf688 Mon Sep 17 00:00:00 2001 From: nateGeorge Date: Mon, 15 Apr 2019 22:03:52 -0600 Subject: [PATCH 4/5] add note about saving models --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 102a122..2e690eb 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ model %>% plot_model() +Saving the model requires using `webshot`. See [Readme.Rmd](Readme.Rmd) for an example. + Add some more layers and plot ``` r From d668f6a2822575144b1d643de7e8906a84bf5b70 Mon Sep 17 00:00:00 2001 From: nateGeorge Date: Tue, 16 Apr 2019 17:27:08 -0600 Subject: [PATCH 5/5] fix link to .Rmd readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e690eb..60e83a8 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ model %>% plot_model() -Saving the model requires using `webshot`. See [Readme.Rmd](Readme.Rmd) for an example. +Saving the model requires using `webshot`. See [README.Rmd](README.Rmd) for an example. Add some more layers and plot