singa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r977575 [15/19] - in /websites/staging/singa/trunk/content: ./ community/ develop/ docs/ docs/jp/ docs/kr/ docs/zh/ releases/ v0.1.0/
Date Wed, 13 Jan 2016 03:47:58 GMT
Added: websites/staging/singa/trunk/content/docs/kr/mlp.html
==============================================================================
--- websites/staging/singa/trunk/content/docs/kr/mlp.html (added)
+++ websites/staging/singa/trunk/content/docs/kr/mlp.html Wed Jan 13 03:47:56 2016
@@ -0,0 +1,519 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-01-13 
+ | 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="20160113" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; MLP 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="Latest">Latest</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../../docs/installation.html"  title="Installation">Installation</a>
+</li>
+                                  <li>      <a href="../../docs/programmer-guide.html"  title="Programmer Guide">Programmer Guide</a>
+</li>
+                                  <li>      <a href="../../docs/distributed-training.html"  title="Distributed Training">Distributed Training</a>
+</li>
+                                  <li>      <a href="../../docs/data.html"  title="Data Preparation">Data Preparation</a>
+</li>
+                                  <li>      <a href="../../docs/checkpoint.html"  title="Checkpoint">Checkpoint</a>
+</li>
+                                  <li>      <a href="../../docs/test.html"  title="Test">Test</a>
+</li>
+                                  <li>      <a href="../../docs/examples.html"  title="Examples">Examples</a>
+</li>
+                                  <li>      <a href="../../docs/debug.html"  title="Debug">Debug</a>
+</li>
+                              </ul>
+            </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 ">MLP 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="Latest">
+          <span class="icon-chevron-right"></span>
+        Latest</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>MLP Example</h1>
+<hr />
+<p>Multilayer perceptron (MLP) is a subclass of feed-forward neural networks. A MLP typically consists of multiple directly connected layers, with each layer fully connected to the next one. In this example, we will use SINGA to train a <a class="externalLink" href="http://arxiv.org/abs/1003.0358">simple MLP model proposed by Ciresan</a> for classifying handwritten digits from the <a class="externalLink" href="http://yann.lecun.com/exdb/mnist/">MNIST dataset</a>.</p>
+<div class="section">
+<h2><a name="Running_instructions"></a>Running instructions</h2>
+<p>Please refer to the <a href="installation.html">installation</a> page for instructions on building SINGA, and the <a href="quick-start.html">quick start</a> for instructions on starting zookeeper.</p>
+<p>We have provided scripts for preparing the training and test dataset in <i>examples/cifar10/</i>.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"># in examples/mnist
+$ cp Makefile.example Makefile
+$ make download
+$ make create
+</pre></div></div>
+<p>After the datasets are prepared, we start the training by</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">./bin/singa-run.sh -conf examples/mnist/job.conf
+</pre></div></div>
+<p>After it is started, you should see output like</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">Record job information to /tmp/singa-log/job-info/job-1-20150817-055231
+Executing : ./singa -conf /xxx/incubator-singa/examples/mnist/job.conf -singa_conf /xxx/incubator-singa/conf/singa.conf -singa_job 1
+E0817 07:15:09.211885 34073 cluster.cc:51] proc #0 -&gt; 192.168.5.128:49152 (pid = 34073)
+E0817 07:15:14.972231 34114 server.cc:36] Server (group = 0, id = 0) start
+E0817 07:15:14.972520 34115 worker.cc:134] Worker (group = 0, id = 0) start
+E0817 07:15:24.462602 34073 trainer.cc:373] Test step-0, loss : 2.341021, accuracy : 0.109100
+E0817 07:15:47.341076 34073 trainer.cc:373] Train step-0, loss : 2.357269, accuracy : 0.099000
+E0817 07:16:07.173364 34073 trainer.cc:373] Train step-10, loss : 2.222740, accuracy : 0.201800
+E0817 07:16:26.714855 34073 trainer.cc:373] Train step-20, loss : 2.091030, accuracy : 0.327200
+E0817 07:16:46.590946 34073 trainer.cc:373] Train step-30, loss : 1.969412, accuracy : 0.442100
+E0817 07:17:06.207080 34073 trainer.cc:373] Train step-40, loss : 1.865466, accuracy : 0.514800
+E0817 07:17:25.890033 34073 trainer.cc:373] Train step-50, loss : 1.773849, accuracy : 0.569100
+E0817 07:17:51.208935 34073 trainer.cc:373] Test step-60, loss : 1.613709, accuracy : 0.662100
+E0817 07:17:53.176766 34073 trainer.cc:373] Train step-60, loss : 1.659150, accuracy : 0.652600
+E0817 07:18:12.783370 34073 trainer.cc:373] Train step-70, loss : 1.574024, accuracy : 0.666000
+E0817 07:18:32.904942 34073 trainer.cc:373] Train step-80, loss : 1.529380, accuracy : 0.670500
+E0817 07:18:52.608111 34073 trainer.cc:373] Train step-90, loss : 1.443911, accuracy : 0.703500
+E0817 07:19:12.168465 34073 trainer.cc:373] Train step-100, loss : 1.387759, accuracy : 0.721000
+E0817 07:19:31.855865 34073 trainer.cc:373] Train step-110, loss : 1.335246, accuracy : 0.736500
+E0817 07:19:57.327133 34073 trainer.cc:373] Test step-120, loss : 1.216652, accuracy : 0.769900
+</pre></div></div>
+<p>After the training of some steps (depends on the setting) or the job is finished, SINGA will <a href="checkpoint.html">checkpoint</a> the model parameters.</p></div>
+<div class="section">
+<h2><a name="Details"></a>Details</h2>
+<p>To train a model in SINGA, you need to prepare the datasets, and a job configuration which specifies the neural net structure, training algorithm (BP or CD), SGD update algorithm (e.g. Adagrad), number of training/test steps, etc.</p>
+<div class="section">
+<h3><a name="Data_preparation"></a>Data preparation</h3>
+<p>Before using SINGA, you need to write a program to pre-process the dataset you use to a format that SINGA can read. Please refer to the <a href="data.html">Data Preparation</a> to get details about preparing this MNIST dataset.</p></div>
+<div class="section">
+<h3><a name="Neural_net"></a>Neural net</h3>
+
+<div style="text-align: center">
+<img src="../images/example-mlp.png" style="width: 230px" alt="" />
+<br /><b>Figure 1 - Net structure of the MLP example. </b></img>
+</div>
+<p>Figure 1 shows the structure of the simple MLP model, which is constructed following <a class="externalLink" href="http://arxiv.org/abs/1003.0358">Ciresan&#x2019;s paper</a>. The dashed circle contains two layers which represent one feature transformation stage. There are 6 such stages in total. They sizes of the <a href="layer.html#innerproductlayer">InnerProductLayer</a>s in these circles decrease from 2500-&gt;2000-&gt;1500-&gt;1000-&gt;500-&gt;10.</p>
+<p>Next we follow the guide in <a href="neural-net.html">neural net page</a> and <a href="layer.html">layer page</a> to write the neural net configuration.</p>
+
+<ul>
+  
+<li>
+<p>We configure an input layer to read the training/testing records from a disk file.</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">layer {
+    name: &quot;data&quot;
+    type: kRecordInput
+    store_conf {
+      backend: &quot;kvfile&quot;
+      path: &quot;examples/mnist/train_data.bin&quot;
+      random_skip: 5000
+      batchsize: 64
+      shape: 784
+      std_value: 127.5
+      mean_value: 127.5
+     }
+     exclude: kTest
+  }
+
+layer {
+    name: &quot;data&quot;
+    type: kRecordInput
+    store_conf {
+      backend: &quot;kvfile&quot;
+      path: &quot;examples/mnist/test_data.bin&quot;
+      batchsize: 100
+      shape: 784
+      std_value: 127.5
+      mean_value: 127.5
+     }
+     exclude: kTrain
+  }
+</pre></div></div></li>
+</ul>
+
+<ul>
+  
+<li>
+<p>All <a href="layer.html#innerproductlayer">InnerProductLayer</a>s are configured similarly as,</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">layer{
+  name: &quot;fc1&quot;
+  type: kInnerProduct
+  srclayers:&quot;data&quot;
+  innerproduct_conf{
+    num_output: 2500
+  }
+  param{
+    name: &quot;w1&quot;
+    ...
+  }
+  param{
+    name: &quot;b1&quot;
+    ..
+  }
+}
+</pre></div></div>
+<p>with the <tt>num_output</tt> decreasing from 2500 to 10.</p></li>
+  
+<li>
+<p>A <a href="layer.html#stanhlayer">STanhLayer</a> is connected to every InnerProductLayer except the last one. It transforms the feature via scaled tanh function.</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">layer{
+  name: &quot;tanh1&quot;
+  type: kSTanh
+  srclayers:&quot;fc1&quot;
+}
+</pre></div></div></li>
+  
+<li>
+<p>The final <a href="layer.html#softmaxloss">Softmax loss layer</a> connects to LabelLayer and the last STanhLayer.</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">layer{
+  name: &quot;loss&quot;
+  type:kSoftmaxLoss
+  softmaxloss_conf{ topk:1 }
+  srclayers:&quot;fc6&quot;
+  srclayers:&quot;data&quot;
+}
+</pre></div></div></li>
+</ul></div>
+<div class="section">
+<h3><a name="Updater"></a>Updater</h3>
+<p>The <a href="updater.html#updater">normal SGD updater</a> is selected. The learning rate shrinks by 0.997 every 60 steps (i.e., one epoch).</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">updater{
+  type: kSGD
+  learning_rate{
+    base_lr: 0.001
+    type : kStep
+    step_conf{
+      change_freq: 60
+      gamma: 0.997
+    }
+  }
+}
+</pre></div></div></div>
+<div class="section">
+<h3><a name="TrainOneBatch_algorithm"></a>TrainOneBatch algorithm</h3>
+<p>The MLP model is a feed-forward model, hence <a href="train-one-batch#back-propagation">Back-propagation algorithm</a> is selected.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">train_one_batch {
+  alg: kBP
+}
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Cluster_setting"></a>Cluster setting</h3>
+<p>The following configuration set a single worker and server for training. <a href="frameworks.html">Training frameworks</a> page introduces configurations of a couple of distributed training frameworks.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">cluster {
+  nworker_groups: 1
+  nserver_groups: 1
+}
+</pre></div></div></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>

Added: websites/staging/singa/trunk/content/docs/kr/model-config.html
==============================================================================
--- websites/staging/singa/trunk/content/docs/kr/model-config.html (added)
+++ websites/staging/singa/trunk/content/docs/kr/model-config.html Wed Jan 13 03:47:56 2016
@@ -0,0 +1,586 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-01-13 
+ | 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="20160113" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; Model Configuration</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="Latest">Latest</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../../docs/installation.html"  title="Installation">Installation</a>
+</li>
+                                  <li>      <a href="../../docs/programmer-guide.html"  title="Programmer Guide">Programmer Guide</a>
+</li>
+                                  <li>      <a href="../../docs/distributed-training.html"  title="Distributed Training">Distributed Training</a>
+</li>
+                                  <li>      <a href="../../docs/data.html"  title="Data Preparation">Data Preparation</a>
+</li>
+                                  <li>      <a href="../../docs/checkpoint.html"  title="Checkpoint">Checkpoint</a>
+</li>
+                                  <li>      <a href="../../docs/test.html"  title="Test">Test</a>
+</li>
+                                  <li>      <a href="../../docs/examples.html"  title="Examples">Examples</a>
+</li>
+                                  <li>      <a href="../../docs/debug.html"  title="Debug">Debug</a>
+</li>
+                              </ul>
+            </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 ">Model Configuration</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="Latest">
+          <span class="icon-chevron-right"></span>
+        Latest</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>Model Configuration</h1>
+<hr />
+<p>SINGA uses the stochastic gradient descent (SGD) algorithm to train parameters of deep learning models. For each SGD iteration, there is a <a href="architecture.html">Worker</a> computing gradients of parameters from the NeuralNet and a <a href="">Updater</a> updating parameter values based on gradients. Hence the model configuration mainly consists these three parts. We will introduce the NeuralNet, Worker and Updater in the following paragraphs and describe the configurations for them. All model configuration is specified in the model.conf file in the user provided workspace folder. E.g., the <a class="externalLink" href="https://github.com/apache/incubator-singa/tree/master/examples/cifar10">cifar10 example folder</a> has a model.conf file.</p>
+<div class="section">
+<h2><a name="NeuralNet"></a>NeuralNet</h2>
+<div class="section">
+<h3><a name="Uniform_model_neuralnet_representation"></a>Uniform model (neuralnet) representation</h3>
+<p><img src="../images/model-categorization.png" style="width: 400px" alt="" /> Fig. 1: Deep learning model categorization</img></p>
+<p>Many deep learning models have being proposed. Fig. 1 is a categorization of popular deep learning models based on the layer connections. The <a class="externalLink" href="https://github.com/apache/incubator-singa/blob/master/include/neuralnet/neuralnet.h">NeuralNet</a> abstraction of SINGA consists of multiple directly connected layers. This abstraction is able to represent models from all the three categorizations.</p>
+
+<ul>
+  
+<li>
+<p>For the feed-forward models, their connections are already directed.</p></li>
+  
+<li>
+<p>For the RNN models, we unroll them into directed connections, as shown in  Fig. 2.</p></li>
+  
+<li>
+<p>For the undirected connections in RBM, DBM, etc., we replace each undirected  connection with two directed connection, as shown in Fig. 3.</p></li>
+</ul>
+
+<div style="height: 200px">
+
+<div style="float:left; text-align: center">
+<img src="../images/unroll-rbm.png" style="width: 280px" alt="" /> <br />Fig. 2: Unroll RBM </img>
+</div>
+
+<div style="float:left; text-align: center; margin-left: 40px">
+<img src="../images/unroll-rnn.png" style="width: 550px" alt="" /> <br />Fig. 3: Unroll RNN </img>
+</div>
+</div>
+<p>In specific, the NeuralNet class is defined in <a class="externalLink" href="https://github.com/apache/incubator-singa/blob/master/include/neuralnet/neuralnet.h">neuralnet.h</a> :</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">...
+vector&lt;Layer*&gt; layers_;
+...
+</pre></div></div>
+<p>The Layer class is defined in <a class="externalLink" href="https://github.com/apache/incubator-singa/blob/master/include/neuralnet/base_layer.h">base_layer.h</a>:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">vector&lt;Layer*&gt; srclayers_, dstlayers_;
+LayerProto layer_proto_;  // layer configuration, including meta info, e.g., name
+...
+</pre></div></div>
+<p>The connection with other layers are kept in the <tt>srclayers_</tt> and <tt>dstlayers_</tt>. Since there are many different feature transformations, there are many different Layer implementations correspondingly. For layers that have parameters in their feature transformation functions, they would have Param instances in the layer class, e.g.,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">Param weight;
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Configure_the_structure_of_a_NeuralNet_instance"></a>Configure the structure of a NeuralNet instance</h3>
+<p>To train a deep learning model, the first step is to write the configurations for the model structure, i.e., the layers and connections for the NeuralNet. Like <a class="externalLink" href="http://caffe.berkeleyvision.org/">Caffe</a>, we use the <a class="externalLink" href="https://developers.google.com/protocol-buffers/">Google Protocol Buffer</a> to define the configuration protocol. The <a class="externalLink" href="https://github.com/apache/incubator-singa/blob/master/src/proto/model.proto">NetProto</a> specifies the configuration fields for a NeuralNet instance,</p>
+<p>message NetProto {  repeated LayerProto layer = 1;  &#x2026; }</p>
+<p>The configuration is then</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">layer {
+  // layer configuration
+}
+layer {
+  // layer configuration
+}
+...
+</pre></div></div>
+<p>To configure the model structure, we just configure each layer involved in the model.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">message LayerProto {
+  // the layer name used for identification
+  required string name = 1;
+  // source layer names
+  repeated string srclayers = 3;
+  // parameters, e.g., weight matrix or bias vector
+  repeated ParamProto param = 12;
+  // the layer type from the enum above
+  required LayerType type = 20;
+  // configuration for convolution layer
+  optional ConvolutionProto convolution_conf = 30;
+  // configuration for concatenation layer
+  optional ConcateProto concate_conf = 31;
+  // configuration for dropout layer
+  optional DropoutProto dropout_conf = 33;
+  ...
+}
+</pre></div></div>
+<p>A sample configuration for a feed-forward model is like</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">layer {
+  name : &quot;input&quot;
+  type : kRecordInput
+}
+layer {
+  name : &quot;conv&quot;
+  type : kInnerProduct
+  srclayers : &quot;input&quot;
+  param {
+    // configuration for parameter
+  }
+  innerproduct_conf {
+    // configuration for this specific layer
+  }
+  ...
+}
+</pre></div></div>
+<p>The layer type list is defined in <a class="externalLink" href="https://github.com/apache/incubator-singa/blob/master/src/proto/model.proto">LayerType</a>. One type (kFoo) corresponds to one child class of Layer (FooLayer) and one configuration field (foo_conf). All built-in layers are introduced in the <a href="layer.html">layer page</a>.</p></div></div>
+<div class="section">
+<h2><a name="Worker"></a>Worker</h2>
+<p>At the beginning, the Work will initialize the values of Param instances of each layer either randomly (according to user configured distribution) or loading from a <a href="">checkpoint file</a>. For each training iteration, the worker visits layers of the neural network to compute gradients of Param instances of each layer. Corresponding to the three categories of models, there are three different algorithm to compute the gradients of a neural network.</p>
+
+<ol style="list-style-type: decimal">
+  
+<li>Back-propagation (BP) for feed-forward models</li>
+  
+<li>Back-propagation through time (BPTT) for recurrent neural networks</li>
+  
+<li>Contrastive divergence (CD) for RBM, DBM, etc models.</li>
+</ol>
+<p>SINGA has provided these three algorithms as three Worker implementations. Users only need to configure in the model.conf file to specify which algorithm should be used. The configuration protocol is</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">message ModelProto {
+  ...
+  enum GradCalcAlg {
+  // BP algorithm for feed-forward models, e.g., CNN, MLP, RNN
+  kBP = 1;
+  // BPTT for recurrent neural networks
+  kBPTT = 2;
+  // CD algorithm for RBM, DBM etc., models
+  kCd = 3;
+  }
+  // gradient calculation algorithm
+  required GradCalcAlg alg = 8 [default = kBackPropagation];
+  ...
+}
+</pre></div></div>
+<p>These algorithms override the TrainOneBatch function of the Worker. E.g., the BPWorker implements it as</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">void BPWorker::TrainOneBatch(int step, Metric* perf) {
+  Forward(step, kTrain, train_net_, perf);
+  Backward(step, train_net_);
+}
+</pre></div></div>
+<p>The Forward function passes the raw input features of one mini-batch through all layers, and the Backward function visits the layers in reverse order to compute the gradients of the loss w.r.t each layer&#x2019;s feature and each layer&#x2019;s Param objects. Different algorithms would visit the layers in different orders. Some may traverses the neural network multiple times, e.g., the CDWorker&#x2019;s TrainOneBatch function is:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">void CDWorker::TrainOneBatch(int step, Metric* perf) {
+  PostivePhase(step, kTrain, train_net_, perf);
+  NegativePhase(step, kTran, train_net_, perf);
+  GradientPhase(step, train_net_);
+}
+</pre></div></div>
+<p>Each <tt>*Phase</tt> function would visit all layers one or multiple times. All algorithms will finally call two functions of the Layer class:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint"> /**
+  * Transform features from connected layers into features of this layer.
+  *
+  * @param phase kTrain, kTest, kPositive, etc.
+  */
+ virtual void ComputeFeature(Phase phase, Metric* perf) = 0;
+ /**
+  * Compute gradients for parameters (and connected layers).
+  *
+  * @param phase kTrain, kTest, kPositive, etc.
+  */
+ virtual void ComputeGradient(Phase phase) = 0;
+</pre></div></div>
+<p>All <a href="">Layer implementations</a> must implement the above two functions.</p></div>
+<div class="section">
+<h2><a name="Updater"></a>Updater</h2>
+<p>Once the gradients of parameters are computed, the Updater will update parameter values. There are many SGD variants for updating parameters, like <a class="externalLink" href="http://arxiv.org/pdf/1212.5701v1.pdf">AdaDelta</a>, <a class="externalLink" href="http://www.magicbroom.info/Papers/DuchiHaSi10.pdf">AdaGrad</a>, <a class="externalLink" href="http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf">RMSProp</a>, <a class="externalLink" href="http://scholar.google.com/citations?view_op=view_citation&amp;hl=en&amp;user=DJ8Ep8YAAAAJ&amp;citation_for_view=DJ8Ep8YAAAAJ:hkOj_22Ku90C">Nesterov</a> and SGD with momentum. The core functions of the Updater is</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">/**
+ * Update parameter values based on gradients
+ * @param step training step
+ * @param param pointer to the Param object
+ * @param grad_scale scaling factor for the gradients
+ */
+void Update(int step, Param* param, float grad_scale=1.0f);
+/**
+ * @param step training step
+ * @return the learning rate for this step
+ */
+float GetLearningRate(int step);
+</pre></div></div>
+<p>SINGA provides several built-in updaters and learning rate change methods. Users can configure them according to the UpdaterProto</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">message UpdaterProto {
+  enum UpdaterType{
+    // noraml SGD with momentum and weight decay
+    kSGD = 1;
+    // adaptive subgradient, http://www.magicbroom.info/Papers/DuchiHaSi10.pdf
+    kAdaGrad = 2;
+    // http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf
+    kRMSProp = 3;
+    // Nesterov first optimal gradient method
+    kNesterov = 4;
+  }
+  // updater type
+  required UpdaterType type = 1 [default=kSGD];
+  // configuration for RMSProp algorithm
+  optional RMSPropProto rmsprop_conf = 50;
+
+  enum ChangeMethod {
+    kFixed = 0;
+    kInverseT = 1;
+    kInverse = 2;
+    kExponential = 3;
+    kLinear = 4;
+    kStep = 5;
+    kFixedStep = 6;
+  }
+  // change method for learning rate
+  required ChangeMethod lr_change= 2 [default = kFixed];
+
+  optional FixedStepProto fixedstep_conf=40;
+  ...
+  optional float momentum = 31 [default = 0];
+  optional float weight_decay = 32 [default = 0];
+  // base learning rate
+  optional float base_lr = 34 [default = 0];
+}
+</pre></div></div></div>
+<div class="section">
+<h2><a name="Other_model_configuration_fields"></a>Other model configuration fields</h2>
+<p>Some other important configuration fields for training a deep learning model is listed:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">// model name, e.g., &quot;cifar10-dcnn&quot;, &quot;mnist-mlp&quot;
+string name;
+// displaying training info for every this number of iterations, default is 0
+int32 display_freq;
+// total num of steps/iterations for training
+int32 train_steps;
+// do test for every this number of training iterations, default is 0
+int32 test_freq;
+// run test for this number of steps/iterations, default is 0.
+// The test dataset has test_steps * batchsize instances.
+int32 test_steps;
+// do checkpoint for every this number of training steps, default is 0
+int32 checkpoint_freq;
+</pre></div></div>
+<p>The pages of <a href="checkpoint.html">checkpoint and restore</a> has details on checkpoint related fields.</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/docs/kr/neural-net.html
==============================================================================
--- websites/staging/singa/trunk/content/docs/kr/neural-net.html (added)
+++ websites/staging/singa/trunk/content/docs/kr/neural-net.html Wed Jan 13 03:47:56 2016
@@ -0,0 +1,571 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-01-13 
+ | 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="20160113" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Apache SINGA &#x2013; Neural Net</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="Latest">Latest</a>
+              <ul class="dropdown-menu">
+                                  <li>      <a href="../../docs/installation.html"  title="Installation">Installation</a>
+</li>
+                                  <li>      <a href="../../docs/programmer-guide.html"  title="Programmer Guide">Programmer Guide</a>
+</li>
+                                  <li>      <a href="../../docs/distributed-training.html"  title="Distributed Training">Distributed Training</a>
+</li>
+                                  <li>      <a href="../../docs/data.html"  title="Data Preparation">Data Preparation</a>
+</li>
+                                  <li>      <a href="../../docs/checkpoint.html"  title="Checkpoint">Checkpoint</a>
+</li>
+                                  <li>      <a href="../../docs/test.html"  title="Test">Test</a>
+</li>
+                                  <li>      <a href="../../docs/examples.html"  title="Examples">Examples</a>
+</li>
+                                  <li>      <a href="../../docs/debug.html"  title="Debug">Debug</a>
+</li>
+                              </ul>
+            </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 ">Neural Net</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="Latest">
+          <span class="icon-chevron-right"></span>
+        Latest</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>Neural Net</h1>
+<hr />
+<p><tt>NeuralNet</tt> in SINGA represents an instance of user&#x2019;s neural net model. As the neural net typically consists of a set of layers, <tt>NeuralNet</tt> comprises a set of unidirectionally connected <a href="layer.html">Layer</a>s. This page describes how to convert an user&#x2019;s neural net into the configuration of <tt>NeuralNet</tt>.</p>
+<p><img src="../images/model-category.png" align="center" width="200px" alt="" /> <span><b>Figure 1 - Categorization of popular deep learning models.</b></span></p>
+<div class="section">
+<h2><a name="Net_structure_configuration"></a>Net structure configuration</h2>
+<p>Users configure the <tt>NeuralNet</tt> by listing all layers of the neural net and specifying each layer&#x2019;s source layer names. Popular deep learning models can be categorized as Figure 1. The subsequent sections give details for each category.</p>
+<div class="section">
+<h3><a name="Feed-forward_models"></a>Feed-forward models</h3>
+
+<div align="left">
+<img src="../images/mlp-net.png" align="center" width="200px" alt="" />
+<span><b>Figure 2 - Net structure of a MLP model.</b></span>
+</div>
+<p>Feed-forward models, e.g., CNN and MLP, can easily get configured as their layer connections are undirected without circles. The configuration for the MLP model shown in Figure 1 is as follows,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">net {
+  layer {
+    name : 'data&quot;
+    type : kData
+  }
+  layer {
+    name : 'image&quot;
+    type : kImage
+    srclayer: 'data'
+  }
+  layer {
+    name : 'label&quot;
+    type : kLabel
+    srclayer: 'data'
+  }
+  layer {
+    name : 'hidden&quot;
+    type : kHidden
+    srclayer: 'image'
+  }
+  layer {
+    name : 'softmax&quot;
+    type : kSoftmaxLoss
+    srclayer: 'hidden'
+    srclayer: 'label'
+  }
+}
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Energy_models"></a>Energy models</h3>
+<p><img src="../images/rbm-rnn.png" align="center" width="500px" alt="" /> <span><b>Figure 3 - Convert connections in RBM and RNN.</b></span></p>
+<p>For energy models including RBM, DBM, etc., their connections are undirected (i.e., Category B). To represent these models using <tt>NeuralNet</tt>, users can simply replace each connection with two directed connections, as shown in Figure 3a. In other words, for each pair of connected layers, their source layer field should include each other&#x2019;s name. The full <a href="rbm.html">RBM example</a> has detailed neural net configuration for a RBM model, which looks like</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">net {
+  layer {
+    name : &quot;vis&quot;
+    type : kVisLayer
+    param {
+      name : &quot;w1&quot;
+    }
+    srclayer: &quot;hid&quot;
+  }
+  layer {
+    name : &quot;hid&quot;
+    type : kHidLayer
+    param {
+      name : &quot;w2&quot;
+      share_from: &quot;w1&quot;
+    }
+    srclayer: &quot;vis&quot;
+  }
+}
+</pre></div></div></div>
+<div class="section">
+<h3><a name="RNN_models"></a>RNN models</h3>
+<p>For recurrent neural networks (RNN), users can remove the recurrent connections by unrolling the recurrent layer. For example, in Figure 3b, the original layer is unrolled into a new layer with 4 internal layers. In this way, the model is like a normal feed-forward model, thus can be configured similarly. The <a href="rnn.html">RNN example</a> has a full neural net configuration for a RNN model.</p></div></div>
+<div class="section">
+<h2><a name="Configuration_for_multiple_nets"></a>Configuration for multiple nets</h2>
+<p>Typically, a training job includes three neural nets for training, validation and test phase respectively. The three neural nets share most layers except the data layer, loss layer or output layer, etc.. To avoid redundant configurations for the shared layers, users can uses the <tt>exclude</tt> filed to filter a layer in the neural net, e.g., the following layer will be filtered when creating the testing <tt>NeuralNet</tt>.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">layer {
+  ...
+  exclude : kTest # filter this layer for creating test net
+}
+</pre></div></div></div>
+<div class="section">
+<h2><a name="Neural_net_partitioning"></a>Neural net partitioning</h2>
+<p>A neural net can be partitioned in different ways to distribute the training over multiple workers.</p>
+<div class="section">
+<h3><a name="Batch_and_feature_dimension"></a>Batch and feature dimension</h3>
+<p><img src="../images/partition_fc.png" align="center" width="400px" alt="" /> <span><b>Figure 4 - Partitioning of a fully connected layer.</b></span></p>
+<p>Every layer&#x2019;s feature blob is considered a matrix whose rows are feature vectors. Thus, one layer can be split on two dimensions. Partitioning on dimension 0 (also called batch dimension) slices the feature matrix by rows. For instance, if the mini-batch size is 256 and the layer is partitioned into 2 sub-layers, each sub-layer would have 128 feature vectors in its feature blob. Partitioning on this dimension has no effect on the parameters, as every <a href="param.html">Param</a> object is replicated in the sub-layers. Partitioning on dimension 1 (also called feature dimension) slices the feature matrix by columns. For example, suppose the original feature vector has 50 units, after partitioning into 2 sub-layers, each sub-layer would have 25 units. This partitioning may result in <a href="param.html">Param</a> object being split, as shown in Figure 4. Both the bias vector and weight matrix are partitioned into two sub-layers.</p></div>
+<div class="section">
+<h3><a name="Partitioning_configuration"></a>Partitioning configuration</h3>
+<p>There are 4 partitioning schemes, whose configurations are give below,</p>
+
+<ol style="list-style-type: decimal">
+  
+<li>
+<p>Partitioning each singe layer into sub-layers on batch dimension (see  below). It is enabled by configuring the partition dimension of the layer to  0, e.g.,</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">  # with other fields omitted
+  layer {
+    partition_dim: 0
+  }
+</pre></div></div></li>
+  
+<li>
+<p>Partitioning each singe layer into sub-layers on feature dimension (see  below). It is enabled by configuring the partition dimension of the layer to  1, e.g.,</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">  # with other fields omitted
+  layer {
+    partition_dim: 1
+  }
+</pre></div></div></li>
+  
+<li>
+<p>Partitioning all layers into different subsets. It is enabled by  configuring the location ID of a layer, e.g.,</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">  # with other fields omitted
+  layer {
+    location: 1
+  }
+  layer {
+    location: 0
+  }
+</pre></div></div></li>
+</ol>
+
+<ol style="list-style-type: decimal">
+  
+<li>
+<p>Hybrid partitioning of strategy 1, 2 and 3. The hybrid partitioning is  useful for large models. An example application is to implement the  <a class="externalLink" href="http://arxiv.org/abs/1404.5997">idea proposed by Alex</a>.  Hybrid partitioning is configured like,</p>
+  
+<div class="source">
+<div class="source"><pre class="prettyprint">  # with other fields omitted
+  layer {
+    location: 1
+  }
+  layer {
+    location: 0
+  }
+  layer {
+    partition_dim: 0
+    location: 0
+  }
+  layer {
+    partition_dim: 1
+    location: 0
+  }
+</pre></div></div></li>
+</ol>
+<p>Currently SINGA supports strategy-2 well. Other partitioning strategies are are under test and will be released in later version.</p></div></div>
+<div class="section">
+<h2><a name="Parameter_sharing"></a>Parameter sharing</h2>
+<p>Parameters can be shared in two cases,</p>
+
+<ul>
+  
+<li>
+<p>sharing parameters among layers via user configuration. For example, the  visible layer and hidden layer of a RBM shares the weight matrix, which is configured through  the <tt>share_from</tt> field as shown in the above RBM configuration. The  configurations must be the same (except name) for shared parameters.</p></li>
+  
+<li>
+<p>due to neural net partitioning, some <tt>Param</tt> objects are replicated into  different workers, e.g., partitioning one layer on batch dimension. These  workers share parameter values. SINGA controls this kind of parameter  sharing automatically, users do not need to do any configuration.</p></li>
+  
+<li>
+<p>the <tt>NeuralNet</tt> for training and testing (and validation) share most layers  , thus share <tt>Param</tt> values.</p></li>
+</ul>
+<p>If the shared <tt>Param</tt> instances resident in the same process (may in different threads), they use the same chunk of memory space for their values. But they would have different memory spaces for their gradients. In fact, their gradients will be averaged by the stub or server.</p></div>
+<div class="section">
+<h2><a name="Advanced_user_guide"></a>Advanced user guide</h2>
+<div class="section">
+<h3><a name="Creation"></a>Creation</h3>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">static NeuralNet* NeuralNet::Create(const NetProto&amp; np, Phase phase, int num);
+</pre></div></div>
+<p>The above function creates a <tt>NeuralNet</tt> for a given phase, and returns a pointer to the <tt>NeuralNet</tt> instance. The phase is in {kTrain, kValidation, kTest}. <tt>num</tt> is used for net partitioning which indicates the number of partitions. Typically, a training job includes three neural nets for training, validation and test phase respectively. The three neural nets share most layers except the data layer, loss layer or output layer, etc.. The <tt>Create</tt> function takes in the full net configuration including layers for training, validation and test. It removes layers for phases other than the specified phase based on the <tt>exclude</tt> field in <a href="layer.html">layer configuration</a>:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">layer {
+  ...
+  exclude : kTest # filter this layer for creating test net
+}
+</pre></div></div>
+<p>The filtered net configuration is passed to the constructor of <tt>NeuralNet</tt>:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">NeuralNet::NeuralNet(NetProto netproto, int npartitions);
+</pre></div></div>
+<p>The constructor creates a graph representing the net structure firstly in</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">Graph* NeuralNet::CreateGraph(const NetProto&amp; netproto, int npartitions);
+</pre></div></div>
+<p>Next, it creates a layer for each node and connects layers if their nodes are connected.</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">void NeuralNet::CreateNetFromGraph(Graph* graph, int npartitions);
+</pre></div></div>
+<p>Since the <tt>NeuralNet</tt> instance may be shared among multiple workers, the <tt>Create</tt> function returns a pointer to the <tt>NeuralNet</tt> instance .</p></div>
+<div class="section">
+<h3><a name="Parameter_sharing"></a>Parameter sharing</h3>
+<p><tt>Param</tt> sharing is enabled by first sharing the Param configuration (in <tt>NeuralNet::Create</tt>) to create two similar (e.g., the same shape) Param objects, and then calling (in <tt>NeuralNet::CreateNetFromGraph</tt>),</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">void Param::ShareFrom(const Param&amp; from);
+</pre></div></div>
+<p>It is also possible to share <tt>Param</tt>s of two nets, e.g., sharing parameters of the training net and the test net,</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">void NeuralNet:ShareParamsFrom(NeuralNet* other);
+</pre></div></div>
+<p>It will call <tt>Param::ShareFrom</tt> for each Param object.</p></div>
+<div class="section">
+<h3><a name="Access_functions"></a>Access functions</h3>
+<p><tt>NeuralNet</tt> provides a couple of access function to get the layers and params of the net:</p>
+
+<div class="source">
+<div class="source"><pre class="prettyprint">const std::vector&lt;Layer*&gt;&amp; layers() const;
+const std::vector&lt;Param*&gt;&amp; params() const ;
+Layer* name2layer(string name) const;
+Param* paramid2param(int id) const;
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Partitioning"></a>Partitioning</h3>
+<div class="section">
+<h4><a name="Implementation"></a>Implementation</h4>
+<p>SINGA partitions the neural net in <tt>CreateGraph</tt> function, which creates one node for each (partitioned) layer. For example, if one layer&#x2019;s partition dimension is 0 or 1, then it creates <tt>npartition</tt> nodes for it; if the partition dimension is -1, a single node is created, i.e., no partitioning. Each node is assigned a partition (or location) ID. If the original layer is configured with a location ID, then the ID is assigned to each newly created node. These nodes are connected according to the connections of the original layers. Some connection layers will be added automatically. For instance, if two connected sub-layers are located at two different workers, then a pair of bridge layers is inserted to transfer the feature (and gradient) blob between them. When two layers are partitioned on different dimensions, a concatenation layer which concatenates feature rows (or columns) and a slice layer which slices feature rows (or columns) would be inserted. These 
 connection layers help making the network communication and synchronization transparent to the users.</p></div>
+<div class="section">
+<h4><a name="Dispatching_partitions_to_workers"></a>Dispatching partitions to workers</h4>
+<p>Each (partitioned) layer is assigned a location ID, based on which it is dispatched to one worker. Particularly, the pointer to the <tt>NeuralNet</tt> instance is passed to every worker within the same group, but each worker only computes over the layers that have the same partition (or location) ID as the worker&#x2019;s ID. When every worker computes the gradients of the entire model parameters (strategy-2), we refer to this process as data parallelism. When different workers compute the gradients of different parameters (strategy-3 or strategy-1), we call this process model parallelism. The hybrid partitioning leads to hybrid parallelism where some workers compute the gradients of the same subset of model parameters while other workers compute on different model parameters. For example, to implement the hybrid parallelism in for the <a class="externalLink" href="http://arxiv.org/abs/1404.5997">DCNN model</a>, we set <tt>partition_dim = 0</tt> for lower layers and <tt>partition
 _dim = 1</tt> for higher layers.</p></div></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>



Mime
View raw message