blob: 354db9b8bbf29f04b1b40dbd4c4734eab9a8a5c4 [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_162) on Thu Mar 14 13:13:09 PDT 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>VarOptItemsSketch (com.yahoo.datasketches:sketches-core 0.13.1-SNAPSHOT API)</title>
<meta name="date" content="2019-03-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="VarOptItemsSketch (com.yahoo.datasketches:sketches-core 0.13.1-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":9,"i6":9,"i7":9,"i8":10,"i9":10,"i10":10,"i11":10,"i12":9,"i13":9,"i14":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static 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/VarOptItemsSketch.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="../../../../com/yahoo/sketches/sampling/VarOptItemsSamples.WeightedSample.html" title="class in com.yahoo.sketches.sampling"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsUnion.html" title="class in com.yahoo.sketches.sampling"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/yahoo/sketches/sampling/VarOptItemsSketch.html" target="_top">Frames</a></li>
<li><a href="VarOptItemsSketch.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>Field&nbsp;|&nbsp;</li>
<li>Constr&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>Constr&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">com.yahoo.sketches.sampling</div>
<h2 title="Class VarOptItemsSketch" class="title">Class VarOptItemsSketch&lt;T&gt;</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/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>com.yahoo.sketches.sampling.VarOptItemsSketch&lt;T&gt;</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - The type of object held in the sketch.</dd>
</dl>
<hr>
<br>
<pre>public final class <span class="typeNameLabel">VarOptItemsSketch&lt;T&gt;</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">This sketch provides a variance optimal sample over an input stream of weighted items. The
sketch can be used to compute subset sums over predicates, producing estimates with optimal
variance for a given sketch size.
<p>Using this sketch with uniformly constant item weights (e.g. 1.0) will produce a standard
reservoir sample over the steam.</p></div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Jon Malkin, Kevin Lang</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== 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="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></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><a href="../../../../com/yahoo/sketches/sampling/SampleSubsetSummary.html" title="class in com.yahoo.sketches.sampling">SampleSubsetSummary</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#estimateSubsetSum-java.util.function.Predicate-">estimateSubsetSum</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html?is-external=true" title="class or interface in java.util.function">Predicate</a>&lt;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&gt;&nbsp;predicate)</code>
<div class="block">Computes an estimated subset sum from the entire stream for objects matching a given
predicate.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#getK--">getK</a></span>()</code>
<div class="block">Returns the sketch's value of <i>k</i>, the maximum number of samples stored in the
sketch.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#getN--">getN</a></span>()</code>
<div class="block">Returns the number of items processed from the input stream</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#getNumSamples--">getNumSamples</a></span>()</code>
<div class="block">Returns the current number of items in the sketch, which may be smaller than the
sketch capacity.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSamples.html" title="class in com.yahoo.sketches.sampling">VarOptItemsSamples</a>&lt;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#getSketchSamples--">getSketchSamples</a></span>()</code>
<div class="block">Gets a result iterator object.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="class in com.yahoo.sketches.sampling">VarOptItemsSketch</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#heapify-com.yahoo.memory.Memory-com.yahoo.sketches.ArrayOfItemsSerDe-">heapify</a></span>(com.yahoo.memory.Memory&nbsp;srcMem,
<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;T&gt;&nbsp;serDe)</code>
<div class="block">Returns a sketch instance of this class from the given srcMem,
which must be a Memory representation of this sketch class.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="class in com.yahoo.sketches.sampling">VarOptItemsSketch</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#newInstance-int-">newInstance</a></span>(int&nbsp;k)</code>
<div class="block">Construct a varopt sampling sketch with up to k samples using the default resize factor (8).</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="class in com.yahoo.sketches.sampling">VarOptItemsSketch</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#newInstance-int-com.yahoo.sketches.ResizeFactor-">newInstance</a></span>(int&nbsp;k,
<a href="../../../../com/yahoo/sketches/ResizeFactor.html" title="enum in com.yahoo.sketches">ResizeFactor</a>&nbsp;rf)</code>
<div class="block">Construct a varopt sampling sketch with up to k samples using the specified resize factor.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#reset--">reset</a></span>()</code>
<div class="block">Resets this sketch to the empty state, but retains the original value of k.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#toByteArray-com.yahoo.sketches.ArrayOfItemsSerDe-">toByteArray</a></span>(<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;? super <a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&gt;&nbsp;serDe)</code>
<div class="block">Returns a byte array representation of this sketch.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#toByteArray-com.yahoo.sketches.ArrayOfItemsSerDe-java.lang.Class-">toByteArray</a></span>(<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;? super <a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&gt;&nbsp;serDe,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;&nbsp;clazz)</code>
<div class="block">Returns a byte array representation of this sketch.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#toString--">toString</a></span>()</code>
<div class="block">Returns a human-readable summary of the sketch.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#toString-byte:A-">toString</a></span>(byte[]&nbsp;byteArr)</code>
<div class="block">Returns a human readable string of the preamble of a byte array image of a VarOptItemsSketch.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#toString-com.yahoo.memory.Memory-">toString</a></span>(com.yahoo.memory.Memory&nbsp;mem)</code>
<div class="block">Returns a human readable string of the preamble of a Memory image of a VarOptItemsSketch.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html#update-T-double-">update</a></span>(<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&nbsp;item,
double&nbsp;weight)</code>
<div class="block">Randomly decide whether or not to include an item in the sample set.</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="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/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">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="newInstance-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newInstance</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="class in com.yahoo.sketches.sampling">VarOptItemsSketch</a>&lt;T&gt;&nbsp;newInstance(int&nbsp;k)</pre>
<div class="block">Construct a varopt sampling sketch with up to k samples using the default resize factor (8).</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - The type of object held in the sketch.</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>k</code> - Maximum size of sampling. Allocated size may be smaller until sketch fills.
Unlike many sketches in this package, this value does <em>not</em> need to be a
power of 2.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A VarOptItemsSketch initialized with maximum size k and resize factor rf.</dd>
</dl>
</li>
</ul>
<a name="newInstance-int-com.yahoo.sketches.ResizeFactor-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newInstance</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="class in com.yahoo.sketches.sampling">VarOptItemsSketch</a>&lt;T&gt;&nbsp;newInstance(int&nbsp;k,
<a href="../../../../com/yahoo/sketches/ResizeFactor.html" title="enum in com.yahoo.sketches">ResizeFactor</a>&nbsp;rf)</pre>
<div class="block">Construct a varopt sampling sketch with up to k samples using the specified resize factor.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - The type of object held in the sketch.</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>k</code> - Maximum size of sampling. Allocated size may be smaller until sketch fills.
Unlike many sketches in this package, this value does <em>not</em> need to be a
power of 2.</dd>
<dd><code>rf</code> - <a href="../../../../resources/dictionary.html#resizeFactor">See Resize Factor</a></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A VarOptItemsSketch initialized with maximum size k and resize factor rf.</dd>
</dl>
</li>
</ul>
<a name="heapify-com.yahoo.memory.Memory-com.yahoo.sketches.ArrayOfItemsSerDe-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>heapify</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="class in com.yahoo.sketches.sampling">VarOptItemsSketch</a>&lt;T&gt;&nbsp;heapify(com.yahoo.memory.Memory&nbsp;srcMem,
<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;T&gt;&nbsp;serDe)</pre>
<div class="block">Returns a sketch instance of this class from the given srcMem,
which must be a Memory representation of this sketch class.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - The type of item this sketch contains</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>srcMem</code> - a Memory representation of a sketch of this class.
<a href="../../../../resources/dictionary.html#mem">See Memory</a></dd>
<dd><code>serDe</code> - An instance of ArrayOfItemsSerDe</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a sketch instance of this class</dd>
</dl>
</li>
</ul>
<a name="getK--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getK</h4>
<pre>public&nbsp;int&nbsp;getK()</pre>
<div class="block">Returns the sketch's value of <i>k</i>, the maximum number of samples stored in the
sketch. The current number of items in the sketch may be lower.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>k, the maximum number of samples in the sketch</dd>
</dl>
</li>
</ul>
<a name="getN--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getN</h4>
<pre>public&nbsp;long&nbsp;getN()</pre>
<div class="block">Returns the number of items processed from the input stream</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>n, the number of stream items the sketch has seen</dd>
</dl>
</li>
</ul>
<a name="getNumSamples--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNumSamples</h4>
<pre>public&nbsp;int&nbsp;getNumSamples()</pre>
<div class="block">Returns the current number of items in the sketch, which may be smaller than the
sketch capacity.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the number of items currently in the sketch</dd>
</dl>
</li>
</ul>
<a name="getSketchSamples--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSketchSamples</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSamples.html" title="class in com.yahoo.sketches.sampling">VarOptItemsSamples</a>&lt;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&gt;&nbsp;getSketchSamples()</pre>
<div class="block">Gets a result iterator object.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>An object with an iterator over the results</dd>
</dl>
</li>
</ul>
<a name="update-java.lang.Object-double-">
<!-- -->
</a><a name="update-T-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&nbsp;item,
double&nbsp;weight)</pre>
<div class="block">Randomly decide whether or not to include an item in the sample set.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>item</code> - an item of the set being sampled from</dd>
<dd><code>weight</code> - a strictly positive weight associated with the item</dd>
</dl>
</li>
</ul>
<a name="reset--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reset</h4>
<pre>public&nbsp;void&nbsp;reset()</pre>
<div class="block">Resets this sketch to the empty state, but retains the original value of k.</div>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toString()</pre>
<div class="block">Returns a human-readable summary of the sketch.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A string version of the sketch summary</dd>
</dl>
</li>
</ul>
<a name="toString-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toString(byte[]&nbsp;byteArr)</pre>
<div class="block">Returns a human readable string of the preamble of a byte array image of a VarOptItemsSketch.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>byteArr</code> - the given byte array</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a human readable string of the preamble of a byte array image of a VarOptItemsSketch.</dd>
</dl>
</li>
</ul>
<a name="toString-com.yahoo.memory.Memory-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toString(com.yahoo.memory.Memory&nbsp;mem)</pre>
<div class="block">Returns a human readable string of the preamble of a Memory image of a VarOptItemsSketch.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>mem</code> - the given Memory</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a human readable string of the preamble of a Memory image of a VarOptItemsSketch.</dd>
</dl>
</li>
</ul>
<a name="toByteArray-com.yahoo.sketches.ArrayOfItemsSerDe-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toByteArray</h4>
<pre>public&nbsp;byte[]&nbsp;toByteArray(<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;? super <a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&gt;&nbsp;serDe)</pre>
<div class="block">Returns a byte array representation of this sketch. May fail for polymorphic item types.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>serDe</code> - An instance of ArrayOfItemsSerDe</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a byte array representation of this sketch</dd>
</dl>
</li>
</ul>
<a name="toByteArray-com.yahoo.sketches.ArrayOfItemsSerDe-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toByteArray</h4>
<pre>public&nbsp;byte[]&nbsp;toByteArray(<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;? super <a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&gt;&nbsp;serDe,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;?&gt;&nbsp;clazz)</pre>
<div class="block">Returns a byte array representation of this sketch. Copies contents into an array of the
specified class for serialization to allow for polymorphic types.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>serDe</code> - An instance of ArrayOfItemsSerDe</dd>
<dd><code>clazz</code> - The class represented by &lt;T&gt;</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a byte array representation of this sketch</dd>
</dl>
</li>
</ul>
<a name="estimateSubsetSum-java.util.function.Predicate-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>estimateSubsetSum</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/sampling/SampleSubsetSummary.html" title="class in com.yahoo.sketches.sampling">SampleSubsetSummary</a>&nbsp;estimateSubsetSum(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html?is-external=true" title="class or interface in java.util.function">Predicate</a>&lt;<a href="../../../../com/yahoo/sketches/sampling/VarOptItemsSketch.html" title="type parameter in VarOptItemsSketch">T</a>&gt;&nbsp;predicate)</pre>
<div class="block">Computes an estimated subset sum from the entire stream for objects matching a given
predicate. Provides a lower bound, estimate, and upper bound using a target of 2 standard
deviations.
<p>This is technically a heuristic method, and tries to err on the conservative side.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>predicate</code> - A predicate to use when identifying items.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A summary object containing the estimate, upper and lower bounds, and the total
sketch weight.</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/VarOptItemsSketch.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="../../../../com/yahoo/sketches/sampling/VarOptItemsSamples.WeightedSample.html" title="class in com.yahoo.sketches.sampling"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/yahoo/sketches/sampling/VarOptItemsUnion.html" title="class in com.yahoo.sketches.sampling"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/yahoo/sketches/sampling/VarOptItemsSketch.html" target="_top">Frames</a></li>
<li><a href="VarOptItemsSketch.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>Field&nbsp;|&nbsp;</li>
<li>Constr&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>Constr&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; 2015&#x2013;2019. All rights reserved.</small></p>
</body>
</html>