Keras: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
(Marked this version for translation)
Line 1: Line 1:
<languages />
<languages />
<translate>
<translate>
<!--T:1-->
"Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. It was developed with a focus on enabling fast experimentation."<ref>https://keras.io/</ref>
"Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. It was developed with a focus on enabling fast experimentation."<ref>https://keras.io/</ref>


==Installing==
==Installing== <!--T:2-->


<!--T:3-->
#Install either [[Tensorflow]], [[CTNK]] or [[Theano]].
#Install either [[Tensorflow]], [[CTNK]] or [[Theano]].
#Activate the Python virtual environment in which you installed one of the preceding package (assuming you used a virtual environment named <tt>$HOME/tensorflow</tt>),
#Activate the Python virtual environment in which you installed one of the preceding package (assuming you used a virtual environment named <tt>$HOME/tensorflow</tt>),
Line 13: Line 15:
|pip install keras}}
|pip install keras}}


=== R package ===
=== R package === <!--T:4-->


<!--T:5-->
This section details how to install Keras for R and use TensorFlow as the backend.
This section details how to install Keras for R and use TensorFlow as the backend.


<!--T:6-->
#Install TensorFlow for R by following the instructions provided [[Tensorflow#R_package | here]].
#Install TensorFlow for R by following the instructions provided [[Tensorflow#R_package | here]].
#Follow the instructions from the parent section.
#Follow the instructions from the parent section.
Line 29: Line 33:




<!--T:7-->
You are then good to go. Do not call <code>install_keras()</code> in R, as Keras and TensorFlow have already been installed in your virtual environment with pip. To use the Keras installed in your virtual environment, enter the following commands in R after the activation of the environment.
You are then good to go. Do not call <code>install_keras()</code> in R, as Keras and TensorFlow have already been installed in your virtual environment with pip. To use the Keras installed in your virtual environment, enter the following commands in R after the activation of the environment.
<syntaxhighlight lang='r'>
<syntaxhighlight lang='r'>
Line 35: Line 40:
</syntaxhighlight>
</syntaxhighlight>


== References ==
== References == <!--T:8-->
</translate>
</translate>

Revision as of 16:08, 21 January 2019

Other languages:

"Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. It was developed with a focus on enabling fast experimentation."[1]

Installing

  1. Install either Tensorflow, CTNK or Theano.
  2. Activate the Python virtual environment in which you installed one of the preceding package (assuming you used a virtual environment named $HOME/tensorflow),
    [name@server ~]$ source $HOME/tensorflow/bin/activate
    
  1. Install keras in your virtual environment.
    (tensorflow)_[name@server ~]$ pip install keras
    


R package

This section details how to install Keras for R and use TensorFlow as the backend.

  1. Install TensorFlow for R by following the instructions provided here.
  2. Follow the instructions from the parent section.
  3. Load the required modules :
    [name@server ~]$ module load gcc r/3.5.0
    
  1. Launch R
    [name@server ~]$ R
    
  1. In R, install package keras with devtools:
    devtools::install_github('rstudio/keras')
    


You are then good to go. Do not call install_keras() in R, as Keras and TensorFlow have already been installed in your virtual environment with pip. To use the Keras installed in your virtual environment, enter the following commands in R after the activation of the environment.

library(keras)
use_virtualenv(Sys.getenv('VIRTUAL_ENV'))

References