blob: ccc09ce43acf0358340a024231e275d58f226e33 [file] [log] [blame]
<!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 (1.8.0_121) on Fri Apr 14 22:11:36 PDT 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AbstractVectorClassifier (Mahout Map-Reduce 0.13.0 API)</title>
<meta name="date" content="2017-04-14">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AbstractVectorClassifier (Mahout Map-Reduce 0.13.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":6,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":6,"i8":10,"i9":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<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="class-use/AbstractVectorClassifier.html">Use</a></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>Prev&nbsp;Class</li>
<li><a href="../../../../org/apache/mahout/classifier/ClassifierResult.html" title="class in org.apache.mahout.classifier"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/mahout/classifier/AbstractVectorClassifier.html" target="_top">Frames</a></li>
<li><a href="AbstractVectorClassifier.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</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.mahout.classifier</div>
<h2 title="Class AbstractVectorClassifier" class="title">Class AbstractVectorClassifier</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.mahout.classifier.AbstractVectorClassifier</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../../../org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.html" title="class in org.apache.mahout.classifier.naivebayes">AbstractNaiveBayesClassifier</a>, <a href="../../../../org/apache/mahout/classifier/sgd/AbstractOnlineLogisticRegression.html" title="class in org.apache.mahout.classifier.sgd">AbstractOnlineLogisticRegression</a>, <a href="../../../../org/apache/mahout/clustering/classify/ClusterClassifier.html" title="class in org.apache.mahout.clustering.classify">ClusterClassifier</a>, <a href="../../../../org/apache/mahout/classifier/sgd/CrossFoldLearner.html" title="class in org.apache.mahout.classifier.sgd">CrossFoldLearner</a>, <a href="../../../../org/apache/mahout/classifier/sgd/GradientMachine.html" title="class in org.apache.mahout.classifier.sgd">GradientMachine</a>, <a href="../../../../org/apache/mahout/classifier/sgd/PassiveAggressive.html" title="class in org.apache.mahout.classifier.sgd">PassiveAggressive</a></dd>
</dl>
<hr>
<br>
<pre>public abstract class <span class="typeNameLabel">AbstractVectorClassifier</span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Defines the interface for classifiers that take a vector as input. This is
implemented as an abstract class so that it can implement a number of handy
convenience methods related to classification of vectors.
<p>
A classifier takes an input vector and calculates the scores (usually
probabilities) that the input vector belongs to one of <code>n</code>
categories. In <code>AbstractVectorClassifier</code> each category is denoted
by an integer <code>c</code> between <code>0</code> and <code>n-1</code>
(inclusive).
<p>
New users should start by looking at <a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-"><code>classifyFull(org.apache.mahout.math.Vector)</code></a> (not <a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Vector-"><code>classify(org.apache.mahout.math.Vector)</code></a>).</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#MIN_LOG_LIKELIHOOD">MIN_LOG_LIKELIHOOD</a></span></code>
<div class="block">Minimum allowable log likelihood value.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#AbstractVectorClassifier--">AbstractVectorClassifier</a></span>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Matrix-">classify</a></span>(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a>&nbsp;data)</code>
<div class="block">Returns n-1 probabilities, one for each categories 1 through
<code>n-1</code>, for each row of a matrix, where <code>n</code> is equal
to <code>numCategories()</code>.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>abstract <a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Vector-">classify</a></span>(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;instance)</code>
<div class="block">Compute and return a vector containing <code>n-1</code> scores, where
<code>n</code> is equal to <code>numCategories()</code>, given an input
vector <code>instance</code>.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Matrix-">classifyFull</a></span>(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a>&nbsp;data)</code>
<div class="block">Returns a matrix where the rows of the matrix each contain <code>n</code> probabilities, one for each category.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-">classifyFull</a></span>(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;instance)</code>
<div class="block">Computes and returns a vector containing <code>n</code> scores, where
<code>n</code> is <code>numCategories()</code>, given an input vector
<code>instance</code>.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-org.apache.mahout.math.Vector-">classifyFull</a></span>(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;r,
<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;instance)</code>
<div class="block">Computes and returns a vector containing <code>n</code> scores, where
<code>n</code> is <code>numCategories()</code>, given an input vector
<code>instance</code>.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyNoLink-org.apache.mahout.math.Vector-">classifyNoLink</a></span>(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;features)</code>
<div class="block">Compute and return a vector of scores before applying the inverse link
function.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyScalar-org.apache.mahout.math.Matrix-">classifyScalar</a></span>(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a>&nbsp;data)</code>
<div class="block">Returns a vector of probabilities of category 1, one for each row
of a matrix.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>abstract double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyScalar-org.apache.mahout.math.Vector-">classifyScalar</a></span>(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;instance)</code>
<div class="block">Classifies a vector in the special case of a binary classifier where
<a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Vector-"><code>classify(Vector)</code></a> would return a vector with only one element.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#logLikelihood-int-org.apache.mahout.math.Vector-">logLikelihood</a></span>(int&nbsp;actual,
<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;data)</code>
<div class="block">Returns a measure of how good the classification for a particular example
actually is.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>abstract int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#numCategories--">numCategories</a></span>()</code>
<div class="block">Returns the number of categories that a target variable can be assigned to.</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&nbsp;java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="MIN_LOG_LIKELIHOOD">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>MIN_LOG_LIKELIHOOD</h4>
<pre>public static final&nbsp;double MIN_LOG_LIKELIHOOD</pre>
<div class="block">Minimum allowable log likelihood value.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../constant-values.html#org.apache.mahout.classifier.AbstractVectorClassifier.MIN_LOG_LIKELIHOOD">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="AbstractVectorClassifier--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>AbstractVectorClassifier</h4>
<pre>public&nbsp;AbstractVectorClassifier()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="numCategories--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>numCategories</h4>
<pre>public abstract&nbsp;int&nbsp;numCategories()</pre>
<div class="block">Returns the number of categories that a target variable can be assigned to.
A vector classifier will encode it's output as an integer from
<code>0</code> to <code>numCategories()-1</code> (inclusive).</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The number of categories.</dd>
</dl>
</li>
</ul>
<a name="classify-org.apache.mahout.math.Vector-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>classify</h4>
<pre>public abstract&nbsp;<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;classify(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;instance)</pre>
<div class="block">Compute and return a vector containing <code>n-1</code> scores, where
<code>n</code> is equal to <code>numCategories()</code>, given an input
vector <code>instance</code>. Higher scores indicate that the input vector
is more likely to belong to that category. The categories are denoted by
the integers <code>0</code> through <code>n-1</code> (inclusive), and the
scores in the returned vector correspond to categories 1 through
<code>n-1</code> (leaving out category 0). It is assumed that the score for
category 0 is one minus the sum of the scores in the returned vector.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>instance</code> - A feature vector to be classified.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A vector of probabilities in 1 of <code>n-1</code> encoding.</dd>
</dl>
</li>
</ul>
<a name="classifyNoLink-org.apache.mahout.math.Vector-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>classifyNoLink</h4>
<pre>public&nbsp;<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;classifyNoLink(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;features)</pre>
<div class="block">Compute and return a vector of scores before applying the inverse link
function. For logistic regression and other generalized linear models, this
is just the linear part of the classification.
<p>
The implementation of this method provided by <code>AbstractVectorClassifier</code> throws an
<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang"><code>UnsupportedOperationException</code></a>. Your subclass must explicitly override this method to support
this operation.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>features</code> - A feature vector to be classified.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A vector of scores. If transformed by the link function, these will become probabilities.</dd>
</dl>
</li>
</ul>
<a name="classifyScalar-org.apache.mahout.math.Vector-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>classifyScalar</h4>
<pre>public abstract&nbsp;double&nbsp;classifyScalar(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;instance)</pre>
<div class="block">Classifies a vector in the special case of a binary classifier where
<a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Vector-"><code>classify(Vector)</code></a> would return a vector with only one element. As
such, using this method can avoid the allocation of a vector.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>instance</code> - The feature vector to be classified.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The score for category 1.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Vector-"><code>classify(Vector)</code></a></dd>
</dl>
</li>
</ul>
<a name="classifyFull-org.apache.mahout.math.Vector-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>classifyFull</h4>
<pre>public&nbsp;<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;classifyFull(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;instance)</pre>
<div class="block">Computes and returns a vector containing <code>n</code> scores, where
<code>n</code> is <code>numCategories()</code>, given an input vector
<code>instance</code>. Higher scores indicate that the input vector is more
likely to belong to the corresponding category. The categories are denoted
by the integers <code>0</code> through <code>n-1</code> (inclusive).
<p>
Using this method it is possible to classify an input vector, for example,
by selecting the category with the largest score. If
<code>classifier</code> is an instance of
<code>AbstractVectorClassifier</code> and <code>input</code> is a
<code>Vector</code> of features describing an element to be classified,
then the following code could be used to classify <code>input</code>.<br>
<code>Vector scores = classifier.classifyFull(input);&lt;br&gt;
int assignedCategory = scores.maxValueIndex();&lt;br&gt;
</code> Here <code>assignedCategory</code> is the index of the category
with the maximum score.
<p>
If an <code>n-1</code> encoding is acceptable, and allocation performance
is an issue, then the <a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Vector-"><code>classify(Vector)</code></a> method is probably better
to use.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>instance</code> - A vector of features to be classified.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A vector of probabilities, one for each category.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Vector-"><code>classify(Vector)</code></a>,
<a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-org.apache.mahout.math.Vector-"><code>classifyFull(Vector r, Vector instance)</code></a></dd>
</dl>
</li>
</ul>
<a name="classifyFull-org.apache.mahout.math.Vector-org.apache.mahout.math.Vector-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>classifyFull</h4>
<pre>public&nbsp;<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;classifyFull(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;r,
<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;instance)</pre>
<div class="block">Computes and returns a vector containing <code>n</code> scores, where
<code>n</code> is <code>numCategories()</code>, given an input vector
<code>instance</code>. Higher scores indicate that the input vector is more
likely to belong to the corresponding category. The categories are denoted
by the integers <code>0</code> through <code>n-1</code> (inclusive). The
main difference between this method and <a href="../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-"><code>classifyFull(Vector)</code></a> is
that this method allows a user to provide a previously allocated
<code>Vector r</code> to store the returned scores.
<p>
Using this method it is possible to classify an input vector, for example,
by selecting the category with the largest score. If
<code>classifier</code> is an instance of
<code>AbstractVectorClassifier</code>, <code>result</code> is a non-null
<code>Vector</code>, and <code>input</code> is a <code>Vector</code> of
features describing an element to be classified, then the following code
could be used to classify <code>input</code>.<br>
<code>Vector scores = classifier.classifyFull(result, input); // Notice that scores == result&lt;br&gt;
int assignedCategory = scores.maxValueIndex();&lt;br&gt;
</code> Here <code>assignedCategory</code> is the index of the category
with the maximum score.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>r</code> - Where to put the results.</dd>
<dd><code>instance</code> - A vector of features to be classified.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A vector of scores/probabilities, one for each category.</dd>
</dl>
</li>
</ul>
<a name="classify-org.apache.mahout.math.Matrix-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>classify</h4>
<pre>public&nbsp;<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a>&nbsp;classify(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a>&nbsp;data)</pre>
<div class="block">Returns n-1 probabilities, one for each categories 1 through
<code>n-1</code>, for each row of a matrix, where <code>n</code> is equal
to <code>numCategories()</code>. The probability of the missing 0-th
category is 1 - rowSum(this result).</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - The matrix whose rows are the input vectors to classify</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A matrix of scores, one row per row of the input matrix, one column for each but the last category.</dd>
</dl>
</li>
</ul>
<a name="classifyFull-org.apache.mahout.math.Matrix-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>classifyFull</h4>
<pre>public&nbsp;<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a>&nbsp;classifyFull(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a>&nbsp;data)</pre>
<div class="block">Returns a matrix where the rows of the matrix each contain <code>n</code> probabilities, one for each category.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - The matrix whose rows are the input vectors to classify</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A matrix of scores, one row per row of the input matrix, one column for each but the last category.</dd>
</dl>
</li>
</ul>
<a name="classifyScalar-org.apache.mahout.math.Matrix-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>classifyScalar</h4>
<pre>public&nbsp;<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;classifyScalar(<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Matrix.html?is-external=true" title="class or interface in org.apache.mahout.math">Matrix</a>&nbsp;data)</pre>
<div class="block">Returns a vector of probabilities of category 1, one for each row
of a matrix. This only makes sense if there are exactly two categories, but
calling this method in that case can save a number of vector allocations.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - The matrix whose rows are vectors to classify</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A vector of scores, with one value per row of the input matrix.</dd>
</dl>
</li>
</ul>
<a name="logLikelihood-int-org.apache.mahout.math.Vector-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>logLikelihood</h4>
<pre>public&nbsp;double&nbsp;logLikelihood(int&nbsp;actual,
<a href="http://mahout.apache.org/mahout-math/apidocs/org/apache/mahout/math/Vector.html?is-external=true" title="class or interface in org.apache.mahout.math">Vector</a>&nbsp;data)</pre>
<div class="block">Returns a measure of how good the classification for a particular example
actually is.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>actual</code> - The correct category for the example.</dd>
<dd><code>data</code> - The vector to be classified.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The log likelihood of the correct answer as estimated by the current model. This will always be <= 0
and larger (closer to 0) indicates better accuracy. In order to simplify code that maintains eunning averages,
we bound this value at -100.</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>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<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="class-use/AbstractVectorClassifier.html">Use</a></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>Prev&nbsp;Class</li>
<li><a href="../../../../org/apache/mahout/classifier/ClassifierResult.html" title="class in org.apache.mahout.classifier"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/mahout/classifier/AbstractVectorClassifier.html" target="_top">Frames</a></li>
<li><a href="AbstractVectorClassifier.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2017 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>