| <!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>AbstractNaiveBayesClassifier (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="AbstractNaiveBayesClassifier (Mahout Map-Reduce 0.13.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":6,"i6":10,"i7":10}; |
| 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/AbstractNaiveBayesClassifier.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 Class</li> |
| <li><a href="../../../../../org/apache/mahout/classifier/naivebayes/BayesUtils.html" title="class in org.apache.mahout.classifier.naivebayes"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.html" target="_top">Frames</a></li> |
| <li><a href="AbstractNaiveBayesClassifier.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><a href="#fields.inherited.from.class.org.apache.mahout.classifier.AbstractVectorClassifier">Field</a> | </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.mahout.classifier.naivebayes</div> |
| <h2 title="Class AbstractNaiveBayesClassifier" class="title">Class AbstractNaiveBayesClassifier</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><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">org.apache.mahout.classifier.AbstractVectorClassifier</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.mahout.classifier.naivebayes.AbstractNaiveBayesClassifier</li> |
| </ul> |
| </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/ComplementaryNaiveBayesClassifier.html" title="class in org.apache.mahout.classifier.naivebayes">ComplementaryNaiveBayesClassifier</a>, <a href="../../../../../org/apache/mahout/classifier/naivebayes/StandardNaiveBayesClassifier.html" title="class in org.apache.mahout.classifier.naivebayes">StandardNaiveBayesClassifier</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public abstract class <span class="typeNameLabel">AbstractNaiveBayesClassifier</span> |
| extends <a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">AbstractVectorClassifier</a></pre> |
| <div class="block">Class implementing the Naive Bayes Classifier Algorithm. Note that this class |
| supports <a href="../../../../../org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.html#classifyFull-org.apache.mahout.math.Vector-"><code>classifyFull(org.apache.mahout.math.Vector)</code></a>, but not <code>classify</code> or |
| <code>classifyScalar</code>. The reason that these two methods are not |
| supported is because the scores computed by a NaiveBayesClassifier do not |
| represent probabilities.</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> |
| <ul class="blockList"> |
| <li class="blockList"><a name="fields.inherited.from.class.org.apache.mahout.classifier.AbstractVectorClassifier"> |
| <!-- --> |
| </a> |
| <h3>Fields inherited from class org.apache.mahout.classifier.<a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">AbstractVectorClassifier</a></h3> |
| <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#MIN_LOG_LIKELIHOOD">MIN_LOG_LIKELIHOOD</a></code></li> |
| </ul> |
| </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"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier</th> |
| <th class="colLast" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.html#AbstractNaiveBayesClassifier-org.apache.mahout.classifier.naivebayes.NaiveBayesModel-">AbstractNaiveBayesClassifier</a></span>(<a href="../../../../../org/apache/mahout/classifier/naivebayes/NaiveBayesModel.html" title="class in org.apache.mahout.classifier.naivebayes">NaiveBayesModel</a> model)</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="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"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </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/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/naivebayes/AbstractNaiveBayesClassifier.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> instance)</code> |
| <div class="block">Unsupported method.</div> |
| </td> |
| </tr> |
| <tr id="i1" 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/naivebayes/AbstractNaiveBayesClassifier.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> 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="i2" 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/naivebayes/AbstractNaiveBayesClassifier.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> 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> 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="i3" class="rowColor"> |
| <td class="colFirst"><code>double</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.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> instance)</code> |
| <div class="block">Unsupported method.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>protected <a href="../../../../../org/apache/mahout/classifier/naivebayes/NaiveBayesModel.html" title="class in org.apache.mahout.classifier.naivebayes">NaiveBayesModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.html#getModel--">getModel</a></span>()</code> </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>protected abstract double</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.html#getScoreForLabelFeature-int-int-">getScoreForLabelFeature</a></span>(int label, |
| int feature)</code> </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>protected double</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.html#getScoreForLabelInstance-int-org.apache.mahout.math.Vector-">getScoreForLabelInstance</a></span>(int label, |
| <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> instance)</code> </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.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.org.apache.mahout.classifier.AbstractVectorClassifier"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class org.apache.mahout.classifier.<a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">AbstractVectorClassifier</a></h3> |
| <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Matrix-">classify</a>, <a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Matrix-">classifyFull</a>, <a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyNoLink-org.apache.mahout.math.Vector-">classifyNoLink</a>, <a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyScalar-org.apache.mahout.math.Matrix-">classifyScalar</a>, <a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#logLikelihood-int-org.apache.mahout.math.Vector-">logLikelihood</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.<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"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="AbstractNaiveBayesClassifier-org.apache.mahout.classifier.naivebayes.NaiveBayesModel-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>AbstractNaiveBayesClassifier</h4> |
| <pre>protected AbstractNaiveBayesClassifier(<a href="../../../../../org/apache/mahout/classifier/naivebayes/NaiveBayesModel.html" title="class in org.apache.mahout.classifier.naivebayes">NaiveBayesModel</a> model)</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="getModel--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getModel</h4> |
| <pre>protected <a href="../../../../../org/apache/mahout/classifier/naivebayes/NaiveBayesModel.html" title="class in org.apache.mahout.classifier.naivebayes">NaiveBayesModel</a> getModel()</pre> |
| </li> |
| </ul> |
| <a name="getScoreForLabelFeature-int-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getScoreForLabelFeature</h4> |
| <pre>protected abstract double getScoreForLabelFeature(int label, |
| int feature)</pre> |
| </li> |
| </ul> |
| <a name="getScoreForLabelInstance-int-org.apache.mahout.math.Vector-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getScoreForLabelInstance</h4> |
| <pre>protected double getScoreForLabelInstance(int label, |
| <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> instance)</pre> |
| </li> |
| </ul> |
| <a name="numCategories--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>numCategories</h4> |
| <pre>public int numCategories()</pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#numCategories--">AbstractVectorClassifier</a></code></span></div> |
| <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="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#numCategories--">numCategories</a></code> in class <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">AbstractVectorClassifier</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The number of categories.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="classifyFull-org.apache.mahout.math.Vector-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>classifyFull</h4> |
| <pre>public <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> 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> instance)</pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-">AbstractVectorClassifier</a></code></span></div> |
| <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);<br> |
| int assignedCategory = scores.maxValueIndex();<br> |
| </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>AbstractVectorClassifier.classify(Vector)</code></a> method is probably better |
| to use.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-">classifyFull</a></code> in class <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">AbstractVectorClassifier</a></code></dd> |
| <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>AbstractVectorClassifier.classify(Vector)</code></a>, |
| <a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-org.apache.mahout.math.Vector-"><code>AbstractVectorClassifier.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 <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> 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> 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> instance)</pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-org.apache.mahout.math.Vector-">AbstractVectorClassifier</a></code></span></div> |
| <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>AbstractVectorClassifier.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<br> |
| int assignedCategory = scores.maxValueIndex();<br> |
| </code> Here <code>assignedCategory</code> is the index of the category |
| with the maximum score.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyFull-org.apache.mahout.math.Vector-org.apache.mahout.math.Vector-">classifyFull</a></code> in class <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">AbstractVectorClassifier</a></code></dd> |
| <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="classifyScalar-org.apache.mahout.math.Vector-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>classifyScalar</h4> |
| <pre>public double 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> instance)</pre> |
| <div class="block">Unsupported method. This implementation simply 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>.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classifyScalar-org.apache.mahout.math.Vector-">classifyScalar</a></code> in class <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">AbstractVectorClassifier</a></code></dd> |
| <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>AbstractVectorClassifier.classify(Vector)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="classify-org.apache.mahout.math.Vector-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>classify</h4> |
| <pre>public <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> 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> instance)</pre> |
| <div class="block">Unsupported method. This implementation simply 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>.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html#classify-org.apache.mahout.math.Vector-">classify</a></code> in class <code><a href="../../../../../org/apache/mahout/classifier/AbstractVectorClassifier.html" title="class in org.apache.mahout.classifier">AbstractVectorClassifier</a></code></dd> |
| <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> |
| </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/AbstractNaiveBayesClassifier.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 Class</li> |
| <li><a href="../../../../../org/apache/mahout/classifier/naivebayes/BayesUtils.html" title="class in org.apache.mahout.classifier.naivebayes"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/mahout/classifier/naivebayes/AbstractNaiveBayesClassifier.html" target="_top">Frames</a></li> |
| <li><a href="AbstractNaiveBayesClassifier.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><a href="#fields.inherited.from.class.org.apache.mahout.classifier.AbstractVectorClassifier">Field</a> | </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 ======= --> |
| <p class="legalCopy"><small>Copyright © 2008–2017 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |