<!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>LinearRegressionModel</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="LinearRegressionModel";
}
//-->
</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/regression/LassoWithSGD.html" title="class in org.apache.spark.mllib.regression"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionWithSGD.html" title="class in org.apache.spark.mllib.regression"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/spark/mllib/regression/LinearRegressionModel.html" target="_top">Frames</a></li>
<li><a href="LinearRegressionModel.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><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </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.regression</div>
<h2 title="Class LinearRegressionModel" class="title">Class LinearRegressionModel</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html" title="class in org.apache.spark.mllib.regression">org.apache.spark.mllib.regression.GeneralizedLinearModel</a></li>
<li>
<ul class="inheritance">
<li>org.apache.spark.mllib.regression.LinearRegressionModel</li>
</ul>
</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/mllib/pmml/PMMLExportable.html" title="interface in org.apache.spark.mllib.pmml">PMMLExportable</a>, <a href="../../../../../org/apache/spark/mllib/regression/RegressionModel.html" title="interface in org.apache.spark.mllib.regression">RegressionModel</a>, <a href="../../../../../org/apache/spark/mllib/util/Saveable.html" title="interface in org.apache.spark.mllib.util">Saveable</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">LinearRegressionModel</span>
extends <a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html" title="class in org.apache.spark.mllib.regression">GeneralizedLinearModel</a>
implements <a href="../../../../../org/apache/spark/mllib/regression/RegressionModel.html" title="interface in org.apache.spark.mllib.regression">RegressionModel</a>, scala.Serializable, <a href="../../../../../org/apache/spark/mllib/util/Saveable.html" title="interface in org.apache.spark.mllib.util">Saveable</a>, <a href="../../../../../org/apache/spark/mllib/pmml/PMMLExportable.html" title="interface in org.apache.spark.mllib.pmml">PMMLExportable</a></pre>
<div class="block">Regression model trained using LinearRegression.
<p>
param: weights Weights computed for every feature.
param: intercept Intercept computed for this model.
<p></div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../serialized-form.html#org.apache.spark.mllib.regression.LinearRegressionModel">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionModel.html#LinearRegressionModel(org.apache.spark.mllib.linalg.Vector, double)">LinearRegressionModel</a></strong>(<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> weights,
double intercept)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== 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>protected java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionModel.html#formatVersion()">formatVersion</a></strong>()</code>
<div class="block">Current version of model save/load format.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionModel.html#intercept()">intercept</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionModel.html" title="class in org.apache.spark.mllib.regression">LinearRegressionModel</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionModel.html#load(org.apache.spark.SparkContext, java.lang.String)">load</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionModel.html#predictPoint(org.apache.spark.mllib.linalg.Vector, org.apache.spark.mllib.linalg.Vector, double)">predictPoint</a></strong>(<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> dataMatrix,
<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> weightMatrix,
double intercept)</code>
<div class="block">Predict the result given a data point and the weights learned.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionModel.html#save(org.apache.spark.SparkContext, java.lang.String)">save</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path)</code>
<div class="block">Save this model to the given path.</div>
</td>
</tr>
<tr class="rowColor">
<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/regression/LinearRegressionModel.html#weights()">weights</a></strong>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.spark.mllib.regression.GeneralizedLinearModel">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.spark.mllib.regression.<a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html" title="class in org.apache.spark.mllib.regression">GeneralizedLinearModel</a></h3>
<code><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html#predict(org.apache.spark.rdd.RDD)">predict</a>, <a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html#predict(org.apache.spark.mllib.linalg.Vector)">predict</a>, <a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html#toString()">toString</a></code></li>
</ul>
<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, wait, wait, wait</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.spark.mllib.regression.RegressionModel">
<!-- -->
</a>
<h3>Methods inherited from interface org.apache.spark.mllib.regression.<a href="../../../../../org/apache/spark/mllib/regression/RegressionModel.html" title="interface in org.apache.spark.mllib.regression">RegressionModel</a></h3>
<code><a href="../../../../../org/apache/spark/mllib/regression/RegressionModel.html#predict(org.apache.spark.api.java.JavaRDD)">predict</a>, <a href="../../../../../org/apache/spark/mllib/regression/RegressionModel.html#predict(org.apache.spark.rdd.RDD)">predict</a>, <a href="../../../../../org/apache/spark/mllib/regression/RegressionModel.html#predict(org.apache.spark.mllib.linalg.Vector)">predict</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.spark.mllib.pmml.PMMLExportable">
<!-- -->
</a>
<h3>Methods inherited from interface org.apache.spark.mllib.pmml.<a href="../../../../../org/apache/spark/mllib/pmml/PMMLExportable.html" title="interface in org.apache.spark.mllib.pmml">PMMLExportable</a></h3>
<code><a href="../../../../../org/apache/spark/mllib/pmml/PMMLExportable.html#toPMML()">toPMML</a>, <a href="../../../../../org/apache/spark/mllib/pmml/PMMLExportable.html#toPMML(java.io.OutputStream)">toPMML</a>, <a href="../../../../../org/apache/spark/mllib/pmml/PMMLExportable.html#toPMML(org.apache.spark.SparkContext, java.lang.String)">toPMML</a>, <a href="../../../../../org/apache/spark/mllib/pmml/PMMLExportable.html#toPMML(javax.xml.transform.stream.StreamResult)">toPMML</a>, <a href="../../../../../org/apache/spark/mllib/pmml/PMMLExportable.html#toPMML(java.lang.String)">toPMML</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="LinearRegressionModel(org.apache.spark.mllib.linalg.Vector, double)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>LinearRegressionModel</h4>
<pre>public LinearRegressionModel(<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> weights,
double intercept)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="load(org.apache.spark.SparkContext, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>load</h4>
<pre>public static <a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionModel.html" title="class in org.apache.spark.mllib.regression">LinearRegressionModel</a> load(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path)</pre>
</li>
</ul>
<a name="weights()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>weights</h4>
<pre>public <a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> weights()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html#weights()">weights</a></code> in class <code><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html" title="class in org.apache.spark.mllib.regression">GeneralizedLinearModel</a></code></dd>
</dl>
</li>
</ul>
<a name="intercept()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>intercept</h4>
<pre>public double intercept()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html#intercept()">intercept</a></code> in class <code><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html" title="class in org.apache.spark.mllib.regression">GeneralizedLinearModel</a></code></dd>
</dl>
</li>
</ul>
<a name="predictPoint(org.apache.spark.mllib.linalg.Vector, org.apache.spark.mllib.linalg.Vector, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>predictPoint</h4>
<pre>protected double predictPoint(<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> dataMatrix,
<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> weightMatrix,
double intercept)</pre>
<div class="block"><strong>Description copied from class: <code><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html#predictPoint(org.apache.spark.mllib.linalg.Vector, org.apache.spark.mllib.linalg.Vector, double)">GeneralizedLinearModel</a></code></strong></div>
<div class="block">Predict the result given a data point and the weights learned.
<p></div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html#predictPoint(org.apache.spark.mllib.linalg.Vector, org.apache.spark.mllib.linalg.Vector, double)">predictPoint</a></code> in class <code><a href="../../../../../org/apache/spark/mllib/regression/GeneralizedLinearModel.html" title="class in org.apache.spark.mllib.regression">GeneralizedLinearModel</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>dataMatrix</code> - Row vector containing the features for this data point</dd><dd><code>weightMatrix</code> - Column vector containing the weights of the model</dd><dd><code>intercept</code> - Intercept of the model.</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="save(org.apache.spark.SparkContext, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>save</h4>
<pre>public void save(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path)</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../org/apache/spark/mllib/util/Saveable.html#save(org.apache.spark.SparkContext, java.lang.String)">Saveable</a></code></strong></div>
<div class="block">Save this model to the given path.
<p>
This saves:
- human-readable (JSON) model metadata to path/metadata/
- Parquet formatted data to path/data/
<p>
The model may be loaded using <code>Loader.load</code>.
<p></div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/spark/mllib/util/Saveable.html#save(org.apache.spark.SparkContext, java.lang.String)">save</a></code> in interface <code><a href="../../../../../org/apache/spark/mllib/util/Saveable.html" title="interface in org.apache.spark.mllib.util">Saveable</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - Spark context used to save model data.</dd><dd><code>path</code> - Path specifying the directory in which to save this model.
If the directory already exists, this method throws an exception.</dd></dl>
</li>
</ul>
<a name="formatVersion()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>formatVersion</h4>
<pre>protected java.lang.String formatVersion()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../org/apache/spark/mllib/util/Saveable.html#formatVersion()">Saveable</a></code></strong></div>
<div class="block">Current version of model save/load format.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/spark/mllib/util/Saveable.html#formatVersion()">formatVersion</a></code> in interface <code><a href="../../../../../org/apache/spark/mllib/util/Saveable.html" title="interface in org.apache.spark.mllib.util">Saveable</a></code></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/regression/LassoWithSGD.html" title="class in org.apache.spark.mllib.regression"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/spark/mllib/regression/LinearRegressionWithSGD.html" title="class in org.apache.spark.mllib.regression"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/spark/mllib/regression/LinearRegressionModel.html" target="_top">Frames</a></li>
<li><a href="LinearRegressionModel.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><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </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>