I don't see a package for doing Convolutional Neural Networks in R. Has anyone implemented this kind of algorithm in R?
-
$\begingroup$ don't think so, even if it was implemented, it would probably lack support for using. I would suggest Tensorflow or Skflow for python, caffe for C++ or caffe on spark for Apache Spark. $\endgroup$– GameOfThrowsMay 25, 2016 at 13:34
-
$\begingroup$ @GameOfThrows Thanks, I think you're right. I use Tensorflow and Caffe but I'd just like to use R. $\endgroup$– Hack-RMay 25, 2016 at 13:38
5 Answers
I guess there is no package for cnn but you can write your own convolutional layer. mxnet or h2o will be useful for it.
check this out:
http://dmlc.ml/rstats/2015/11/03/training-deep-net-with-R.html
The following 2 packages are available in R for deep neural network training:
darch: Package for Deep Architectures and Restricted Boltzmann Machines. The darch package is built on the basis of the code from G. E. Hinton and R. R. Salakhutdinov (available under Matlab Code for deep belief nets). This package is for generating neural networks with many layers (deep architectures), train them and fine tuning with common known training algorithms like backpropagation or conjugate gradients. Additionally, supervised fine-tuning can be enhanced with maxout and dropout, two recently developed techniques to improve fine-tuning for deep learning. CRAN link: http://cran.um.ac.ir/web/packages/darch/index.html
deepnet: deep learning toolkit in R. Implement some deep learning architectures and neural network algorithms, including BP,RBM,DBN,Deep autoencoder and so on. CRAN link: https://cran.r-project.org/web/packages/deepnet/index.html
-
$\begingroup$ Thanks for your answer. I've used both and did not think that they provided CNN algorithms? I just searched the documentation for both for the word convolutional and nothing came up. Do they actually have this functionality? $\endgroup$– Hack-RAug 20, 2016 at 12:01
I think mxnet is one of the best options if you code in R. They have an R wrapper but the core is in C++.
They have several examples in the web. One of them is the character recognition with MNIST database. They have support for multi-gpus and also for Spark.
-
$\begingroup$ Yes, also RNN, LSTM. They have many examples in their github $\endgroup$ Aug 20, 2016 at 12:10
-
$\begingroup$ Ah, yes thanks. I have used mxnet for image classification but didn't think it had CNN algorithms for the same. I see a CNN text classification example. I probably should've specified image classification. Still, perhaps it can be leveraged as such. I will look into it. Thanks! +1 $\endgroup$– Hack-RAug 20, 2016 at 13:38
The MXNetR package is an interface of the MXNet library written in C++. It contains feed-forward neural networks and convolutional neural networks (CNN) (MXNetR 2016a).
Tensorflow for R is available.
It provides full access to Tensorflow API, the Keras API, and Tensorflow Estimators.
Installation of Tensorflow (excerpt below) -> https://tensorflow.rstudio.com/tensorflow/
Installation
To get started, install the tensorflow R package from GitHub as follows:
devtools::install_github("rstudio/tensorflow")
Then, use the install_tensorflow() function to install TensorFlow:
library(tensorflow) install_tensorflow()
You can confirm that the installation succeeded with:
sess = tf$Session() hello <- tf$constant('Hello, TensorFlow!') sess$run(hello)
This will provide you with a default installation of TensorFlow suitable for getting started with the tensorflow R package. See the article on installation to learn about more advanced options, including installing a version of TensorFlow that takes advantage of Nvidia GPUs if you have the correct CUDA libraries installed.