Added: websites/staging/singa/trunk/content/v0.2.0/quick-start.html
==============================================================================
--- websites/staging/singa/trunk/content/v0.2.0/quick-start.html (added)
+++ websites/staging/singa/trunk/content/v0.2.0/quick-start.html Tue Apr 12 
06:24:50 2016
@@ -0,0 +1,482 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-04-12 
+ | Rendered using Apache Maven Fluido Skin 1.4
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20160412" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; Quick Start</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.4.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    
+    
+  
+    <script type="text/javascript" 
src="../js/apache-maven-fluido-1.4.min.js"></script>
+
+                          
+        
+<script 
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
 type="text/javascript"></script>
+                      
+        
+<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: 
[['$','$'], ['\\(','\\)']]}});</script>
+                      
+        
+<meta content="Apache SINGA" name="author"/>
+                      
+        
+<meta content="SINGA, Deep Learning, Distributed training" name="keywords"/>
+          
+                  </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+        
+    <a href="https://github.com/apache/incubator-singa";>
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 
10000;"
+        
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png";
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top navbar-inverse">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache 
SINGA <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../docs/overview.html"  
title="Introduction">Introduction</a>
+</li>
+                  
+                      <li>      <a href="../docs/quick-start.html"  
title="Quick Start">Quick Start</a>
+</li>
+                  
+                      <li>      <a href="../downloads.html"  
title="Downloads">Downloads</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">Documentaion <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li class="dropdown-submenu">
+                                      <a href="../docs/index.html"  
title="v0.3.0">v0.3.0</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../docs/index.html"  
title="English">English</a>
+</li>
+                                  <li>      <a href="../docs/zh/index.html"  
title="中文">中文</a>
+</li>
+                                  <li>      <a href="../docs/jp/index.html"  
title="日本語">日本語</a>
+</li>
+                                  <li>      <a href="../docs/kr/index.html"  
title="한국어">한국어</a>
+</li>
+                              </ul>
+            </li>
+                  
+                      <li>      <a href="../v0.2.0/index.html"  
title="v0.2.0">v0.2.0</a>
+</li>
+                  
+                      <li>      <a href="../v0.1.0/index.html"  
title="v0.1.0">v0.1.0</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../develop/schedule.html"  
title="Schedule">Schedule</a>
+</li>
+                  
+                      <li class="dropdown-submenu">
+                                      <a href="../develop/how-contribute.html" 
 title="How to Contribute">How to Contribute</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a 
href="../develop/contribute-code.html"  title="Code">Code</a>
+</li>
+                                  <li>      <a 
href="../develop/contribute-docs.html"  title="Documentation">Documentation</a>
+</li>
+                              </ul>
+            </li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../community/source-repository.html"  
title="Source Repository">Source Repository</a>
+</li>
+                  
+                      <li>      <a href="../community/mail-lists.html"  
title="Mailing Lists">Mailing Lists</a>
+</li>
+                  
+                      <li>      <a href="../community/issue-tracking.html"  
title="Issue Tracking">Issue Tracking</a>
+</li>
+                  
+                      <li>      <a href="../community/team-list.html"  
title="SINGA Team">SINGA Team</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">External 
Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://www.apache.org/";  
title="Apache Software Foundation">Apache Software Foundation</a>
+</li>
+                  
+                      <li>      <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/";  title="NUS Site">NUS 
Site</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                                  <a href="../index.html" 
id="bannerLeft" title="Apache SINGA">
+                                                                               
                 <img src="../images/singa-logo.png"  alt="Apache SINGA"/>
+                </a>
+                      </div>
+        <div class="pull-right">              <div id="bannerRight">
+                                                                               
                 <img src="../images/singa-title.png"  alt="Apache SINGA"/>
+                </div>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                              <li class="">
+                    <a href="../index.html" title="Apache SINGA">
+        Apache SINGA</a>
+                    <span class="divider">/</span>
+      </li>
+        <li class="active ">Quick Start</li>
+        
+                
+                    
+      
+                            </ul>
+      </div>
+
+                  
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Apache SINGA</li>
+                              
+      <li>
+  
+                          <a href="../docs/overview.html" title="Introduction">
+          <span class="none"></span>
+        Introduction</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../docs/quick-start.html" title="Quick 
Start">
+          <span class="none"></span>
+        Quick Start</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../downloads.html" title="Downloads">
+          <span class="none"></span>
+        Downloads</a>
+            </li>
+                              <li class="nav-header">Documentaion</li>
+                                                                               
                                                       
+      <li>
+  
+                          <a href="../docs/index.html" title="v0.3.0">
+          <span class="icon-chevron-right"></span>
+        v0.3.0</a>
+                  </li>
+                
+      <li>
+  
+                          <a href="../v0.2.0/index.html" title="v0.2.0">
+          <span class="none"></span>
+        v0.2.0</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../v0.1.0/index.html" title="v0.1.0">
+          <span class="none"></span>
+        v0.1.0</a>
+            </li>
+                              <li class="nav-header">Development</li>
+                              
+      <li>
+  
+                          <a href="../develop/schedule.html" title="Schedule">
+          <span class="none"></span>
+        Schedule</a>
+            </li>
+                                                                               
     
+      <li>
+  
+                          <a href="../develop/how-contribute.html" title="How 
to Contribute">
+          <span class="icon-chevron-right"></span>
+        How to Contribute</a>
+                  </li>
+                              <li class="nav-header">Community</li>
+                              
+      <li>
+  
+                          <a href="../community/source-repository.html" 
title="Source Repository">
+          <span class="none"></span>
+        Source Repository</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/mail-lists.html" 
title="Mailing Lists">
+          <span class="none"></span>
+        Mailing Lists</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/issue-tracking.html" 
title="Issue Tracking">
+          <span class="none"></span>
+        Issue Tracking</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/team-list.html" title="SINGA 
Team">
+          <span class="none"></span>
+        SINGA Team</a>
+            </li>
+                              <li class="nav-header">External Links</li>
+                              
+      <li>
+  
+                          <a href="http://www.apache.org/"; 
class="externalLink" title="Apache Software Foundation">
+          <span class="none"></span>
+        Apache Software Foundation</a>
+            </li>
+                
+      <li>
+  
+                          <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/"; class="externalLink" 
title="NUS Site">
+          <span class="none"></span>
+        NUS Site</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                               
                                    <a href="http://incubator.apache.org"; 
title="apache-incubator" class="builtBy">
+        <img class="builtBy"  alt="Apache Incubator" 
src="http://incubator.apache.org/images/egg-logo.png";    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                        
+        <div id="bodyColumn"  class="span10" >
+                                  
+            <h1>Quick Start</h1>
+<hr />
+<div class="section">
+<h2><a name="SINGA_setup"></a>SINGA setup</h2>
+<p>Please refer to the <a href="installation.html">installation</a> page for 
guidance on installing SINGA.</p>
+<div class="section">
+<h3><a name="Starting_Zookeeper"></a>Starting Zookeeper</h3>
+<p>SINGA uses <a class="externalLink" 
href="https://zookeeper.apache.org/";>zookeeper</a> to coordinate the training. 
Please make sure the zookeeper service is started before running SINGA.</p>
+<p>If you installed the zookeeper using our thirdparty script, you can simply 
start it by:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">#goto top level folder
+cd  SINGA_ROOT
+./bin/zk-service.sh start
+</pre></div></div>
+<p>(<tt>./bin/zk-service.sh stop</tt> stops the zookeeper).</p>
+<p>Otherwise, if you launched a zookeeper by yourself but not used the default 
port, please edit the <tt>conf/singa.conf</tt>:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">zookeeper_host: 
&quot;localhost:YOUR_PORT&quot;
+</pre></div></div></div></div>
+<div class="section">
+<h2><a name="Running_in_standalone_mode"></a>Running in standalone mode</h2>
+<p>Running SINGA in standalone mode is on the contrary of running it using 
cluster managers like <a class="externalLink" 
href="http://mesos.apache.org/";>Mesos</a> or <a class="externalLink" 
href="http://hadoop.apache.org/docs/current/hadoop-yarn/hadoop-yarn-site/YARN.html";>YARN</a>.</p>
+<div class="section">
+<h3><a name="Training_on_a_single_node"></a>Training on a single node</h3>
+<p>For single node training, one process will be launched to run SINGA at 
local host. We train the <a class="externalLink" 
href="http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks";>CNN
 model</a> over the <a class="externalLink" 
href="http://www.cs.toronto.edu/~kriz/cifar.html";>CIFAR-10</a> dataset as an 
example. The hyper-parameters are set following <a class="externalLink" 
href="https://code.google.com/p/cuda-convnet/";>cuda-convnet</a>. More details 
is available at <a href="cnn.html">CNN example</a>.</p>
+<div class="section">
+<h4><a name="Preparing_data_and_job_configuration"></a>Preparing data and job 
configuration</h4>
+<p>Download the dataset and create the data shards for training and 
testing.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">cd examples/cifar10/
+cp Makefile.example Makefile
+make download
+make create
+</pre></div></div>
+<p>A training dataset and a test dataset are created under 
<i>cifar10-train-shard</i> and <i>cifar10-test-shard</i> folder respectively. 
An <i>image_mean.bin</i> file is also generated, which contains the feature 
mean of all images.</p>
+<p>Since all code used for training this CNN model is provided by SINGA as 
built-in implementation, there is no need to write any code. Instead, users 
just execute the running script (<i>../../bin/singa-run.sh</i>) by providing 
the job configuration file (<i>job.conf</i>). To code in SINGA, please refer to 
the <a href="programming-guide.html">programming guide</a>.</p></div>
+<div class="section">
+<h4><a name="Training_without_parallelism"></a>Training without 
parallelism</h4>
+<p>By default, the cluster topology has a single worker and a single server. 
In other words, neither the training data nor the neural net is partitioned.</p>
+<p>The training is started by running:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># goto top level folder
+cd ../../
+./bin/singa-run.sh -conf examples/cifar10/job.conf
+</pre></div></div>
+<p>You can list the current running jobs by,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">./bin/singa-console.sh list
+
+JOB ID    |NUM PROCS
+----------|-----------
+24        |1
+</pre></div></div>
+<p>Jobs can be killed by,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">./bin/singa-console.sh kill JOB_ID
+</pre></div></div>
+<p>Logs and job information are available in <i>/tmp/singa-log</i> folder, 
which can be changed to other folders by setting <tt>log-dir</tt> in 
<i>conf/singa.conf</i>.</p></div>
+<div class="section">
+<h4><a name="Asynchronous_parallel_training"></a>Asynchronous parallel 
training</h4>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># job.conf
+...
+cluster {
+  nworker_groups: 2
+  nworkers_per_procs: 2
+  workspace: &quot;examples/cifar10/&quot;
+}
+</pre></div></div>
+<p>In SINGA, <a href="architecture.html">asynchronous training</a> is enabled 
by launching multiple worker groups. For example, we can change the original 
<i>job.conf</i> to have two worker groups as shown above. By default, each 
worker group has one worker. Since one process is set to contain two workers. 
The two worker groups will run in the same process. Consequently, they run the 
in-memory <a href="frameworks.html">Downpour</a> training framework. Users do 
not need to split the dataset explicitly for each worker (group); instead, they 
can assign each worker (group) a random offset to the start of the dataset. The 
workers would run as on different data partitions.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># job.conf
+...
+neuralnet {
+  layer {
+    ...
+    sharddata_conf {
+      random_skip: 5000
+    }
+  }
+  ...
+}
+</pre></div></div>
+<p>The running command is:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">./bin/singa-run.sh -conf 
examples/cifar10/job.conf
+</pre></div></div></div>
+<div class="section">
+<h4><a name="Synchronous_parallel_training"></a>Synchronous parallel 
training</h4>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># job.conf
+...
+cluster {
+  nworkers_per_group: 2
+  nworkers_per_procs: 2
+  workspace: &quot;examples/cifar10/&quot;
+}
+</pre></div></div>
+<p>In SINGA, <a href="architecture.html">asynchronous training</a> is enabled 
by launching multiple workers within one worker group. For instance, we can 
change the original <i>job.conf</i> to have two workers in one worker group as 
shown above. The workers will run synchronously as they are from the same 
worker group. This framework is the in-memory <a 
href="frameworks.html">sandblaster</a>. The model is partitioned among the two 
workers. In specific, each layer is sliced over the two workers. The sliced 
layer is the same as the original layer except that it only has <tt>B/g</tt> 
feature instances, where <tt>B</tt> is the number of instances in a mini-batch, 
<tt>g</tt> is the number of workers in a group. It is also possible to 
partition the layer (or neural net) using <a href="neural-net.html">other 
schemes</a>. All other settings are the same as running without partitioning</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">./bin/singa-run.sh -conf 
examples/cifar10/job.conf
+</pre></div></div></div></div>
+<div class="section">
+<h3><a name="Training_in_a_cluster"></a>Training in a cluster</h3>
+<p>We can extend the above two training frameworks to a cluster by updating 
the cluster configuration with:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">nworker_per_procs: 1
+</pre></div></div>
+<p>Every process would then create only one worker thread. Consequently, the 
workers would be created in different processes (i.e., nodes). The 
<i>hostfile</i> must be provided under <i>SINGA_ROOT/conf/</i> specifying the 
nodes in the cluster, e.g.,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">logbase-a01
+logbase-a02
+</pre></div></div>
+<p>And the zookeeper location must be configured correctly, e.g.,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">#conf/singa.conf
+zookeeper_host: &quot;logbase-a01&quot;
+</pre></div></div>
+<p>The running command is the same as for single node training:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">./bin/singa-run.sh -conf 
examples/cifar10/job.conf
+</pre></div></div></div></div>
+<div class="section">
+<h2><a name="Running_with_Mesos"></a>Running with Mesos</h2>
+<p><i>working</i>&#x2026;</p></div>
+<div class="section">
+<h2><a name="Where_to_go_next"></a>Where to go next</h2>
+<p>The <a href="programming-guide.html">programming guide</a> pages will 
describe how to submit a training job in SINGA.</p></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+                      <div class="row-fluid">
+                                                                          
+<p>Copyright © 2015 The Apache Software Foundation. All rights reserved. 
Apache Singa, Apache, the Apache feather logo, and the Apache Singa project 
logos are trademarks of The Apache Software Foundation. All other marks 
mentioned may be trademarks or registered trademarks of their respective 
owners.</p>
+                          </div>
+
+        
+                </div>
+    </footer>
+        </body>
+</html>

Added: websites/staging/singa/trunk/content/v0.2.0/rbm.html
==============================================================================
--- websites/staging/singa/trunk/content/v0.2.0/rbm.html (added)
+++ websites/staging/singa/trunk/content/v0.2.0/rbm.html Tue Apr 12 06:24:50 
2016
@@ -0,0 +1,643 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-04-12 
+ | Rendered using Apache Maven Fluido Skin 1.4
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20160412" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; RBM Example</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.4.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    
+    
+  
+    <script type="text/javascript" 
src="../js/apache-maven-fluido-1.4.min.js"></script>
+
+                          
+        
+<script 
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
 type="text/javascript"></script>
+                      
+        
+<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: 
[['$','$'], ['\\(','\\)']]}});</script>
+                      
+        
+<meta content="Apache SINGA" name="author"/>
+                      
+        
+<meta content="SINGA, Deep Learning, Distributed training" name="keywords"/>
+          
+                  </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+        
+    <a href="https://github.com/apache/incubator-singa";>
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 
10000;"
+        
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png";
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top navbar-inverse">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache 
SINGA <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../docs/overview.html"  
title="Introduction">Introduction</a>
+</li>
+                  
+                      <li>      <a href="../docs/quick-start.html"  
title="Quick Start">Quick Start</a>
+</li>
+                  
+                      <li>      <a href="../downloads.html"  
title="Downloads">Downloads</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">Documentaion <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li class="dropdown-submenu">
+                                      <a href="../docs/index.html"  
title="v0.3.0">v0.3.0</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../docs/index.html"  
title="English">English</a>
+</li>
+                                  <li>      <a href="../docs/zh/index.html"  
title="中文">中文</a>
+</li>
+                                  <li>      <a href="../docs/jp/index.html"  
title="日本語">日本語</a>
+</li>
+                                  <li>      <a href="../docs/kr/index.html"  
title="한국어">한국어</a>
+</li>
+                              </ul>
+            </li>
+                  
+                      <li>      <a href="../v0.2.0/index.html"  
title="v0.2.0">v0.2.0</a>
+</li>
+                  
+                      <li>      <a href="../v0.1.0/index.html"  
title="v0.1.0">v0.1.0</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../develop/schedule.html"  
title="Schedule">Schedule</a>
+</li>
+                  
+                      <li class="dropdown-submenu">
+                                      <a href="../develop/how-contribute.html" 
 title="How to Contribute">How to Contribute</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a 
href="../develop/contribute-code.html"  title="Code">Code</a>
+</li>
+                                  <li>      <a 
href="../develop/contribute-docs.html"  title="Documentation">Documentation</a>
+</li>
+                              </ul>
+            </li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../community/source-repository.html"  
title="Source Repository">Source Repository</a>
+</li>
+                  
+                      <li>      <a href="../community/mail-lists.html"  
title="Mailing Lists">Mailing Lists</a>
+</li>
+                  
+                      <li>      <a href="../community/issue-tracking.html"  
title="Issue Tracking">Issue Tracking</a>
+</li>
+                  
+                      <li>      <a href="../community/team-list.html"  
title="SINGA Team">SINGA Team</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">External 
Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://www.apache.org/";  
title="Apache Software Foundation">Apache Software Foundation</a>
+</li>
+                  
+                      <li>      <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/";  title="NUS Site">NUS 
Site</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                                  <a href="../index.html" 
id="bannerLeft" title="Apache SINGA">
+                                                                               
                 <img src="../images/singa-logo.png"  alt="Apache SINGA"/>
+                </a>
+                      </div>
+        <div class="pull-right">              <div id="bannerRight">
+                                                                               
                 <img src="../images/singa-title.png"  alt="Apache SINGA"/>
+                </div>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                              <li class="">
+                    <a href="../index.html" title="Apache SINGA">
+        Apache SINGA</a>
+                    <span class="divider">/</span>
+      </li>
+        <li class="active ">RBM Example</li>
+        
+                
+                    
+      
+                            </ul>
+      </div>
+
+                  
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Apache SINGA</li>
+                              
+      <li>
+  
+                          <a href="../docs/overview.html" title="Introduction">
+          <span class="none"></span>
+        Introduction</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../docs/quick-start.html" title="Quick 
Start">
+          <span class="none"></span>
+        Quick Start</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../downloads.html" title="Downloads">
+          <span class="none"></span>
+        Downloads</a>
+            </li>
+                              <li class="nav-header">Documentaion</li>
+                                                                               
                                                       
+      <li>
+  
+                          <a href="../docs/index.html" title="v0.3.0">
+          <span class="icon-chevron-right"></span>
+        v0.3.0</a>
+                  </li>
+                
+      <li>
+  
+                          <a href="../v0.2.0/index.html" title="v0.2.0">
+          <span class="none"></span>
+        v0.2.0</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../v0.1.0/index.html" title="v0.1.0">
+          <span class="none"></span>
+        v0.1.0</a>
+            </li>
+                              <li class="nav-header">Development</li>
+                              
+      <li>
+  
+                          <a href="../develop/schedule.html" title="Schedule">
+          <span class="none"></span>
+        Schedule</a>
+            </li>
+                                                                               
     
+      <li>
+  
+                          <a href="../develop/how-contribute.html" title="How 
to Contribute">
+          <span class="icon-chevron-right"></span>
+        How to Contribute</a>
+                  </li>
+                              <li class="nav-header">Community</li>
+                              
+      <li>
+  
+                          <a href="../community/source-repository.html" 
title="Source Repository">
+          <span class="none"></span>
+        Source Repository</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/mail-lists.html" 
title="Mailing Lists">
+          <span class="none"></span>
+        Mailing Lists</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/issue-tracking.html" 
title="Issue Tracking">
+          <span class="none"></span>
+        Issue Tracking</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/team-list.html" title="SINGA 
Team">
+          <span class="none"></span>
+        SINGA Team</a>
+            </li>
+                              <li class="nav-header">External Links</li>
+                              
+      <li>
+  
+                          <a href="http://www.apache.org/"; 
class="externalLink" title="Apache Software Foundation">
+          <span class="none"></span>
+        Apache Software Foundation</a>
+            </li>
+                
+      <li>
+  
+                          <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/"; class="externalLink" 
title="NUS Site">
+          <span class="none"></span>
+        NUS Site</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                               
                                    <a href="http://incubator.apache.org"; 
title="apache-incubator" class="builtBy">
+        <img class="builtBy"  alt="Apache Incubator" 
src="http://incubator.apache.org/images/egg-logo.png";    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                        
+        <div id="bodyColumn"  class="span10" >
+                                  
+            <h1>RBM Example</h1>
+<hr />
+<p>This example uses SINGA to train 4 RBM models and one auto-encoder model 
over the <a class="externalLink" href="http://yann.lecun.com/exdb/mnist/";>MNIST 
dataset</a>. The auto-encoder model is trained to reduce the dimensionality of 
the MNIST image feature. The RBM models are trained to initialize parameters of 
the auto-encoder model. This example application is from <a 
class="externalLink" 
href="http://www.cs.toronto.edu/~hinton/science.pdf";>Hinton&#x2019;s science 
paper</a>.</p>
+<div class="section">
+<h2><a name="Running_instructions"></a>Running instructions</h2>
+<p>Running scripts are provided in <i>SINGA_ROOT/examples/rbm</i> folder.</p>
+<p>The MNIST dataset has 70,000 handwritten digit images. The <a 
href="data.html">data preparation</a> page has details on converting this 
dataset into SINGA recognizable format. Users can simply run the following 
commands to download and convert the dataset.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># at SINGA_ROOT/examples/mnist/
+$ cp Makefile.example Makefile
+$ make download
+$ make create
+</pre></div></div>
+<p>The training is separated into two phases, namely pre-training and 
fine-tuning. The pre-training phase trains 4 RBMs in sequence,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># at SINGA_ROOT/
+$ ./bin/singa-run.sh -conf examples/rbm/rbm1.conf
+$ ./bin/singa-run.sh -conf examples/rbm/rbm2.conf
+$ ./bin/singa-run.sh -conf examples/rbm/rbm3.conf
+$ ./bin/singa-run.sh -conf examples/rbm/rbm4.conf
+</pre></div></div>
+<p>The fine-tuning phase trains the auto-encoder by,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">$ ./bin/singa-run.sh -conf 
examples/rbm/autoencoder.conf
+</pre></div></div></div>
+<div class="section">
+<h2><a name="Training_details"></a>Training details</h2>
+<div class="section">
+<h3><a name="RBM1"></a>RBM1</h3>
+<p><img src="../images/example-rbm1.png" align="center" width="200px" alt="" 
/> <span><b>Figure 1 - RBM1.</b></span></p>
+<p>The neural net structure for training RBM1 is shown in Figure 1. The data 
layer and parser layer provides features for training RBM1. The visible layer 
(connected with parser layer) of RBM1 accepts the image feature (784 
dimension). The hidden layer is set to have 1000 neurons (units). These two 
layers are configured as,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">layer{
+  name: &quot;RBMVis&quot;
+  type: kRBMVis
+  srclayers:&quot;mnist&quot;
+  srclayers:&quot;RBMHid&quot;
+  rbm_conf{
+    hdim: 1000
+  }
+  param{
+    name: &quot;w1&quot;
+    init{
+      type: kGaussian
+      mean: 0.0
+      std: 0.1
+    }
+  }
+  param{
+    name: &quot;b11&quot;
+    init{
+      type: kConstant
+      value: 0.0
+    }
+  }
+}
+
+layer{
+  name: &quot;RBMHid&quot;
+  type: kRBMHid
+  srclayers:&quot;RBMVis&quot;
+  rbm_conf{
+    hdim: 1000
+  }
+  param{
+    name: &quot;w1_&quot;
+    share_from: &quot;w1&quot;
+  }
+  param{
+    name: &quot;b12&quot;
+    init{
+      type: kConstant
+      value: 0.0
+    }
+  }
+}
+</pre></div></div>
+<p>For RBM, the weight matrix is shared by the visible and hidden layers. For 
instance, <tt>w1</tt> is shared by <tt>vis</tt> and <tt>hid</tt> layers shown 
in Figure 1. In SINGA, we can configure the <tt>share_from</tt> field to enable 
<a href="param.html">parameter sharing</a> as shown above for the param 
<tt>w1</tt> and <tt>w1_</tt>.</p>
+<p><a href="train-one-batch.html#contrastive-divergence">Contrastive 
Divergence</a> is configured as the algorithm for <a 
href="train-one-batch.html">TrainOneBatch</a>. Following Hinton&#x2019;s paper, 
we configure the <a href="updater.html">updating protocol</a> as follows,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># Updater Configuration
+updater{
+  type: kSGD
+  momentum: 0.2
+  weight_decay: 0.0002
+  learning_rate{
+    base_lr: 0.1
+    type: kFixed
+  }
+}
+</pre></div></div>
+<p>Since the parameters of RBM0 will be used to initialize the auto-encoder, 
we should configure the <tt>workspace</tt> field to specify a path for the 
checkpoint folder. For example, if we configure it as,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">cluster {
+  workspace: &quot;examples/rbm/rbm1/&quot;
+}
+</pre></div></div>
+<p>Then SINGA will <a href="checkpoint.html">checkpoint the parameters</a> 
into <i>examples/rbm/rbm1/</i>.</p></div>
+<div class="section">
+<h3><a name="RBM1"></a>RBM1</h3>
+<p><img src="../images/example-rbm2.png" align="center" width="200px" alt="" 
/> <span><b>Figure 2 - RBM2.</b></span></p>
+<p>Figure 2 shows the net structure of training RBM2. The visible units of 
RBM2 accept the output from the Sigmoid1 layer. The Inner1 layer is a 
<tt>InnerProductLayer</tt> whose parameters are set to the <tt>w1</tt> and 
<tt>b12</tt> learned from RBM1. The neural net configuration is (with layers 
for data layer and parser layer omitted).</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">layer{
+  name: &quot;Inner1&quot;
+  type: kInnerProduct
+  srclayers:&quot;mnist&quot;
+  innerproduct_conf{
+    num_output: 1000
+  }
+  param{ name: &quot;w1&quot; }
+  param{ name: &quot;b12&quot;}
+}
+
+layer{
+  name: &quot;Sigmoid1&quot;
+  type: kSigmoid
+  srclayers:&quot;Inner1&quot;
+}
+
+layer{
+  name: &quot;RBMVis&quot;
+  type: kRBMVis
+  srclayers:&quot;Sigmoid1&quot;
+  srclayers:&quot;RBMHid&quot;
+  rbm_conf{
+    hdim: 500
+  }
+  param{
+    name: &quot;w2&quot;
+    ...
+  }
+  param{
+    name: &quot;b21&quot;
+    ...
+  }
+}
+
+layer{
+  name: &quot;RBMHid&quot;
+  type: kRBMHid
+  srclayers:&quot;RBMVis&quot;
+  rbm_conf{
+    hdim: 500
+  }
+  param{
+    name: &quot;w2_&quot;
+    share_from: &quot;w2&quot;
+  }
+  param{
+    name: &quot;b22&quot;
+    ...
+  }
+}
+</pre></div></div>
+<p>To load w0 and b02 from RBM0&#x2019;s checkpoint file, we configure the 
<tt>checkpoint_path</tt> as,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">checkpoint_path: 
&quot;examples/rbm/rbm1/checkpoint/step6000-worker0&quot;
+cluster{
+  workspace: &quot;examples/rbm/rbm2&quot;
+}
+</pre></div></div>
+<p>The workspace is changed for checkpointing <tt>w2</tt>, <tt>b21</tt> and 
<tt>b22</tt> into <i>examples/rbm/rbm2/</i>.</p></div>
+<div class="section">
+<h3><a name="RBM3"></a>RBM3</h3>
+<p><img src="../images/example-rbm3.png" align="center" width="200px" alt="" 
/> <span><b>Figure 3 - RBM3.</b></span></p>
+<p>Figure 3 shows the net structure of training RBM3. In this model, a layer 
with 250 units is added as the hidden layer of RBM3. The visible units of RBM3 
accepts output from Sigmoid2 layer. Parameters of Inner1 and Innner2 are set to 
<tt>w1,b12,w2,b22</tt> which can be load from the checkpoint file of RBM2, 
i.e., &#x201c;examples/rbm/rbm2/&#x201d;.</p></div>
+<div class="section">
+<h3><a name="RBM4"></a>RBM4</h3>
+<p><img src="../images/example-rbm4.png" align="center" width="200px" alt="" 
/> <span><b>Figure 4 - RBM4.</b></span></p>
+<p>Figure 4 shows the net structure of training RBM4. It is similar to Figure 
3, but according to <a class="externalLink" 
href="http://www.cs.toronto.edu/~hinton/science.pdf";>Hinton&#x2019;s science 
paper</a>, the hidden units of the top RBM (RBM4) have stochastic real-valued 
states drawn from a unit variance Gaussian whose mean is determined by the 
input from the RBM&#x2019;s logistic visible units. So we add a 
<tt>gaussian</tt> field in the RBMHid layer to control the sampling 
distribution (Gaussian or Bernoulli). In addition, this RBM has a much smaller 
learning rate (0.001). The neural net configuration for the RBM4 and the 
updating protocol is (with layers for data layer and parser layer omitted),</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># Updater Configuration
+updater{
+  type: kSGD
+  momentum: 0.9
+  weight_decay: 0.0002
+  learning_rate{
+    base_lr: 0.001
+    type: kFixed
+  }
+}
+
+layer{
+  name: &quot;RBMVis&quot;
+  type: kRBMVis
+  srclayers:&quot;Sigmoid3&quot;
+  srclayers:&quot;RBMHid&quot;
+  rbm_conf{
+    hdim: 30
+  }
+  param{
+    name: &quot;w4&quot;
+    ...
+  }
+  param{
+    name: &quot;b41&quot;
+    ...
+  }
+}
+
+layer{
+  name: &quot;RBMHid&quot;
+  type: kRBMHid
+  srclayers:&quot;RBMVis&quot;
+  rbm_conf{
+    hdim: 30
+    gaussian: true
+  }
+  param{
+    name: &quot;w4_&quot;
+    share_from: &quot;w4&quot;
+  }
+  param{
+    name: &quot;b42&quot;
+    ...
+  }
+}
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Auto-encoder"></a>Auto-encoder</h3>
+<p>In the fine-tuning stage, the 4 RBMs are &#x201c;unfolded&#x201d; to form 
encoder and decoder networks that are initialized using the parameters from the 
previous 4 RBMs.</p>
+<p><img src="../images/example-autoencoder.png" align="center" width="500px" 
alt="" /> <span><b>Figure 5 - Auto-Encoders.</b></span></p>
+<p>Figure 5 shows the neural net structure for training the auto-encoder. <a 
href="train-one-batch.html">Back propagation (kBP)</a> is configured as the 
algorithm for <tt>TrainOneBatch</tt>. We use the same cluster configuration as 
RBM models. For updater, we use <a 
href="updater.html#adagradupdater">AdaGrad</a> algorithm with fixed learning 
rate.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">### Updater Configuration
+updater{
+  type: kAdaGrad
+  learning_rate{
+  base_lr: 0.01
+  type: kFixed
+  }
+}
+</pre></div></div>
+<p>According to <a class="externalLink" 
href="http://www.cs.toronto.edu/~hinton/science.pdf";>Hinton&#x2019;s science 
paper</a>, we configure a EuclideanLoss layer to compute the reconstruction 
error. The neural net configuration is (with some of the middle layers 
omitted),</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">layer{ name: &quot;data&quot; }
+layer{ name:&quot;mnist&quot; }
+layer{
+  name: &quot;Inner1&quot;
+  param{ name: &quot;w1&quot; }
+  param{ name: &quot;b12&quot; }
+}
+layer{ name: &quot;Sigmoid1&quot; }
+...
+layer{
+  name: &quot;Inner8&quot;
+  innerproduct_conf{
+    num_output: 784
+    transpose: true
+  }
+  param{
+    name: &quot;w8&quot;
+    share_from: &quot;w1&quot;
+  }
+  param{ name: &quot;b11&quot; }
+}
+layer{ name: &quot;Sigmoid8&quot; }
+
+# Euclidean Loss Layer Configuration
+layer{
+  name: &quot;loss&quot;
+  type:kEuclideanLoss
+  srclayers:&quot;Sigmoid8&quot;
+  srclayers:&quot;mnist&quot;
+}
+</pre></div></div>
+<p>To load pre-trained parameters from the 4 RBMs&#x2019; checkpoint file we 
configure <tt>checkpoint_path</tt> as</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">### Checkpoint Configuration
+checkpoint_path: 
&quot;examples/rbm/checkpoint/rbm1/checkpoint/step6000-worker0&quot;
+checkpoint_path: 
&quot;examples/rbm/checkpoint/rbm2/checkpoint/step6000-worker0&quot;
+checkpoint_path: 
&quot;examples/rbm/checkpoint/rbm3/checkpoint/step6000-worker0&quot;
+checkpoint_path: 
&quot;examples/rbm/checkpoint/rbm4/checkpoint/step6000-worker0&quot;
+</pre></div></div></div></div>
+<div class="section">
+<h2><a name="Visualization_Results"></a>Visualization Results</h2>
+
+<div>
+<img src="../images/rbm-weight.PNG" align="center" width="300px" alt="" />
+
+<img src="../images/rbm-feature.PNG" align="center" width="300px" alt="" />
+<br />
+<span><b>Figure 6 - Bottom RBM weight matrix.</b></span>
+&#160;
+&#160;
+&#160;
+&#160;
+
+<span><b>Figure 7 - Top layer features.</b></span>
+</div>
+<p>Figure 6 visualizes sample columns of the weight matrix of RBM1, We can see 
the Gabor-like filters are learned. Figure 7 depicts the features extracted 
from the top-layer of the auto-encoder, wherein one point represents one image. 
Different colors represent different digits. We can see that most images are 
well clustered according to the ground truth.</p></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+                      <div class="row-fluid">
+                                                                          
+<p>Copyright © 2015 The Apache Software Foundation. All rights reserved. 
Apache Singa, Apache, the Apache feather logo, and the Apache Singa project 
logos are trademarks of The Apache Software Foundation. All other marks 
mentioned may be trademarks or registered trademarks of their respective 
owners.</p>
+                          </div>
+
+        
+                </div>
+    </footer>
+        </body>
+</html>

Added: websites/staging/singa/trunk/content/v0.2.0/rnn.html
==============================================================================
--- websites/staging/singa/trunk/content/v0.2.0/rnn.html (added)
+++ websites/staging/singa/trunk/content/v0.2.0/rnn.html Tue Apr 12 06:24:50 
2016
@@ -0,0 +1,674 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-04-12 
+ | Rendered using Apache Maven Fluido Skin 1.4
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20160412" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; Recurrent Neural Networks for Language 
Modelling</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.4.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    
+    
+  
+    <script type="text/javascript" 
src="../js/apache-maven-fluido-1.4.min.js"></script>
+
+                          
+        
+<script 
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
 type="text/javascript"></script>
+                      
+        
+<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: 
[['$','$'], ['\\(','\\)']]}});</script>
+                      
+        
+<meta content="Apache SINGA" name="author"/>
+                      
+        
+<meta content="SINGA, Deep Learning, Distributed training" name="keywords"/>
+          
+                  </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+        
+    <a href="https://github.com/apache/incubator-singa";>
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 
10000;"
+        
src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png";
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top navbar-inverse">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache 
SINGA <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../docs/overview.html"  
title="Introduction">Introduction</a>
+</li>
+                  
+                      <li>      <a href="../docs/quick-start.html"  
title="Quick Start">Quick Start</a>
+</li>
+                  
+                      <li>      <a href="../downloads.html"  
title="Downloads">Downloads</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">Documentaion <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li class="dropdown-submenu">
+                                      <a href="../docs/index.html"  
title="v0.3.0">v0.3.0</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../docs/index.html"  
title="English">English</a>
+</li>
+                                  <li>      <a href="../docs/zh/index.html"  
title="中文">中文</a>
+</li>
+                                  <li>      <a href="../docs/jp/index.html"  
title="日本語">日本語</a>
+</li>
+                                  <li>      <a href="../docs/kr/index.html"  
title="한국어">한국어</a>
+</li>
+                              </ul>
+            </li>
+                  
+                      <li>      <a href="../v0.2.0/index.html"  
title="v0.2.0">v0.2.0</a>
+</li>
+                  
+                      <li>      <a href="../v0.1.0/index.html"  
title="v0.1.0">v0.1.0</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../develop/schedule.html"  
title="Schedule">Schedule</a>
+</li>
+                  
+                      <li class="dropdown-submenu">
+                                      <a href="../develop/how-contribute.html" 
 title="How to Contribute">How to Contribute</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a 
href="../develop/contribute-code.html"  title="Code">Code</a>
+</li>
+                                  <li>      <a 
href="../develop/contribute-docs.html"  title="Documentation">Documentation</a>
+</li>
+                              </ul>
+            </li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../community/source-repository.html"  
title="Source Repository">Source Repository</a>
+</li>
+                  
+                      <li>      <a href="../community/mail-lists.html"  
title="Mailing Lists">Mailing Lists</a>
+</li>
+                  
+                      <li>      <a href="../community/issue-tracking.html"  
title="Issue Tracking">Issue Tracking</a>
+</li>
+                  
+                      <li>      <a href="../community/team-list.html"  
title="SINGA Team">SINGA Team</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">External 
Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://www.apache.org/";  
title="Apache Software Foundation">Apache Software Foundation</a>
+</li>
+                  
+                      <li>      <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/";  title="NUS Site">NUS 
Site</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                                  <a href="../index.html" 
id="bannerLeft" title="Apache SINGA">
+                                                                               
                 <img src="../images/singa-logo.png"  alt="Apache SINGA"/>
+                </a>
+                      </div>
+        <div class="pull-right">              <div id="bannerRight">
+                                                                               
                 <img src="../images/singa-title.png"  alt="Apache SINGA"/>
+                </div>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                              <li class="">
+                    <a href="../index.html" title="Apache SINGA">
+        Apache SINGA</a>
+                    <span class="divider">/</span>
+      </li>
+        <li class="active ">Recurrent Neural Networks for Language 
Modelling</li>
+        
+                
+                    
+      
+                            </ul>
+      </div>
+
+                  
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Apache SINGA</li>
+                              
+      <li>
+  
+                          <a href="../docs/overview.html" title="Introduction">
+          <span class="none"></span>
+        Introduction</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../docs/quick-start.html" title="Quick 
Start">
+          <span class="none"></span>
+        Quick Start</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../downloads.html" title="Downloads">
+          <span class="none"></span>
+        Downloads</a>
+            </li>
+                              <li class="nav-header">Documentaion</li>
+                                                                               
                                                       
+      <li>
+  
+                          <a href="../docs/index.html" title="v0.3.0">
+          <span class="icon-chevron-right"></span>
+        v0.3.0</a>
+                  </li>
+                
+      <li>
+  
+                          <a href="../v0.2.0/index.html" title="v0.2.0">
+          <span class="none"></span>
+        v0.2.0</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../v0.1.0/index.html" title="v0.1.0">
+          <span class="none"></span>
+        v0.1.0</a>
+            </li>
+                              <li class="nav-header">Development</li>
+                              
+      <li>
+  
+                          <a href="../develop/schedule.html" title="Schedule">
+          <span class="none"></span>
+        Schedule</a>
+            </li>
+                                                                               
     
+      <li>
+  
+                          <a href="../develop/how-contribute.html" title="How 
to Contribute">
+          <span class="icon-chevron-right"></span>
+        How to Contribute</a>
+                  </li>
+                              <li class="nav-header">Community</li>
+                              
+      <li>
+  
+                          <a href="../community/source-repository.html" 
title="Source Repository">
+          <span class="none"></span>
+        Source Repository</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/mail-lists.html" 
title="Mailing Lists">
+          <span class="none"></span>
+        Mailing Lists</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/issue-tracking.html" 
title="Issue Tracking">
+          <span class="none"></span>
+        Issue Tracking</a>
+            </li>
+                
+      <li>
+  
+                          <a href="../community/team-list.html" title="SINGA 
Team">
+          <span class="none"></span>
+        SINGA Team</a>
+            </li>
+                              <li class="nav-header">External Links</li>
+                              
+      <li>
+  
+                          <a href="http://www.apache.org/"; 
class="externalLink" title="Apache Software Foundation">
+          <span class="none"></span>
+        Apache Software Foundation</a>
+            </li>
+                
+      <li>
+  
+                          <a 
href="http://www.comp.nus.edu.sg/~dbsystem/singa/"; class="externalLink" 
title="NUS Site">
+          <span class="none"></span>
+        NUS Site</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                               
                                    <a href="http://incubator.apache.org"; 
title="apache-incubator" class="builtBy">
+        <img class="builtBy"  alt="Apache Incubator" 
src="http://incubator.apache.org/images/egg-logo.png";    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                        
+        <div id="bodyColumn"  class="span10" >
+                                  
+            <h1>Recurrent Neural Networks for Language Modelling</h1>
+<hr />
+<p>Recurrent Neural Networks (RNN) are widely used for modelling sequential 
data, such as music and sentences. In this example, we use SINGA to train a <a 
class="externalLink" 
href="http://www.fit.vutbr.cz/research/groups/speech/publi/2010/mikolov_interspeech2010_IS100722.pdf";>RNN
 model</a> proposed by Tomas Mikolov for <a class="externalLink" 
href="https://en.wikipedia.org/wiki/Language_model";>language modeling</a>. The 
training objective (loss) is to minimize the <a class="externalLink" 
href="https://en.wikipedia.org/wiki/Perplexity";>perplexity per word</a>, which 
is equivalent to maximize the probability of predicting the next word given the 
current word in a sentence.</p>
+<p>Different to the <a href="cnn.html">CNN</a>, <a href="mlp.html">MLP</a> and 
<a href="rbm.html">RBM</a> examples which use built-in layers(layer) and 
records(data), none of the layers in this example are built-in. Hence users 
would learn to implement their own layers and data records through this 
example.</p>
+<div class="section">
+<h2><a name="Running_instructions"></a>Running instructions</h2>
+<p>In <i>SINGA_ROOT/examples/rnnlm/</i>, scripts are provided to run the 
training job. First, the data is prepared by</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">$ cp Makefile.example Makefile
+$ make download
+$ make create
+</pre></div></div>
+<p>Second, to compile the source code under <i>examples/rnnlm/</i>, run</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">$ make rnnlm
+</pre></div></div>
+<p>An executable file <i>rnnlm.bin</i> will be generated.</p>
+<p>Third, the training is started by passing <i>rnnlm.bin</i> and the job 
configuration to <i>singa-run.sh</i>,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># at SINGA_ROOT/
+# export LD_LIBRARY_PATH=.libs:$LD_LIBRARY_PATH
+$ ./bin/singa-run.sh -exec examples/rnnlm/rnnlm.bin -conf 
examples/rnnlm/job.conf
+</pre></div></div></div>
+<div class="section">
+<h2><a name="Implementations"></a>Implementations</h2>
+<p><img src="../images/rnnlm.png" align="center" width="400px" alt="" /> 
<span><b>Figure 1 - Net structure of the RNN model.</b></span></p>
+<p>The neural net structure is shown Figure 1. Word records are loaded by 
<tt>DataLayer</tt>. For every iteration, at most <tt>max_window</tt> word 
records are processed. If a sentence ending character is read, the 
<tt>DataLayer</tt> stops loading immediately. <tt>EmbeddingLayer</tt> looks up 
a word embedding matrix to extract feature vectors for words loaded by the 
<tt>DataLayer</tt>. These features are transformed by the <tt>HiddenLayer</tt> 
which propagates the features from left to right. The output feature for word 
at position k is influenced by words from position 0 to k-1. Finally, 
<tt>LossLayer</tt> computes the cross-entropy loss (see below) by predicting 
the next word of each word. The cross-entropy loss is computed as</p>
+<p><tt>$$L(w_t)=-log P(w_{t+1}|w_t)$$</tt></p>
+<p>Given <tt>$w_t$</tt> the above equation would compute over all words in the 
vocabulary, which is time consuming. <a class="externalLink" 
href="https://f25ea9ccb7d3346ce6891573d543960492b92c30.googledrive.com/host/0ByxdPXuxLPS5RFM5dVNvWVhTd0U/rnnlm-0.4b.tgz";>RNNLM
 Toolkit</a> accelerates the computation as</p>
+<p><tt>$$P(w_{t+1}|w_t) = P(C_{w_{t+1}}|w_t) * 
P(w_{t+1}|C_{w_{t+1}})$$</tt></p>
+<p>Words from the vocabulary are partitioned into a user-defined number of 
classes. The first term on the left side predicts the class of the next word, 
and then predicts the next word given its class. Both the number of classes and 
the words from one class are much smaller than the vocabulary size. The 
probabilities can be calculated much faster.</p>
+<p>The perplexity per word is computed by,</p>
+<p><tt>$$PPL = 10^{- avg_t log_{10} P(w_{t+1}|w_t)}$$</tt></p>
+<div class="section">
+<h3><a name="Data_preparation"></a>Data preparation</h3>
+<p>We use a small dataset provided by the <a class="externalLink" 
href="https://f25ea9ccb7d3346ce6891573d543960492b92c30.googledrive.com/host/0ByxdPXuxLPS5RFM5dVNvWVhTd0U/rnnlm-0.4b.tgz";>RNNLM
 Toolkit</a>. It has 10,000 training sentences, with 71350 words in total and 
3720 unique words. The subsequent steps follow the instructions in <a 
href="data.html">Data Preparation</a> to convert the raw data into records and 
insert them into data stores.</p>
+<div class="section">
+<h4><a name="Download_source_data"></a>Download source data</h4>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># in SINGA_ROOT/examples/rnnlm/
+cp Makefile.example Makefile
+make download
+</pre></div></div></div>
+<div class="section">
+<h4><a name="Define_record_format"></a>Define record format</h4>
+<p>We define the word record as follows,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># in 
SINGA_ROOT/examples/rnnlm/rnnlm.proto
+message WordRecord {
+  optional string word = 1;
+  optional int32 word_index = 2;
+  optional int32 class_index = 3;
+  optional int32 class_start = 4;
+  optional int32 class_end = 5;
+}
+</pre></div></div>
+<p>It includes the word string and its index in the vocabulary. Words in the 
vocabulary are sorted based on their frequency in the training dataset. The 
sorted list is cut into 100 sublists such that each sublist has 1/100 total 
word frequency. Each sublist is called a class. Hence each word has a 
<tt>class_index</tt> ([0,100)). The <tt>class_start</tt> is the index of the 
first word in the same class as <tt>word</tt>. The <tt>class_end</tt> is the 
index of the first word in the next class.</p></div>
+<div class="section">
+<h4><a name="Create_data_stores"></a>Create data stores</h4>
+<p>We use code from RNNLM Toolkit to read words, and sort them into classes. 
The main function in <i>create_store.cc</i> first creates word classes based on 
the training dataset. Second it calls the following function to create data 
store for the training, validation and test dataset.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">int create_data(const char 
*input_file, const char *output_file);
+</pre></div></div>
+<p><tt>input</tt> is the path to training/validation/testing text file from 
the RNNLM Toolkit, <tt>output</tt> is output store file. This function starts 
with</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">singa::io::KVFile store;
+store.Open(output, signa::io::kCreate);
+</pre></div></div>
+<p>Then it reads the words one by one. For each word it creates a 
<tt>WordRecord</tt> instance, and inserts it into the store,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">int wcnt = 0; // word count
+WordRecord  wordRecord;
+while(1) {
+  readWord(wordstr, fin);
+  if (feof(fin)) break;
+  ...// fill in the wordRecord;
+  string val;
+  wordRecord.SerializeToString(&amp;val);
+  int length = snprintf(key, BUFFER_LEN, &quot;%05d&quot;, wcnt++);
+  store.Write(string(key, length), val);
+}
+</pre></div></div>
+<p>Compilation and running commands are provided in the 
<i>Makefile.example</i>. After executing</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">make create
+</pre></div></div>
+<p><i>train_data.bin</i>, <i>test_data.bin</i> and <i>valid_data.bin</i> will 
be created.</p></div></div>
+<div class="section">
+<h3><a name="Layer_implementation"></a>Layer implementation</h3>
+<p>4 user-defined layers are implemented for this application. Following the 
guide for implementing <a href="layer#implementing-a-new-layer-subclass">new 
Layer subclasses</a>, we extend the <a 
href="../api/classsinga_1_1LayerProto.html">LayerProto</a> to include the 
configuration messages of user-defined layers as shown below (3 out of the 7 
layers have specific configurations),</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">import &quot;job.proto&quot;;     
// Layer message for SINGA is defined
+
+//For implementation of RNNLM application
+extend singa.LayerProto {
+  optional EmbeddingProto embedding_conf = 101;
+  optional LossProto loss_conf = 102;
+  optional DataProto data_conf = 103;
+}
+</pre></div></div>
+<p>In the subsequent sections, we describe the implementation of each layer, 
including its configuration message.</p>
+<div class="section">
+<h4><a name="RNNLayer"></a>RNNLayer</h4>
+<p>This is the base layer of all other layers for this applications. It is 
defined as follows,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class RNNLayer : virtual public 
Layer {
+public:
+  inline int window() { return window_; }
+protected:
+  int window_;
+};
+</pre></div></div>
+<p>For this application, two iterations may process different number of words. 
Because sentences have different lengths. The <tt>DataLayer</tt> decides the 
effective window size. All other layers call its source layers to get the 
effective window size and resets <tt>window_</tt> in <tt>ComputeFeature</tt> 
function.</p></div>
+<div class="section">
+<h4><a name="DataLayer"></a>DataLayer</h4>
+<p>DataLayer is for loading Records.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class DataLayer : public 
RNNLayer, singa::InputLayer {
+ public:
+  void Setup(const LayerProto&amp; proto, const vector&lt;Layer*&gt;&amp; 
srclayers) override;
+  void ComputeFeature(int flag, const vector&lt;Layer*&gt;&amp; srclayers) 
override;
+  int max_window() const {
+    return max_window_;
+  }
+ private:
+  int max_window_;
+  singa::io::Store* store_;
+};
+</pre></div></div>
+<p>The Setup function gets the user configured max window size.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">max_window_ = 
proto.GetExtension(input_conf).max_window();
+</pre></div></div>
+<p>The <tt>ComputeFeature</tt> function loads at most max_window records. It 
could also stop when the sentence ending character is encountered.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">...// shift the last record to 
the first
+window_ = max_window_;
+for (int i = 1; i &lt;= max_window_; i++) {
+  // load record; break if it is the ending character
+}
+</pre></div></div>
+<p>The configuration of <tt>DataLayer</tt> is like</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">name: &quot;data&quot;
+user_type: &quot;kData&quot;
+[data_conf] {
+  path: &quot;examples/rnnlm/train_data.bin&quot;
+  max_window: 10
+}
+</pre></div></div></div>
+<div class="section">
+<h4><a name="EmbeddingLayer"></a>EmbeddingLayer</h4>
+<p>This layer gets records from <tt>DataLayer</tt>. For each record, the word 
index is parsed and used to get the corresponding word feature vector from the 
embedding matrix.</p>
+<p>The class is declared as follows,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class EmbeddingLayer : public 
RNNLayer {
+  ...
+  const std::vector&lt;Param*&gt; GetParams() const override {
+    std::vector&lt;Param*&gt; params{embed_};
+    return params;
+  }
+ private:
+  int word_dim_, vocab_size_;
+  Param* embed_;
+}
+</pre></div></div>
+<p>The <tt>embed_</tt> field is a matrix whose values are parameter to be 
learned. The matrix size is <tt>vocab_size_</tt> x <tt>word_dim_</tt>.</p>
+<p>The Setup function reads configurations for <tt>word_dim_</tt> and 
<tt>vocab_size_</tt>. Then it allocates feature Blob for <tt>max_window</tt> 
words and setups <tt>embed_</tt>.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">int max_window = 
srclayers[0]-&gt;data(this).shape()[0];
+word_dim_ = proto.GetExtension(embedding_conf).word_dim();
+data_.Reshape(vector&lt;int&gt;{max_window, word_dim_});
+...
+embed_-&gt;Setup(vector&lt;int&gt;{vocab_size_, word_dim_});
+</pre></div></div>
+<p>The <tt>ComputeFeature</tt> function simply copies the feature vector from 
the <tt>embed_</tt> matrix into the feature Blob.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># reset effective window size
+window_ = datalayer-&gt;window();
+auto records = datalayer-&gt;records();
+...
+for (int t = 0; t &lt; window_; t++) {
+  int idx  &lt;- word index
+  Copy(words[t], embed[idx]);
+}
+</pre></div></div>
+<p>The <tt>ComputeGradient</tt> function copies back the gradients to the 
<tt>embed_</tt> matrix.</p>
+<p>The configuration for <tt>EmbeddingLayer</tt> is like,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">user_type: &quot;kEmbedding&quot;
+[embedding_conf] {
+  word_dim: 15
+  vocab_size: 3720
+}
+srclayers: &quot;data&quot;
+param {
+  name: &quot;w1&quot;
+  init {
+    type: kUniform
+    low:-0.3
+    high:0.3
+  }
+}
+</pre></div></div></div>
+<div class="section">
+<h4><a name="HiddenLayer"></a>HiddenLayer</h4>
+<p>This layer unrolls the recurrent connections for at most max_window times. 
The feature for position k is computed based on the feature from the embedding 
layer (position k) and the feature at position k-1 of this layer. The formula 
is</p>
+<p><tt>$$f[k]=\sigma (f[t-1]*W+src[t])$$</tt></p>
+<p>where <tt>$W$</tt> is a matrix with <tt>word_dim_</tt> x <tt>word_dim_</tt> 
parameters.</p>
+<p>If you want to implement a recurrent neural network following our design, 
this layer is of vital importance for you to refer to.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class HiddenLayer : public 
RNNLayer {
+  ...
+  const std::vector&lt;Param*&gt; GetParams() const override {
+    std::vector&lt;Param*&gt; params{weight_};
+    return params;
+  }
+private:
+  Param* weight_;
+};
+</pre></div></div>
+<p>The <tt>Setup</tt> function setups the weight matrix as</p>
+
+<div class="source">
+<div class="source"><pre 
class="prettyprint">weight_-&gt;Setup(std::vector&lt;int&gt;{word_dim, 
word_dim});
+</pre></div></div>
+<p>The <tt>ComputeFeature</tt> function gets the effective window size 
(<tt>window_</tt>) from its source layer i.e., the embedding layer. Then it 
propagates the feature from position 0 to position <tt>window_</tt> -1. The 
detailed descriptions for this process are illustrated as follows.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">void 
HiddenLayer::ComputeFeature() {
+  for(int t = 0; t &lt; window_size; t++){
+    if(t == 0)
+      Copy(data[t], src[t]);
+    else
+      data[t]=sigmoid(data[t-1]*W + src[t]);
+  }
+}
+</pre></div></div>
+<p>The <tt>ComputeGradient</tt> function computes the gradient of the loss 
w.r.t. W and the source layer. Particularly, for each position k, since data[k] 
contributes to data[k+1] and the feature at position k in its destination layer 
(the loss layer), grad[k] should contains the gradient from two parts. The 
destination layer has already computed the gradient from the loss layer into 
grad[k]; In the <tt>ComputeGradient</tt> function, we need to add the gradient 
from position k+1.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">void 
HiddenLayer::ComputeGradient(){
+  ...
+  for (int k = window_ - 1; k &gt;= 0; k--) {
+    if (k &lt; window_ - 1) {
+      grad[k] += dot(grad[k + 1], weight.T()); // add gradient from position 
t+1.
+    }
+    grad[k] =... // compute gL/gy[t], y[t]=data[t-1]*W+src[t]
+  }
+  gweight = dot(data.Slice(0, window_-1).T(), grad.Slice(1, window_));
+  Copy(gsrc, grad);
+}
+</pre></div></div>
+<p>After the loop, we get the gradient of the loss w.r.t y[k], which is used 
to compute the gradient of W and the src[k].</p></div>
+<div class="section">
+<h4><a name="LossLayer"></a>LossLayer</h4>
+<p>This layer computes the cross-entropy loss and the 
<tt>$log_{10}P(w_{t+1}|w_t)$</tt> (which could be averaged over all words by 
users to get the PPL value).</p>
+<p>There are two configuration fields to be specified by users.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">message LossProto {
+  optional int32 nclass = 1;
+  optional int32 vocab_size = 2;
+}
+</pre></div></div>
+<p>There are two weight matrices to be learned</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">class LossLayer : public RNNLayer 
{
+  ...
+ private:
+  Param* word_weight_, *class_weight_;
+}
+</pre></div></div>
+<p>The ComputeFeature function computes the two probabilities respectively.</p>
+<p><tt>$$P(C_{w_{t+1}}|w_t) = Softmax(w_t * class\_weight_)$$</tt> 
<tt>$$P(w_{t+1}|C_{w_{t+1}}) = Softmax(w_t * 
word\_weight[class\_start:class\_end])$$</tt></p>
+<p><tt>$w_t$</tt> is the feature from the hidden layer for the k-th word, its 
ground truth next word is <tt>$w_{t+1}$</tt>. The first equation computes the 
probability distribution over all classes for the next word. The second 
equation computes the probability distribution over the words in the ground 
truth class for the next word.</p>
+<p>The ComputeGradient function computes the gradient of the source layer 
(i.e., the hidden layer) and the two weight matrices.</p></div></div>
+<div class="section">
+<h3><a name="Updater_Configuration"></a>Updater Configuration</h3>
+<p>We employ kFixedStep type of the learning rate change method and the 
configuration is as follows. We decay the learning rate once the performance 
does not increase on the validation dataset.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">updater{
+  type: kSGD
+  learning_rate {
+    type: kFixedStep
+    fixedstep_conf:{
+      step:0
+      step:48810
+      step:56945
+      step:65080
+      step:73215
+      step_lr:0.1
+      step_lr:0.05
+      step_lr:0.025
+      step_lr:0.0125
+      step_lr:0.00625
+    }
+  }
+}
+</pre></div></div></div>
+<div class="section">
+<h3><a name="TrainOneBatch_Function"></a>TrainOneBatch() Function</h3>
+<p>We use BP (BackPropagation) algorithm to train the RNN model here. The 
corresponding configuration can be seen below.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># In job.conf file
+train_one_batch {
+  alg: kBackPropagation
+}
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Cluster_Configuration"></a>Cluster Configuration</h3>
+<p>The default cluster configuration can be used, i.e., single worker and 
single server in a single process.</p></div></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+                      <div class="row-fluid">
+                                                                          
+<p>Copyright © 2015 The Apache Software Foundation. All rights reserved. 
Apache Singa, Apache, the Apache feather logo, and the Apache Singa project 
logos are trademarks of The Apache Software Foundation. All other marks 
mentioned may be trademarks or registered trademarks of their respective 
owners.</p>
+                          </div>
+
+        
+                </div>
+    </footer>
+        </body>
+</html>


Reply via email to