<!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 10:26:35 PDT 2015 -->
<title>MLUtils</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="MLUtils";
}
//-->
</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/util/MFDataGenerator.html" title="class in org.apache.spark.mllib.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/spark/mllib/util/Saveable.html" title="interface in org.apache.spark.mllib.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/spark/mllib/util/MLUtils.html" target="_top">Frames</a></li>
<li><a href="MLUtils.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.util</div>
<h2 title="Class MLUtils" class="title">Class MLUtils</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.spark.mllib.util.MLUtils</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">MLUtils</span>
extends java.lang.Object</pre>
<div class="block">Helper methods to load, save and pre-process data used in ML Lib.</div>
</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/util/MLUtils.html#MLUtils()">MLUtils</a></strong>()</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>static <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/util/MLUtils.html#appendBias(org.apache.spark.mllib.linalg.Vector)">appendBias</a></strong>(<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> vector)</code>
<div class="block">Returns a new vector with <code>1.0</code> (bias) appended to the input vector.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#EPSILON()">EPSILON</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <T> scala.Tuple2<<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><T>,<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><T>>[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#kFold(org.apache.spark.rdd.RDD, int, int, scala.reflect.ClassTag)">kFold</a></strong>(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><T> rdd,
int numFolds,
int seed,
scala.reflect.ClassTag<T> evidence$1)</code>
<div class="block">:: Experimental ::
Return a k element array of pairs of RDDs with the first element of each pair
containing the training data, a complement of the validation data and the second
element, the validation data, containing a unique 1/kth of the data.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLabeledData(org.apache.spark.SparkContext, java.lang.String)">loadLabeledData</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String dir)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Should use <a href="../../../../../org/apache/spark/rdd/RDD.html#saveAsTextFile(java.lang.String)"><code>RDD.saveAsTextFile(java.lang.String)</code></a> for saving and
<a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)"><code>loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)</code></a> for loading.</i></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String)">loadLabeledPoints</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String dir)</code>
<div class="block">Loads labeled points saved using <code>RDD[LabeledPoint].saveAsTextFile</code> with the default number of
partitions.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)">loadLabeledPoints</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
int minPartitions)</code>
<div class="block">Loads labeled points saved using <code>RDD[LabeledPoint].saveAsTextFile</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String)">loadLibSVMFile</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">Loads binary labeled data in the LIBSVM format into an RDD[LabeledPoint], with number of
features determined automatically and the default number of partitions.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, boolean)">loadLibSVMFile</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
boolean multiclass)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, boolean, int)">loadLibSVMFile</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
boolean multiclass,
int numFeatures)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, boolean, int, int)">loadLibSVMFile</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
boolean multiclass,
int numFeatures,
int minPartitions)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, int)">loadLibSVMFile</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
int numFeatures)</code>
<div class="block">Loads labeled data in the LIBSVM format into an RDD[LabeledPoint], with the default number of
partitions.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, int, int)">loadLibSVMFile</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
int numFeatures,
int minPartitions)</code>
<div class="block">Loads labeled data in the LIBSVM format into an RDD[LabeledPoint].</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<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/util/MLUtils.html#loadVectors(org.apache.spark.SparkContext, java.lang.String)">loadVectors</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">Loads vectors saved using <code>RDD[Vector].saveAsTextFile</code> with the default number of partitions.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<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/util/MLUtils.html#loadVectors(org.apache.spark.SparkContext, java.lang.String, int)">loadVectors</a></strong>(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
int minPartitions)</code>
<div class="block">Loads vectors saved using <code>RDD[Vector].saveAsTextFile</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#saveAsLibSVMFile(org.apache.spark.rdd.RDD, java.lang.String)">saveAsLibSVMFile</a></strong>(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> data,
java.lang.String dir)</code>
<div class="block">Save labeled data in LIBSVM format.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#saveLabeledData(org.apache.spark.rdd.RDD, java.lang.String)">saveLabeledData</a></strong>(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> data,
java.lang.String dir)</code>
<div class="block"><strong>Deprecated.</strong>
<div class="block"><i>Should use <a href="../../../../../org/apache/spark/rdd/RDD.html#saveAsTextFile(java.lang.String)"><code>RDD.saveAsTextFile(java.lang.String)</code></a> for saving and
<a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)"><code>loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)</code></a> for loading.</i></div>
</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>
</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="MLUtils()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>MLUtils</h4>
<pre>public MLUtils()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="EPSILON()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EPSILON</h4>
<pre>public static double EPSILON()</pre>
</li>
</ul>
<a name="loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLibSVMFile</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLibSVMFile(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
int numFeatures,
int minPartitions)</pre>
<div class="block">Loads labeled data in the LIBSVM format into an RDD[LabeledPoint].
The LIBSVM format is a text-based format used by LIBSVM and LIBLINEAR.
Each line represents a labeled sparse feature vector using the following format:
<pre><code>label index1:value1 index2:value2 ...</code></pre>
where the indices are one-based and in ascending order.
This method parses each line into a {@link org.apache.spark.mllib.regression.LabeledPoint},
where the feature indices are converted to zero-based.
@param sc Spark context
@param path file or directory path in any Hadoop-supported file system URI
@param numFeatures number of features, which will be determined from the input data if a
nonpositive value is given. This is useful when the dataset is already split
into multiple files and you want to load them separately, because some
features may not present in certain files, which leads to inconsistent
feature dimensions.
@param minPartitions min number of partitions
@return labeled data stored as an RDD[LabeledPoint]</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - (undocumented)</dd><dd><code>path</code> - (undocumented)</dd><dd><code>numFeatures</code> - (undocumented)</dd><dd><code>minPartitions</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, boolean, int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLibSVMFile</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLibSVMFile(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
boolean multiclass,
int numFeatures,
int minPartitions)</pre>
</li>
</ul>
<a name="loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLibSVMFile</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLibSVMFile(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
int numFeatures)</pre>
<div class="block">Loads labeled data in the LIBSVM format into an RDD[LabeledPoint], with the default number of
partitions.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - (undocumented)</dd><dd><code>path</code> - (undocumented)</dd><dd><code>numFeatures</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, boolean, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLibSVMFile</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLibSVMFile(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
boolean multiclass,
int numFeatures)</pre>
</li>
</ul>
<a name="loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLibSVMFile</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLibSVMFile(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
boolean multiclass)</pre>
</li>
</ul>
<a name="loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLibSVMFile</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLibSVMFile(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path)</pre>
<div class="block">Loads binary labeled data in the LIBSVM format into an RDD[LabeledPoint], with number of
features determined automatically and the default number of partitions.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - (undocumented)</dd><dd><code>path</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="saveAsLibSVMFile(org.apache.spark.rdd.RDD, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>saveAsLibSVMFile</h4>
<pre>public static void saveAsLibSVMFile(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> data,
java.lang.String dir)</pre>
<div class="block">Save labeled data in LIBSVM format.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - an RDD of LabeledPoint to be saved</dd><dd><code>dir</code> - directory to save the data
<p></dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, int, int)"><code>loadLibSVMFile(org.apache.spark.SparkContext, java.lang.String, int, int)</code></a></dd></dl>
</li>
</ul>
<a name="loadVectors(org.apache.spark.SparkContext, java.lang.String, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadVectors</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>> loadVectors(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
int minPartitions)</pre>
<div class="block">Loads vectors saved using <code>RDD[Vector].saveAsTextFile</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - Spark context</dd><dd><code>path</code> - file or directory path in any Hadoop-supported file system URI</dd><dd><code>minPartitions</code> - min number of partitions</dd>
<dt><span class="strong">Returns:</span></dt><dd>vectors stored as an RDD[Vector]</dd></dl>
</li>
</ul>
<a name="loadVectors(org.apache.spark.SparkContext, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadVectors</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a>> loadVectors(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path)</pre>
<div class="block">Loads vectors saved using <code>RDD[Vector].saveAsTextFile</code> with the default number of partitions.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - (undocumented)</dd><dd><code>path</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLabeledPoints</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLabeledPoints(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String path,
int minPartitions)</pre>
<div class="block">Loads labeled points saved using <code>RDD[LabeledPoint].saveAsTextFile</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - Spark context</dd><dd><code>path</code> - file or directory path in any Hadoop-supported file system URI</dd><dd><code>minPartitions</code> - min number of partitions</dd>
<dt><span class="strong">Returns:</span></dt><dd>labeled points stored as an RDD[LabeledPoint]</dd></dl>
</li>
</ul>
<a name="loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLabeledPoints</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLabeledPoints(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String dir)</pre>
<div class="block">Loads labeled points saved using <code>RDD[LabeledPoint].saveAsTextFile</code> with the default number of
partitions.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - (undocumented)</dd><dd><code>dir</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="loadLabeledData(org.apache.spark.SparkContext, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>loadLabeledData</h4>
<pre>public static <a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> loadLabeledData(<a href="../../../../../org/apache/spark/SparkContext.html" title="class in org.apache.spark">SparkContext</a> sc,
java.lang.String dir)</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Should use <a href="../../../../../org/apache/spark/rdd/RDD.html#saveAsTextFile(java.lang.String)"><code>RDD.saveAsTextFile(java.lang.String)</code></a> for saving and
<a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)"><code>loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)</code></a> for loading.</i></div>
<div class="block">Load labeled data from a file. The data format used here is
L, f1 f2 ...
where f1, f2 are feature values in Double and L is the corresponding label as Double.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sc</code> - SparkContext</dd><dd><code>dir</code> - Directory to the input data files.</dd>
<dt><span class="strong">Returns:</span></dt><dd>An RDD of LabeledPoint. Each labeled point has two elements: the first element is
the label, and the second element represents the feature values (an array of Double).
<p></dd></dl>
</li>
</ul>
<a name="saveLabeledData(org.apache.spark.rdd.RDD, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>saveLabeledData</h4>
<pre>public static void saveLabeledData(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><<a href="../../../../../org/apache/spark/mllib/regression/LabeledPoint.html" title="class in org.apache.spark.mllib.regression">LabeledPoint</a>> data,
java.lang.String dir)</pre>
<div class="block"><span class="strong">Deprecated.</span> <i>Should use <a href="../../../../../org/apache/spark/rdd/RDD.html#saveAsTextFile(java.lang.String)"><code>RDD.saveAsTextFile(java.lang.String)</code></a> for saving and
<a href="../../../../../org/apache/spark/mllib/util/MLUtils.html#loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)"><code>loadLabeledPoints(org.apache.spark.SparkContext, java.lang.String, int)</code></a> for loading.</i></div>
<div class="block">Save labeled data to a file. The data format used here is
L, f1 f2 ...
where f1, f2 are feature values in Double and L is the corresponding label as Double.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - An RDD of LabeledPoints containing data to be saved.</dd><dd><code>dir</code> - Directory to save the data.
<p></dd></dl>
</li>
</ul>
<a name="kFold(org.apache.spark.rdd.RDD, int, int, scala.reflect.ClassTag)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>kFold</h4>
<pre>public static <T> scala.Tuple2<<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><T>,<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><T>>[] kFold(<a href="../../../../../org/apache/spark/rdd/RDD.html" title="class in org.apache.spark.rdd">RDD</a><T> rdd,
int numFolds,
int seed,
scala.reflect.ClassTag<T> evidence$1)</pre>
<div class="block">:: Experimental ::
Return a k element array of pairs of RDDs with the first element of each pair
containing the training data, a complement of the validation data and the second
element, the validation data, containing a unique 1/kth of the data. Where k=numFolds.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>rdd</code> - (undocumented)</dd><dd><code>numFolds</code> - (undocumented)</dd><dd><code>seed</code> - (undocumented)</dd><dd><code>evidence$1</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="appendBias(org.apache.spark.mllib.linalg.Vector)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>appendBias</h4>
<pre>public static <a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> appendBias(<a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> vector)</pre>
<div class="block">Returns a new vector with <code>1.0</code> (bias) appended to the input vector.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>vector</code> - (undocumented)</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</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/util/MFDataGenerator.html" title="class in org.apache.spark.mllib.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/spark/mllib/util/Saveable.html" title="interface in org.apache.spark.mllib.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/spark/mllib/util/MLUtils.html" target="_top">Frames</a></li>
<li><a href="MLUtils.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>