Modified: websites/staging/singa/trunk/content/docs/programmer-guide.html ============================================================================== --- websites/staging/singa/trunk/content/docs/programmer-guide.html (original) +++ websites/staging/singa/trunk/content/docs/programmer-guide.html Wed Sep 2 10:31:57 2015 @@ -1,13 +1,13 @@ <!DOCTYPE html> <!-- - | Generated by Apache Maven Doxia at 2015-08-17 + | Generated by Apache Maven Doxia at 2015-09-02 | 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="20150817" /> + <meta name="Date-Revision-yyyymmdd" content="20150902" /> <meta http-equiv="Content-Language" content="en" /> <title>Apache SINGA – Programmer Guide</title> <link rel="stylesheet" href="../css/apache-maven-fluido-1.4.min.css" /> @@ -423,11 +423,11 @@ <div id="bodyColumn" class="span10" > - <div class="section"> -<h2><a name="Programmer_Guide"></a>Programmer Guide</h2> + <h1>Programmer Guide</h1> <hr /> <p>This guide provides instructions of implementing a new model and submitting the training job. The programming model is made almost transparent to the underlying distributed environment. Hence users do not need to worry much about the communication and synchronization of nodes, which is discussed in <a href="architecture.html">architecture</a> in details.</p> <div class="section"> +<div class="section"> <h3><a name="Deep_learning_training"></a>Deep learning training</h3> <p>Deep learning is labeled as a feature learning technique, which usually consists of multiple layers. Each layer is associated with a feature transformation function. After going through all layers, the raw input feature (e.g., pixels of images) would be converted into a high-level feature that is easier for tasks like classification.</p> <p>Training a deep learning model is to find the optimal parameters involved in the transformation functions that generates good features for specific tasks. The goodness of a set of parameters is measured by a loss function, e.g., <a class="externalLink" href="https://en.wikipedia.org/wiki/Cross_entropy">Cross-Entropy Loss</a>. Since the loss functions are usually non-linear and non-convex, it is difficult to get a closed form solution. Normally, people uses the SGD algorithm which randomly initializes the parameters and then iteratively update them to reduce the loss.</p></div>
Added: websites/staging/singa/trunk/content/docs/programming-guide.html ============================================================================== --- websites/staging/singa/trunk/content/docs/programming-guide.html (added) +++ websites/staging/singa/trunk/content/docs/programming-guide.html Wed Sep 2 10:31:57 2015 @@ -0,0 +1,515 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia at 2015-09-02 + | 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="20150902" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache SINGA – Programming Guide</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> + + + </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="../index.html" title="Welcome">Welcome</a> +</li> + + <li> <a href="../introduction.html" title="Introduction">Introduction</a> +</li> + + <li> <a href="../quick-start.html" title="Quick Start">Quick Start</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> <a href="../docs/installation.html" title="Installation">Installation</a> +</li> + + <li class="dropdown-submenu"> + <a href="../docs/programmer-guide.html" title="Programmer Guide">Programmer Guide</a> + <ul class="dropdown-menu"> + <li> <a href="../docs/model-config.html" title="Model Configuration">Model Configuration</a> +</li> + <li> <a href="../docs/neuralnet.html" title="Neural Network">Neural Network</a> +</li> + <li> <a href="../docs/layer.html" title="Layer">Layer</a> +</li> + <li> <a href="../docs/param.html" title="Param">Param</a> +</li> + </ul> + </li> + + <li class="dropdown-submenu"> + <a href="../docs/distributed-training.html" title="Distributed Training">Distributed Training</a> + <ul class="dropdown-menu"> + <li> <a href="../docs/architecture.html" title="System Architecture">System Architecture</a> +</li> + <li> <a href="../docs/frameworks.html" title="Frameworks">Frameworks</a> +</li> + <li> <a href="../docs/communication.html" title="Communication">Communication</a> +</li> + </ul> + </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/examples.html" title="Examples">Examples</a> +</li> + + <li> <a href="../docs/debug.html" title="Debug">Debug</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 School of Computing">NUS School of Computing</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 ">Programming Guide</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="../index.html" title="Welcome"> + <span class="none"></span> + Welcome</a> + </li> + + <li> + + <a href="../introduction.html" title="Introduction"> + <span class="none"></span> + Introduction</a> + </li> + + <li> + + <a href="../quick-start.html" title="Quick Start"> + <span class="none"></span> + Quick Start</a> + </li> + <li class="nav-header">Documentaion</li> + + <li> + + <a href="../docs/installation.html" title="Installation"> + <span class="none"></span> + Installation</a> + </li> + + <li> + + <a href="../docs/programmer-guide.html" title="Programmer Guide"> + <span class="icon-chevron-down"></span> + Programmer Guide</a> + <ul class="nav nav-list"> + + <li> + + <a href="../docs/model-config.html" title="Model Configuration"> + <span class="none"></span> + Model Configuration</a> + </li> + + <li> + + <a href="../docs/neuralnet.html" title="Neural Network"> + <span class="none"></span> + Neural Network</a> + </li> + + <li> + + <a href="../docs/layer.html" title="Layer"> + <span class="none"></span> + Layer</a> + </li> + + <li> + + <a href="../docs/param.html" title="Param"> + <span class="none"></span> + Param</a> + </li> + </ul> + </li> + + <li> + + <a href="../docs/distributed-training.html" title="Distributed Training"> + <span class="icon-chevron-down"></span> + Distributed Training</a> + <ul class="nav nav-list"> + + <li> + + <a href="../docs/architecture.html" title="System Architecture"> + <span class="none"></span> + System Architecture</a> + </li> + + <li> + + <a href="../docs/frameworks.html" title="Frameworks"> + <span class="none"></span> + Frameworks</a> + </li> + + <li> + + <a href="../docs/communication.html" title="Communication"> + <span class="none"></span> + Communication</a> + </li> + </ul> + </li> + + <li> + + <a href="../docs/data.html" title="Data Preparation"> + <span class="none"></span> + Data Preparation</a> + </li> + + <li> + + <a href="../docs/checkpoint.html" title="Checkpoint"> + <span class="none"></span> + Checkpoint</a> + </li> + + <li> + + <a href="../docs/examples.html" title="Examples"> + <span class="none"></span> + Examples</a> + </li> + + <li> + + <a href="../docs/debug.html" title="Debug"> + <span class="none"></span> + Debug</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-down"></span> + How to Contribute</a> + <ul class="nav nav-list"> + + <li> + + <a href="../develop/contribute-code.html" title="Code"> + <span class="none"></span> + Code</a> + </li> + + <li> + + <a href="../develop/contribute-docs.html" title="Documentation"> + <span class="none"></span> + Documentation</a> + </li> + </ul> + </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 School of Computing"> + <span class="none"></span> + NUS School of Computing</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>Programming Guide</h1> +<p>To submit a training job, users must provide the configuration of the four components shown in Figure 1:</p> + +<ul> + +<li>a <a class="externalLink" href="http://singa.incubator.apache.org/docs/neural-net">NeuralNet</a> describing the neural net structure with the detailed layer setting and their connections;</li> + +<li>a <a class="externalLink" href="http://singa.incubator.apache.org/docs/train-one-batch">TrainOneBatch</a> algorithm which is tailored for different model categories;</li> + +<li>an <a class="externalLink" href="http://singa.incubator.apache.org/docs/updater">Updater</a> defining the protocol for updating parameters at the server side;</li> + +<li>a <a class="externalLink" href="http://singa.incubator.apache.org/docs/distributed-training">Cluster Topology</a> specifying the distributed architecture of workers and servers.</li> +</ul> +<p>The <i>Basic user guide</i> section describes how to submit a training job using built-in components; while the <i>Advanced user guide</i> section presents details on writing user’s own main function to register components implemented by themselves. In addition, the training data must be prepared, which has the same <a class="externalLink" href="http://singa.incubator.apache.org/docs/data">process</a> for both advanced users and basic users.</p> +<p><img src="http://singa.incubator.apache.org/assets/image/overview.png" align="center" width="400px" alt="" /> <span><b>Figure 1 - SINGA overview.</b></span></p> +<div class="section"> +<h2><a name="Basic_user_guide"></a>Basic user guide</h2> +<p>Users can use the default main function provided SINGA to submit the training job. For this case, a job configuration file written as a google protocol buffer message for the <a class="externalLink" href="http://singa.incubator.apache.org/api/classsinga_1_1JobProto.html">JobProto</a> must be provided in the command line,</p> + +<div class="source"> +<div class="source"><pre class="prettyprint">./bin/singa-run.sh -conf <path to job conf> [-resume] +</pre></div></div> +<p><tt>-resume</tt> is for continuing the training from last <a class="externalLink" href="http://singa.incubator.apache.org/docs/checkpoint">checkpoint</a>. The <a class="externalLink" href="http://singa.incubator.apache.org/docs/mlp">MLP</a> and <a class="externalLink" href="http://singa.incubator.apache.org/docs/cnn">CNN</a> examples use built-in components. Please read the corresponding pages for their job configuration files. The subsequent pages will illustrate the details on each component of the configuration.</p></div> +<div class="section"> +<h2><a name="Advanced_user_guide"></a>Advanced user guide</h2> +<p>If a user’s model contains some user-defined components, e.g., <a class="externalLink" href="http://singa.incubator.apache.org/docs/updater">Updater</a>, he has to write a main function to register these components. It is similar to Hadoop’s main function. Generally, the main function should</p> + +<ul> + +<li> +<p>initialize SINGA, e.g., setup logging.</p></li> + +<li> +<p>register user-defined components.</p></li> + +<li> +<p>create and pass the job configuration to SINGA driver</p></li> +</ul> +<p>An example main function is like</p> + +<div class="source"> +<div class="source"><pre class="prettyprint">#include "singa.h" +#include "user.h" // header for user code + +int main(int argc, char** argv) { + singa::Driver driver; + driver.Init(argc, argv); + bool resume; + // parse resume option from argv. + + // register user defined layers + driver.RegisterLayer<FooLayer>(kFooLayer); + // register user defined updater + driver.RegisterUpdater<FooUpdater>(kFooUpdater); + ... + auto jobConf = driver.job_conf(); + // update jobConf + + driver.Submit(resume, jobConf); + return 0; +} +</pre></div></div> +<p>The Driver class’ <tt>Init</tt> method will load a job configuration file provided by users as a command line argument (<tt>-conf <job conf></tt>). It contains at least the cluster topology and returns the <tt>jobConf</tt> for users to update or fill in configurations of neural net, updater, etc. If users define subclasses of Layer, Updater, Worker and Param, they should register them through the driver. Finally, the job configuration is submitted to the driver which starts the training.</p> +<p>We will provide helper functions to make the configuration easier in the future, like <a class="externalLink" href="https://github.com/fchollet/keras">keras</a>.</p> +<p>Users need to compile and link their code (e.g., layer implementations and the main file) with SINGA library (<i>.libs/libsinga.so</i>) to generate an executable file, e.g., with name <i>mysinga</i>. To launch the program, users just pass the path of the <i>mysinga</i> and base job configuration to <i>./bin/singa-run.sh</i>.</p> + +<div class="source"> +<div class="source"><pre class="prettyprint">./bin/singa-run.sh -conf <path to job conf> -exec <path to mysinga> [other arguments] +</pre></div></div> +<p>The <a class="externalLink" href="http://singa.incubator.apache.org/docs/rnn">RNN application</a> provides a full example of implementing the main function for training a specific RNN model.</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/quick-start.html ============================================================================== --- websites/staging/singa/trunk/content/docs/quick-start.html (added) +++ websites/staging/singa/trunk/content/docs/quick-start.html Wed Sep 2 10:31:57 2015 @@ -0,0 +1,582 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia at 2015-09-02 + | 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="20150902" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache SINGA – 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> + + + </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="../index.html" title="Welcome">Welcome</a> +</li> + + <li> <a href="../introduction.html" title="Introduction">Introduction</a> +</li> + + <li> <a href="../quick-start.html" title="Quick Start">Quick Start</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> <a href="../docs/installation.html" title="Installation">Installation</a> +</li> + + <li class="dropdown-submenu"> + <a href="../docs/programmer-guide.html" title="Programmer Guide">Programmer Guide</a> + <ul class="dropdown-menu"> + <li> <a href="../docs/model-config.html" title="Model Configuration">Model Configuration</a> +</li> + <li> <a href="../docs/neuralnet.html" title="Neural Network">Neural Network</a> +</li> + <li> <a href="../docs/layer.html" title="Layer">Layer</a> +</li> + <li> <a href="../docs/param.html" title="Param">Param</a> +</li> + </ul> + </li> + + <li class="dropdown-submenu"> + <a href="../docs/distributed-training.html" title="Distributed Training">Distributed Training</a> + <ul class="dropdown-menu"> + <li> <a href="../docs/architecture.html" title="System Architecture">System Architecture</a> +</li> + <li> <a href="../docs/frameworks.html" title="Frameworks">Frameworks</a> +</li> + <li> <a href="../docs/communication.html" title="Communication">Communication</a> +</li> + </ul> + </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/examples.html" title="Examples">Examples</a> +</li> + + <li> <a href="../docs/debug.html" title="Debug">Debug</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 School of Computing">NUS School of Computing</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="../index.html" title="Welcome"> + <span class="none"></span> + Welcome</a> + </li> + + <li> + + <a href="../introduction.html" title="Introduction"> + <span class="none"></span> + Introduction</a> + </li> + + <li> + + <a href="../quick-start.html" title="Quick Start"> + <span class="none"></span> + Quick Start</a> + </li> + <li class="nav-header">Documentaion</li> + + <li> + + <a href="../docs/installation.html" title="Installation"> + <span class="none"></span> + Installation</a> + </li> + + <li> + + <a href="../docs/programmer-guide.html" title="Programmer Guide"> + <span class="icon-chevron-down"></span> + Programmer Guide</a> + <ul class="nav nav-list"> + + <li> + + <a href="../docs/model-config.html" title="Model Configuration"> + <span class="none"></span> + Model Configuration</a> + </li> + + <li> + + <a href="../docs/neuralnet.html" title="Neural Network"> + <span class="none"></span> + Neural Network</a> + </li> + + <li> + + <a href="../docs/layer.html" title="Layer"> + <span class="none"></span> + Layer</a> + </li> + + <li> + + <a href="../docs/param.html" title="Param"> + <span class="none"></span> + Param</a> + </li> + </ul> + </li> + + <li> + + <a href="../docs/distributed-training.html" title="Distributed Training"> + <span class="icon-chevron-down"></span> + Distributed Training</a> + <ul class="nav nav-list"> + + <li> + + <a href="../docs/architecture.html" title="System Architecture"> + <span class="none"></span> + System Architecture</a> + </li> + + <li> + + <a href="../docs/frameworks.html" title="Frameworks"> + <span class="none"></span> + Frameworks</a> + </li> + + <li> + + <a href="../docs/communication.html" title="Communication"> + <span class="none"></span> + Communication</a> + </li> + </ul> + </li> + + <li> + + <a href="../docs/data.html" title="Data Preparation"> + <span class="none"></span> + Data Preparation</a> + </li> + + <li> + + <a href="../docs/checkpoint.html" title="Checkpoint"> + <span class="none"></span> + Checkpoint</a> + </li> + + <li> + + <a href="../docs/examples.html" title="Examples"> + <span class="none"></span> + Examples</a> + </li> + + <li> + + <a href="../docs/debug.html" title="Debug"> + <span class="none"></span> + Debug</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-down"></span> + How to Contribute</a> + <ul class="nav nav-list"> + + <li> + + <a href="../develop/contribute-code.html" title="Code"> + <span class="none"></span> + Code</a> + </li> + + <li> + + <a href="../develop/contribute-docs.html" title="Documentation"> + <span class="none"></span> + Documentation</a> + </li> + </ul> + </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 School of Computing"> + <span class="none"></span> + NUS School of Computing</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> +<div class="section"> +<h2><a name="SINGA_setup"></a>SINGA setup</h2> +<p>Please refer to the <a class="externalLink" href="http://singa.incubator.apache.org/docs/installation}">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 start +</pre></div></div> +<p>(<tt>./bin/zk-service 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: "localhost:YOUR_PORT" +</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> +<p>{% comment %} For standalone mode, users have to manage the resources manually. For instance, they have to prepare a host file containing all running nodes. There is no restriction on CPU and memory resources, hence SINGA consumes as much CPU and memory resources as it needs. {% endcomment %}</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 class="externalLink" href="http://singa.incubator.apache.org/docs/cnn">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/ +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 class="externalLink" href="http://singa.incubator.apache.org/docs/programming-guide">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> +<p>{% comment %} One worker group trains against one partition of the training dataset. If <i>nworker_groups</i> is set to 1, then there is no data partitioning. One worker runs over a partition of the model. If <i>nworkers_per_group</i> is set to 1, then there is no model partitioning. More details on the cluster configuration are described in the <a href="">System Architecture</a> page. {% endcomment %}</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: "examples/cifar10/" +} +</pre></div></div> +<p>In SINGA, <a class="externalLink" href="http://singa.incubator.apache.org/docs/architecture">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 class="externalLink" href="http://singa.incubator.apache.org/docs/frameworks">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: "examples/cifar10/" +} +</pre></div></div> +<p>In SINGA, <a class="externalLink" href="http://singa.incubator.apache.org/docs/architecture">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 class="externalLink" href="http://singa.incubator.apache.org/docs/frameworks">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 class="externalLink" href="http://singa.incubator.apache.org/docs/neural-net">other schemes</a>. All ot her 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>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>in working</i>…</p></div> +<div class="section"> +<h2><a name="Where_to_go_next"></a>Where to go next</h2> +<p>The <a class="externalLink" href="http://singa.incubator.apache.org/docs/programming-guide">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> Modified: websites/staging/singa/trunk/content/docs/rbm.html ============================================================================== --- websites/staging/singa/trunk/content/docs/rbm.html (original) +++ websites/staging/singa/trunk/content/docs/rbm.html Wed Sep 2 10:31:57 2015 @@ -1,15 +1,15 @@ <!DOCTYPE html> <!-- - | Generated by Apache Maven Doxia at 2015-08-17 + | Generated by Apache Maven Doxia at 2015-09-02 | 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="20150817" /> + <meta name="Date-Revision-yyyymmdd" content="20150902" /> <meta http-equiv="Content-Language" content="en" /> - <title>Apache SINGA – </title> + <title>Apache SINGA – 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" /> @@ -189,7 +189,7 @@ Apache SINGA</a> <span class="divider">/</span> </li> - <li class="active "></li> + <li class="active ">RBM Example</li> @@ -425,7 +425,332 @@ <div id="bodyColumn" class="span10" > - + <h1>RBM Example</h1> +<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’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 class="externalLink" href="http://singa.incubator.apache.org/docs/data">data preparation</a> page has details on converting this dataset into SINGA recognizable format (i.e., <a class="externalLink" href="http://singa.incubator.apache.org/api/classsinga_1_1DataShard.html">DataShard</a>). 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/rbm/ +$ 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/rbm0.conf +$ ./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 +</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="RBM0"></a>RBM0</h3> +<p><img src="http://singa.incubator.apache.org/assets/image/RBM0_new.PNG" align="center" width="200px" alt="" /> <span><b>Figure 1 - RBM0.</b></span></p> +<p>The neural net structure for training RBM0 is shown in Figure 1. The data layer and parser layer provides features for training RBM0. The visible layer (connected with parser layer) of RBM0 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: "RBMVis" + type: kRBMVis + srclayers:"mnist" + srclayers:"RBMHid" + rbmvis_conf{ + num_output: 1000 + } + param{ + name: "w0" + init{ + type: kGaussian + mean: 0.0 + std: 0.1 + } + } + param{ + name: "b0" + init{ + type: kConstant + value: 0.0 + } + } +} + +layer{ + name: "RBMHid" + type: kRBMHid + srclayers:"RBMVis" + rbmhid_conf{ + hid_dim: 1000 + } + param{ + name: "w0_" + share_from: "w0" + } + param{ + name: "b1" + 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>w0</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 class="externalLink" href="http://singa.incubator.apache.org/docs/param">parameter sharing</a> as shown above for the param <tt>w0</tt> and <tt>w0_</tt>.</p> +<p><a class="externalLink" href="http://singa.incubator.apache.org/docs/train-one-batch/#contrastive-divergence">Contrastive Divergence</a> is configured as the algorithm for <a class="externalLink" href="http://singa.incubator.apache.org/docs/train-one-batch">TrainOneBatch</a>. Following Hinton’s paper, we configure the <a class="externalLink" href="http://singa.incubator.apache.org/docs/updater/">updating protocol</a> as follows,</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.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: "SINGA_ROOT/rbm0/" +} +</pre></div></div> +<p>Then SINGA will <a class="externalLink" href="http://singa.incubator.apache.org/docs/checkpoint">checkpoint the parameters</a> into <i>SINGA_ROOT/rbm0/</i>.</p></div> +<div class="section"> +<h3><a name="RBM1"></a>RBM1</h3> +<p><img src="http://singa.incubator.apache.org/assets/image/RBM1_new.PNG" align="center" width="200px" alt="" /> <span><b>Figure 2 - RBM1.</b></span></p> +<p>Figure 2 shows the net structure of training RBM1. The visible units of RBM1 accept the output from the Sigmoid1 layer. The Inner1 layer is a <tt>InnerProductLayer</tt> whose parameters are set to the <tt>w0</tt> and <tt>b1</tt> learned from RBM0. 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: "Inner1" + type: kInnerProduct + srclayers:"mnist" + innerproduct_conf{ + num_output: 1000 + } + param{ + name: "w0" + } + param{ + name: "b1" + } +} + +layer{ + name: "Sigmoid1" + type: kSigmoid + srclayers:"Inner1" +} + +layer{ + name: "RBMVis" + type: kRBMVis + srclayers:"sigmoid1" + srclayers:"RBMHid" + rbmvis_conf{ + num_output: 500 + } + param{ + name: "w1" + init{ + type: kGaussian + mean: 0.0 + std: 0.1 + } + } + param{ + name: "b2" + init{ + type: kConstant + value: 0.0 + } + } +} + +layer{ + name: "RBMHid" + type: kRBMHid + srclayers:"RBMVis" + rbmhid_conf{ + hid_dim: 500 + } + param{ + name: "w1_" + share_from: "w1" + } + param{ + name: "b3" + init{ + type: kConstant + value: 0.0 + } + } +} +</pre></div></div> +<p>To load w0 and b1 from RBM0’s checkpoint file, we configure the <tt>checkpoint_path</tt> as,</p> + +<div class="source"> +<div class="source"><pre class="prettyprint">checkpoint_path: "SINGA_ROOT/rbm0/checkpoint/step6000-worker0.bin" +cluster{ + workspace: "SINGA_ROOT/rbm1" +} +</pre></div></div> +<p>The workspace is changed for checkpointing w1, b2 and b3 into <i>SINGA_ROOT/rbm1/</i>.</p></div> +<div class="section"> +<h3><a name="RBM2"></a>RBM2</h3> +<p><img src="http://singa.incubator.apache.org/assets/image/RBM2_new.PNG" align="center" width="200px" alt="" /> <span><b>Figure 3 - RBM2.</b></span></p> +<p>Figure 3 shows the net structure of training RBM2. In this model, a layer with 250 units is added as the hidden layer of RBM2. The visible units of RBM2 accepts output from Sigmoid2 layer. Parameters of Inner1 and inner2 are set to <tt>w0,b1,w1,b2</tt> which can be load from the checkpoint file of RBM1, i.e., “SINGA_ROOT/rbm1/”.</p></div> +<div class="section"> +<h3><a name="RBM3"></a>RBM3</h3> +<p><img src="http://singa.incubator.apache.org/assets/image/RBM3_new.PNG" align="center" width="200px" alt="" /> <span><b>Figure 4 - RBM3.</b></span></p> +<p>Figure 4 shows the net structure of training RBM3. It is similar to Figure 3, but according to <a class="externalLink" href="http://www.cs.toronto.edu/~hinton/science.pdf">Hinton’s science paper</a>, the hidden units of the top RBM (RBM3) have stochastic real-valued states drawn from a unit variance Gaussian whose mean is determined by the input from the RBM’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 RBM3 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: "RBMVis" + type: kRBMVis + srclayers:"sigmoid3" + srclayers:"RBMHid" + rbmvis_conf{ + num_output: 30 + } + param{ + name: "w3" + init{ + type: kGaussian + mean: 0.0 + std: 0.1 + } + } + param{ + name: "b6" + init{ + type: kConstant + value: 0.0 + } + } +} + +layer{ + name: "RBMHid" + type: kRBMHid + srclayers:"RBMVis" + rbmhid_conf{ + hid_dim: 30 + gaussian: true + } + param{ + name: "w3_" + share_from: "w3" + } + param{ + name: "b7" + init{ + type: kConstant + value: 0.0 + } + } +} +</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 “unfolded” to form encoder and decoder networks that are initialized using the parameters from the previous 4 RBMs.</p> +<p><img src="http://singa.incubator.apache.org/assets/image/autoencoder_new.PNG" align="center" width="500px" alt="" /> <span><b>Figure 5 - Auto-Encoder.</b></span></p> +<p>Figure 5 shows the neural net structure for training the auto-encoder. <a class="externalLink" href="http://singa.incubator.apache.org/docs/train-one-batch/">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 class="externalLink" href="http://singa.incubator.apache.org/docs/updater#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’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: "data" } +layer{ name:"mnist" } +layer{ + name: "Inner1" + param{ name: "w0" } + param{ name: "b1" } +} +layer{ name: "sigmoid1" } +... +layer{ + name: "Inner8" + innerproduct_conf{ + num_output: 784 + transpose: true + } + param{ + name: "w8" + share_from: "w1" + } + param{ name: "b0" } +} +layer{ name: "sigmoid8" } +### Euclidean Loss Layer Configuration +layer{ + name: "loss" + type:kEuclideanLoss + srclayers:"sigmoid8" + srclayers:"mnist" +} +</pre></div></div> +<p>To load pre-trained parameters from the 4 RBMs’ checkpoint file we configure <tt>checkpoint_path</tt> as</p> + +<div class="source"> +<div class="source"><pre class="prettyprint">### Checkpoint Configuration +checkpoint_path: "examples/rbm/checkpoint/rbm0/checkpoint/step6000-worker0.bin" +checkpoint_path: "examples/rbm/checkpoint/rbm1/checkpoint/step6000-worker0.bin" +checkpoint_path: "examples/rbm/checkpoint/rbm2/checkpoint/step6000-worker0.bin" +checkpoint_path: "examples/rbm/checkpoint/rbm3/checkpoint/step6000-worker0.bin" +</pre></div></div></div></div> +<div class="section"> +<h2><a name="Visualization_Results"></a>Visualization Results</h2> + +<div> +<img src="http://singa.incubator.apache.org/assets/image/rbm-weight.PNG" align="center" width="300px" alt="" /> + +<img src="http://singa.incubator.apache.org/assets/image/rbm-feature.PNG" align="center" width="300px" alt="" /> +<br /> +<span><b>Figure 6 - Bottom RBM weight matrix.</b></span> +  +  +  +  + +<span><b>Figure 7 - Top layer features.</b></span> +</div> +<p>Figure 6 visualizes sample columns of the weight matrix of RBM0, 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>
