blob: f909ec43aa333b4841e8e495779a404192dd95ba [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:35 PDT 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GenericItemSimilarity (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="GenericItemSimilarity (Mahout Map-Reduce 0.13.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance 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/GenericItemSimilarity.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><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/EuclideanDistanceSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html" target="_top">Frames</a></li>
<li><a href="GenericItemSimilarity.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><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&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>Field&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.cf.taste.impl.similarity</div>
<h2 title="Class GenericItemSimilarity" class="title">Class GenericItemSimilarity</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.cf.taste.impl.similarity.GenericItemSimilarity</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../../../org/apache/mahout/cf/taste/common/Refreshable.html" title="interface in org.apache.mahout.cf.taste.common">Refreshable</a>, <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a></dd>
</dl>
<hr>
<br>
<pre>public final class <span class="typeNameLabel">GenericItemSimilarity</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>
implements <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a></pre>
<div class="block"><p>
A "generic" <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity"><code>ItemSimilarity</code></a> which takes a static list of precomputed item similarities and bases its
responses on that alone. The values may have been precomputed offline by another process, stored in a file,
and then read and fed into an instance of this class.
</p>
<p>
This is perhaps the best <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity"><code>ItemSimilarity</code></a> to use with
<a href="../../../../../../../org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommender.html" title="class in org.apache.mahout.cf.taste.impl.recommender"><code>GenericItemBasedRecommender</code></a>, for now, since the point
of item-based recommenders is that they can take advantage of the fact that item similarity is relatively
static, can be precomputed, and then used in computation to gain a significant performance advantage.
</p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity">GenericItemSimilarity.ItemItemSimilarity</a></span></code>
<div class="block">Encapsulates a similarity between two items.</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/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-org.apache.mahout.cf.taste.similarity.ItemSimilarity-org.apache.mahout.cf.taste.model.DataModel-">GenericItemSimilarity</a></span>(<a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a>&nbsp;otherSimilarity,
<a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model">DataModel</a>&nbsp;dataModel)</code>
<div class="block">
Builds a list of item-item similarities given an <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity"><code>ItemSimilarity</code></a> implementation and a
<a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model"><code>DataModel</code></a>, rather than a list of <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity.ItemItemSimilarity</code></a>s.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-org.apache.mahout.cf.taste.similarity.ItemSimilarity-org.apache.mahout.cf.taste.model.DataModel-int-">GenericItemSimilarity</a></span>(<a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a>&nbsp;otherSimilarity,
<a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model">DataModel</a>&nbsp;dataModel,
int&nbsp;maxToKeep)</code>
<div class="block">
Like <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-org.apache.mahout.cf.taste.similarity.ItemSimilarity-org.apache.mahout.cf.taste.model.DataModel-"><code>GenericItemSimilarity(ItemSimilarity, DataModel)</code></a> )}, but will only keep the specified
number of similarities from the given <a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model"><code>DataModel</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-java.lang.Iterable-">GenericItemSimilarity</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a>&lt;<a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity">GenericItemSimilarity.ItemItemSimilarity</a>&gt;&nbsp;similarities)</code>
<div class="block">
Creates a <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity</code></a> from a precomputed list of <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity.ItemItemSimilarity</code></a>s.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-java.lang.Iterable-int-">GenericItemSimilarity</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a>&lt;<a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity">GenericItemSimilarity.ItemItemSimilarity</a>&gt;&nbsp;similarities,
int&nbsp;maxToKeep)</code>
<div class="block">
Like <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-java.lang.Iterable-"><code>GenericItemSimilarity(Iterable)</code></a>, but will only keep the specified number of similarities
from the given <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang"><code>Iterable</code></a> of similarities.</div>
</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="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>long[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#allSimilarItemIDs-long-">allSimilarItemIDs</a></span>(long&nbsp;itemID)</code>&nbsp;</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#itemSimilarities-long-long:A-">itemSimilarities</a></span>(long&nbsp;itemID1,
long[]&nbsp;itemID2s)</code>
<div class="block">A bulk-get version of <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html#itemSimilarity-long-long-"><code>ItemSimilarity.itemSimilarity(long, long)</code></a>.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#itemSimilarity-long-long-">itemSimilarity</a></span>(long&nbsp;itemID1,
long&nbsp;itemID2)</code>
<div class="block">
Returns the similarity between two items.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#refresh-java.util.Collection-">refresh</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../../../../../org/apache/mahout/cf/taste/common/Refreshable.html" title="interface in org.apache.mahout.cf.taste.common">Refreshable</a>&gt;&nbsp;alreadyRefreshed)</code>
<div class="block">
Triggers "refresh" -- whatever that means -- of the implementation.</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">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="GenericItemSimilarity-java.lang.Iterable-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>GenericItemSimilarity</h4>
<pre>public&nbsp;GenericItemSimilarity(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a>&lt;<a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity">GenericItemSimilarity.ItemItemSimilarity</a>&gt;&nbsp;similarities)</pre>
<div class="block"><p>
Creates a <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity</code></a> from a precomputed list of <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity.ItemItemSimilarity</code></a>s. Each
represents the similarity between two distinct items. Since similarity is assumed to be symmetric, it is
not necessary to specify similarity between item1 and item2, and item2 and item1. Both are the same. It
is also not necessary to specify a similarity between any item and itself; these are assumed to be 1.0.
</p>
<p>
Note that specifying a similarity between two items twice is not an error, but, the later value will win.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>similarities</code> - set of <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity.ItemItemSimilarity</code></a>s on which to base this instance</dd>
</dl>
</li>
</ul>
<a name="GenericItemSimilarity-java.lang.Iterable-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>GenericItemSimilarity</h4>
<pre>public&nbsp;GenericItemSimilarity(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a>&lt;<a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity">GenericItemSimilarity.ItemItemSimilarity</a>&gt;&nbsp;similarities,
int&nbsp;maxToKeep)</pre>
<div class="block"><p>
Like <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-java.lang.Iterable-"><code>GenericItemSimilarity(Iterable)</code></a>, but will only keep the specified number of similarities
from the given <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang"><code>Iterable</code></a> of similarities. It will keep those with the highest similarity -- those
that are therefore most important.
</p>
<p>
Thanks to tsmorton for suggesting this and providing part of the implementation.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>similarities</code> - set of <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity.ItemItemSimilarity</code></a>s on which to base this instance</dd>
<dd><code>maxToKeep</code> - maximum number of similarities to keep</dd>
</dl>
</li>
</ul>
<a name="GenericItemSimilarity-org.apache.mahout.cf.taste.similarity.ItemSimilarity-org.apache.mahout.cf.taste.model.DataModel-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>GenericItemSimilarity</h4>
<pre>public&nbsp;GenericItemSimilarity(<a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a>&nbsp;otherSimilarity,
<a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model">DataModel</a>&nbsp;dataModel)
throws <a href="../../../../../../../org/apache/mahout/cf/taste/common/TasteException.html" title="class in org.apache.mahout.cf.taste.common">TasteException</a></pre>
<div class="block"><p>
Builds a list of item-item similarities given an <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity"><code>ItemSimilarity</code></a> implementation and a
<a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model"><code>DataModel</code></a>, rather than a list of <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity.ItemItemSimilarity</code></a>s.
</p>
<p>
It's valid to build a <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><code>GenericItemSimilarity</code></a> this way, but perhaps missing some of the point of an
item-based recommender. Item-based recommenders use the assumption that item-item similarities are
relatively fixed, and might be known already independent of user preferences. Hence it is useful to
inject that information, using <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-java.lang.Iterable-"><code>GenericItemSimilarity(Iterable)</code></a>.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>otherSimilarity</code> - other <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity"><code>ItemSimilarity</code></a> to get similarities from</dd>
<dd><code>dataModel</code> - data model to get items from</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../../../../org/apache/mahout/cf/taste/common/TasteException.html" title="class in org.apache.mahout.cf.taste.common">TasteException</a></code> - if an error occurs while accessing the <a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model"><code>DataModel</code></a> items</dd>
</dl>
</li>
</ul>
<a name="GenericItemSimilarity-org.apache.mahout.cf.taste.similarity.ItemSimilarity-org.apache.mahout.cf.taste.model.DataModel-int-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>GenericItemSimilarity</h4>
<pre>public&nbsp;GenericItemSimilarity(<a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a>&nbsp;otherSimilarity,
<a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model">DataModel</a>&nbsp;dataModel,
int&nbsp;maxToKeep)
throws <a href="../../../../../../../org/apache/mahout/cf/taste/common/TasteException.html" title="class in org.apache.mahout.cf.taste.common">TasteException</a></pre>
<div class="block"><p>
Like <a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html#GenericItemSimilarity-org.apache.mahout.cf.taste.similarity.ItemSimilarity-org.apache.mahout.cf.taste.model.DataModel-"><code>GenericItemSimilarity(ItemSimilarity, DataModel)</code></a> )}, but will only keep the specified
number of similarities from the given <a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model"><code>DataModel</code></a>. It will keep those with the highest similarity
-- those that are therefore most important.
</p>
<p>
Thanks to tsmorton for suggesting this and providing part of the implementation.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>otherSimilarity</code> - other <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity"><code>ItemSimilarity</code></a> to get similarities from</dd>
<dd><code>dataModel</code> - data model to get items from</dd>
<dd><code>maxToKeep</code> - maximum number of similarities to keep</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../../../../org/apache/mahout/cf/taste/common/TasteException.html" title="class in org.apache.mahout.cf.taste.common">TasteException</a></code> - if an error occurs while accessing the <a href="../../../../../../../org/apache/mahout/cf/taste/model/DataModel.html" title="interface in org.apache.mahout.cf.taste.model"><code>DataModel</code></a> items</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="itemSimilarity-long-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>itemSimilarity</h4>
<pre>public&nbsp;double&nbsp;itemSimilarity(long&nbsp;itemID1,
long&nbsp;itemID2)</pre>
<div class="block"><p>
Returns the similarity between two items. Note that similarity is assumed to be symmetric, that
<code>itemSimilarity(item1, item2) == itemSimilarity(item2, item1)</code>, and that
<code>itemSimilarity(item1,item1) == 1.0</code> for all items.
</p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html#itemSimilarity-long-long-">itemSimilarity</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>itemID1</code> - first item</dd>
<dd><code>itemID2</code> - second item</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>similarity between the two</dd>
</dl>
</li>
</ul>
<a name="itemSimilarities-long-long:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>itemSimilarities</h4>
<pre>public&nbsp;double[]&nbsp;itemSimilarities(long&nbsp;itemID1,
long[]&nbsp;itemID2s)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html#itemSimilarities-long-long:A-">ItemSimilarity</a></code></span></div>
<div class="block"><p>A bulk-get version of <a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html#itemSimilarity-long-long-"><code>ItemSimilarity.itemSimilarity(long, long)</code></a>.</p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html#itemSimilarities-long-long:A-">itemSimilarities</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>itemID1</code> - first item ID</dd>
<dd><code>itemID2s</code> - second item IDs to compute similarity with</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>similarity between itemID1 and other items</dd>
</dl>
</li>
</ul>
<a name="allSimilarItemIDs-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>allSimilarItemIDs</h4>
<pre>public&nbsp;long[]&nbsp;allSimilarItemIDs(long&nbsp;itemID)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html#allSimilarItemIDs-long-">allSimilarItemIDs</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../../org/apache/mahout/cf/taste/similarity/ItemSimilarity.html" title="interface in org.apache.mahout.cf.taste.similarity">ItemSimilarity</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>all IDs of similar items, in no particular order</dd>
</dl>
</li>
</ul>
<a name="refresh-java.util.Collection-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>refresh</h4>
<pre>public&nbsp;void&nbsp;refresh(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../../../../../org/apache/mahout/cf/taste/common/Refreshable.html" title="interface in org.apache.mahout.cf.taste.common">Refreshable</a>&gt;&nbsp;alreadyRefreshed)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="../../../../../../../org/apache/mahout/cf/taste/common/Refreshable.html#refresh-java.util.Collection-">Refreshable</a></code></span></div>
<div class="block"><p>
Triggers "refresh" -- whatever that means -- of the implementation. The general contract is that any
<a href="../../../../../../../org/apache/mahout/cf/taste/common/Refreshable.html" title="interface in org.apache.mahout.cf.taste.common"><code>Refreshable</code></a> should always leave itself in a consistent, operational state, and that the refresh
atomically updates internal state from old to new.
</p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/mahout/cf/taste/common/Refreshable.html#refresh-java.util.Collection-">refresh</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../../org/apache/mahout/cf/taste/common/Refreshable.html" title="interface in org.apache.mahout.cf.taste.common">Refreshable</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>alreadyRefreshed</code> - <a href="../../../../../../../org/apache/mahout/cf/taste/common/Refreshable.html" title="interface in org.apache.mahout.cf.taste.common"><code>Refreshable</code></a>s that are known to have already been
refreshed as a result of an initial call to a {#refresh(Collection)} method on some
object. This ensure that objects in a refresh dependency graph aren't refreshed twice
needlessly.</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/GenericItemSimilarity.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><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/EuclideanDistanceSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../../org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.ItemItemSimilarity.html" title="class in org.apache.mahout.cf.taste.impl.similarity"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarity.html" target="_top">Frames</a></li>
<li><a href="GenericItemSimilarity.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><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&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>Field&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>