<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Wed Sep 16 15:55:12 PDT 2015 -->
<title>GradientDescent</title>
<meta name="date" content="2015-09-16">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="GradientDescent";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/spark/mllib/optimization/Gradient.html" title="class in org.apache.spark.mllib.optimization"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/spark/mllib/optimization/HingeGradient.html" title="class in org.apache.spark.mllib.optimization"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/spark/mllib/optimization/GradientDescent.html" target="_top">Frames</a></li>
<li><a href="GradientDescent.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.spark.mllib.optimization</div>
<h2 title="Class GradientDescent" class="title">Class GradientDescent</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.spark.mllib.optimization.GradientDescent</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable, <a href="../../../../../org/apache/spark/Logging.html" title="interface in org.apache.spark">Logging</a>, <a href="../../../../../org/apache/spark/mllib/optimization/Optimizer.html" title="interface in org.apache.spark.mllib.optimization">Optimizer</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">GradientDescent</span>
extends java.lang.Object
implements <a href="../../../../../org/apache/spark/mllib/optimization/Optimizer.html" title="interface in org.apache.spark.mllib.optimization">Optimizer</a>, <a href="../../../../../org/apache/spark/Logging.html" title="interface in org.apache.spark">Logging</a></pre>
<div class="block">Class used to solve an optimization problem using Gradient Descent.
param: gradient Gradient function to be used.
param: updater Updater to be used to update weights after every iteration.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../serialized-form.html#org.apache.spark.mllib.optimization.GradientDescent">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#optimize(org.apache.spark.rdd.RDD, org.apache.spark.mllib.linalg.Vector)">optimize</a></strong>(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><scala.Tuple2<java.lang.Object,<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>>> data,
<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> initialWeights)</code>
<div class="block">:: DeveloperApi ::
Runs gradient descent on the given training data.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static scala.Tuple2<<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>,double[]></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#runMiniBatchSGD(org.apache.spark.rdd.RDD, org.apache.spark.mllib.optimization.Gradient, org.apache.spark.mllib.optimization.Updater, double, int, double, double, org.apache.spark.mllib.linalg.Vector)">runMiniBatchSGD</a></strong>(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><scala.Tuple2<java.lang.Object,<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>>> data,
<a href="../../../../../org/apache/spark/mllib/optimization/Gradient.html" title="class in org.apache.spark.mllib.optimization">Gradient</a> gradient,
<a href="../../../../../org/apache/spark/mllib/optimization/Updater.html" title="class in org.apache.spark.mllib.optimization">Updater</a> updater,
double stepSize,
int numIterations,
double regParam,
double miniBatchFraction,
<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> initialWeights)</code>
<div class="block">Alias of <code>runMiniBatchSGD</code> with convergenceTol set to default value of 0.001.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static scala.Tuple2<<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>,double[]></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#runMiniBatchSGD(org.apache.spark.rdd.RDD, org.apache.spark.mllib.optimization.Gradient, org.apache.spark.mllib.optimization.Updater, double, int, double, double, org.apache.spark.mllib.linalg.Vector, double)">runMiniBatchSGD</a></strong>(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><scala.Tuple2<java.lang.Object,<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>>> data,
<a href="../../../../../org/apache/spark/mllib/optimization/Gradient.html" title="class in org.apache.spark.mllib.optimization">Gradient</a> gradient,
<a href="../../../../../org/apache/spark/mllib/optimization/Updater.html" title="class in org.apache.spark.mllib.optimization">Updater</a> updater,
double stepSize,
int numIterations,
double regParam,
double miniBatchFraction,
<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> initialWeights,
double convergenceTol)</code>
<div class="block">Run stochastic gradient descent (SGD) in parallel using mini batches.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#setConvergenceTol(double)">setConvergenceTol</a></strong>(double tolerance)</code>
<div class="block">Set the convergence tolerance.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#setGradient(org.apache.spark.mllib.optimization.Gradient)">setGradient</a></strong>(<a href="../../../../../org/apache/spark/mllib/optimization/Gradient.html" title="class in org.apache.spark.mllib.optimization">Gradient</a> gradient)</code>
<div class="block">Set the gradient function (of the loss function of one single data example)
to be used for SGD.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#setMiniBatchFraction(double)">setMiniBatchFraction</a></strong>(double fraction)</code>
<div class="block">:: Experimental ::
Set fraction of data to be used for each SGD iteration.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#setNumIterations(int)">setNumIterations</a></strong>(int iters)</code>
<div class="block">Set the number of iterations for SGD.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#setRegParam(double)">setRegParam</a></strong>(double regParam)</code>
<div class="block">Set the regularization parameter.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#setStepSize(double)">setStepSize</a></strong>(double step)</code>
<div class="block">Set the initial step size of SGD for the first step.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html#setUpdater(org.apache.spark.mllib.optimization.Updater)">setUpdater</a></strong>(<a href="../../../../../org/apache/spark/mllib/optimization/Updater.html" title="class in org.apache.spark.mllib.optimization">Updater</a> updater)</code>
<div class="block">Set the updater function to actually perform a gradient step in a given direction.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.spark.Logging">
<!-- -->
</a>
<h3>Methods inherited from interface org.apache.spark.<a href="../../../../../org/apache/spark/Logging.html" title="interface in org.apache.spark">Logging</a></h3>
<code><a href="../../../../../org/apache/spark/Logging.html#initializeIfNecessary()">initializeIfNecessary</a>, <a href="../../../../../org/apache/spark/Logging.html#initializeLogging()">initializeLogging</a>, <a href="../../../../../org/apache/spark/Logging.html#isTraceEnabled()">isTraceEnabled</a>, <a href="../../../../../org/apache/spark/Logging.html#log_()">log_</a>, <a href="../../../../../org/apache/spark/Logging.html#log()">log</a>, <a href="../../../../../org/apache/spark/Logging.html#logDebug(scala.Function0)">logDebug</a>, <a href="../../../../../org/apache/spark/Logging.html#logDebug(scala.Function0, java.lang.Throwable)">logDebug</a>, <a href="../../../../../org/apache/spark/Logging.html#logError(scala.Function0)">logError</a>, <a href="../../../../../org/apache/spark/Logging.html#logError(scala.Function0, java.lang.Throwable)">logError</a>, <a href="../../../../../org/apache/spark/Logging.html#logInfo(scala.Function0)">logInfo</a>, <a href="../../../../../org/apache/spark/Logging.html#logInfo(scala.Function0, java.lang.Throwable)">logInfo</a>, <a href="../../../../../org/apache/spark/Logging.html#logName()">logName</a>, <a href="../../../../../org/apache/spark/Logging.html#logTrace(scala.Function0)">logTrace</a>, <a href="../../../../../org/apache/spark/Logging.html#logTrace(scala.Function0, java.lang.Throwable)">logTrace</a>, <a href="../../../../../org/apache/spark/Logging.html#logWarning(scala.Function0)">logWarning</a>, <a href="../../../../../org/apache/spark/Logging.html#logWarning(scala.Function0, java.lang.Throwable)">logWarning</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="runMiniBatchSGD(org.apache.spark.rdd.RDD, org.apache.spark.mllib.optimization.Gradient, org.apache.spark.mllib.optimization.Updater, double, int, double, double, org.apache.spark.mllib.linalg.Vector, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>runMiniBatchSGD</h4>
<pre>public static scala.Tuple2<<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>,double[]> runMiniBatchSGD(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><scala.Tuple2<java.lang.Object,<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>>> data,
<a href="../../../../../org/apache/spark/mllib/optimization/Gradient.html" title="class in org.apache.spark.mllib.optimization">Gradient</a> gradient,
<a href="../../../../../org/apache/spark/mllib/optimization/Updater.html" title="class in org.apache.spark.mllib.optimization">Updater</a> updater,
double stepSize,
int numIterations,
double regParam,
double miniBatchFraction,
<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> initialWeights,
double convergenceTol)</pre>
<div class="block">Run stochastic gradient descent (SGD) in parallel using mini batches.
In each iteration, we sample a subset (fraction miniBatchFraction) of the total data
in order to compute a gradient estimate.
Sampling, and averaging the subgradients over this subset is performed using one standard
spark map-reduce in each iteration.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - Input data for SGD. RDD of the set of data examples, each of
the form (label, [feature values]).</dd><dd><code>gradient</code> - Gradient object (used to compute the gradient of the loss function of
one single data example)</dd><dd><code>updater</code> - Updater function to actually perform a gradient step in a given direction.</dd><dd><code>stepSize</code> - initial step size for the first step</dd><dd><code>numIterations</code> - number of iterations that SGD should be run.</dd><dd><code>regParam</code> - regularization parameter</dd><dd><code>miniBatchFraction</code> - fraction of the input data set that should be used for
one iteration of SGD. Default value 1.0.</dd><dd><code>convergenceTol</code> - Minibatch iteration will end before numIterations if the relative
difference between the current weight and the previous weight is less
than this value. In measuring convergence, L2 norm is calculated.
Default value 0.001. Must be between 0.0 and 1.0 inclusively.</dd><dd><code>initialWeights</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>A tuple containing two elements. The first element is a column matrix containing
weights for every feature, and the second element is an array containing the
stochastic loss computed for every iteration.</dd></dl>
</li>
</ul>
<a name="runMiniBatchSGD(org.apache.spark.rdd.RDD, org.apache.spark.mllib.optimization.Gradient, org.apache.spark.mllib.optimization.Updater, double, int, double, double, org.apache.spark.mllib.linalg.Vector)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>runMiniBatchSGD</h4>
<pre>public static scala.Tuple2<<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>,double[]> runMiniBatchSGD(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><scala.Tuple2<java.lang.Object,<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>>> data,
<a href="../../../../../org/apache/spark/mllib/optimization/Gradient.html" title="class in org.apache.spark.mllib.optimization">Gradient</a> gradient,
<a href="../../../../../org/apache/spark/mllib/optimization/Updater.html" title="class in org.apache.spark.mllib.optimization">Updater</a> updater,
double stepSize,
int numIterations,
double regParam,
double miniBatchFraction,
<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> initialWeights)</pre>
<div class="block">Alias of <code>runMiniBatchSGD</code> with convergenceTol set to default value of 0.001.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - (undocumented)</dd><dd><code>gradient</code> - (undocumented)</dd><dd><code>updater</code> - (undocumented)</dd><dd><code>stepSize</code> - (undocumented)</dd><dd><code>numIterations</code> - (undocumented)</dd><dd><code>regParam</code> - (undocumented)</dd><dd><code>miniBatchFraction</code> - (undocumented)</dd><dd><code>initialWeights</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="setStepSize(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setStepSize</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a> setStepSize(double step)</pre>
<div class="block">Set the initial step size of SGD for the first step. Default 1.0.
In subsequent steps, the step size will decrease with stepSize/sqrt(t)</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>step</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="setMiniBatchFraction(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMiniBatchFraction</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a> setMiniBatchFraction(double fraction)</pre>
<div class="block">:: Experimental ::
Set fraction of data to be used for each SGD iteration.
Default 1.0 (corresponding to deterministic/classical gradient descent)</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>fraction</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="setNumIterations(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setNumIterations</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a> setNumIterations(int iters)</pre>
<div class="block">Set the number of iterations for SGD. Default 100.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>iters</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="setRegParam(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setRegParam</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a> setRegParam(double regParam)</pre>
<div class="block">Set the regularization parameter. Default 0.0.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>regParam</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="setConvergenceTol(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setConvergenceTol</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a> setConvergenceTol(double tolerance)</pre>
<div class="block">Set the convergence tolerance. Default 0.001
convergenceTol is a condition which decides iteration termination.
The end of iteration is decided based on below logic.
- If the norm of the new solution vector is >1, the diff of solution vectors
is compared to relative tolerance which means normalizing by the norm of
the new solution vector.
- If the norm of the new solution vector is <=1, the diff of solution vectors
is compared to absolute tolerance which is not normalizing.
Must be between 0.0 and 1.0 inclusively.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>tolerance</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="setGradient(org.apache.spark.mllib.optimization.Gradient)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setGradient</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a> setGradient(<a href="../../../../../org/apache/spark/mllib/optimization/Gradient.html" title="class in org.apache.spark.mllib.optimization">Gradient</a> gradient)</pre>
<div class="block">Set the gradient function (of the loss function of one single data example)
to be used for SGD.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>gradient</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="setUpdater(org.apache.spark.mllib.optimization.Updater)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUpdater</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/optimization/GradientDescent.html" title="class in org.apache.spark.mllib.optimization">GradientDescent</a> setUpdater(<a href="../../../../../org/apache/spark/mllib/optimization/Updater.html" title="class in org.apache.spark.mllib.optimization">Updater</a> updater)</pre>
<div class="block">Set the updater function to actually perform a gradient step in a given direction.
The updater is responsible to perform the update from the regularization term as well,
and therefore determines what kind or regularization is used, if any.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>updater</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="optimize(org.apache.spark.rdd.RDD, org.apache.spark.mllib.linalg.Vector)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>optimize</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> optimize(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><scala.Tuple2<java.lang.Object,<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>>> data,
<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> initialWeights)</pre>
<div class="block">:: DeveloperApi ::
Runs gradient descent on the given training data.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/spark/mllib/optimization/Optimizer.html#optimize(org.apache.spark.rdd.RDD, org.apache.spark.mllib.linalg.Vector)">optimize</a></code> in interface <code><a href="../../../../../org/apache/spark/mllib/optimization/Optimizer.html" title="interface in org.apache.spark.mllib.optimization">Optimizer</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - training data</dd><dd><code>initialWeights</code> - initial weights</dd>
<dt><span class="strong">Returns:</span></dt><dd>solution vector</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/spark/mllib/optimization/Gradient.html" title="class in org.apache.spark.mllib.optimization"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/spark/mllib/optimization/HingeGradient.html" title="class in org.apache.spark.mllib.optimization"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/spark/mllib/optimization/GradientDescent.html" target="_top">Frames</a></li>
<li><a href="GradientDescent.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<script defer="defer" type="text/javascript" src="../../../../../lib/jquery.js"></script><script defer="defer" type="text/javascript" src="../../../../../lib/api-javadocs.js"></script></body>
</html>