You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2022/04/17 21:38:35 UTC
[datasketches-characterization] branch master updated: Update Kll Profiles
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/datasketches-characterization.git
The following commit(s) were added to refs/heads/master by this push:
new 58abb70 Update Kll Profiles
58abb70 is described below
commit 58abb70b684477949cf5a7c827b85e1aa866ed60
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Sun Apr 17 14:38:27 2022 -0700
Update Kll Profiles
---
.../KllDoublesSketchRankGaussianAccuracyProfile.java | 17 ++++++++++++-----
.../quantiles/KllSketchAccuracyProfile.java | 18 +++++++++++++-----
.../KllFloatsSketchRankGaussianAccuracyJob.conf | 2 +-
src/main/resources/quantiles/KllSketchAccuracyJob.conf | 2 +-
4 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/datasketches/characterization/quantiles/KllDoublesSketchRankGaussianAccuracyProfile.java b/src/main/java/org/apache/datasketches/characterization/quantiles/KllDoublesSketchRankGaussianAccuracyProfile.java
index b79a5ae..3969d44 100644
--- a/src/main/java/org/apache/datasketches/characterization/quantiles/KllDoublesSketchRankGaussianAccuracyProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/quantiles/KllDoublesSketchRankGaussianAccuracyProfile.java
@@ -29,6 +29,8 @@ import org.apache.datasketches.JobProfile;
import org.apache.datasketches.MonotonicPoints;
import org.apache.datasketches.characterization.Shuffle;
import org.apache.datasketches.kll.KllDoublesSketch;
+import org.apache.datasketches.memory.DefaultMemoryRequestServer;
+import org.apache.datasketches.memory.WritableMemory;
import org.apache.datasketches.quantiles.DoublesSketch;
import org.apache.datasketches.quantiles.DoublesSketchBuilder;
import org.apache.datasketches.quantiles.UpdateDoublesSketch;
@@ -37,6 +39,7 @@ import org.apache.datasketches.quantiles.UpdateDoublesSketch;
* @author Lee Rhodes
*/
public class KllDoublesSketchRankGaussianAccuracyProfile implements JobProfile {
+ private static final DefaultMemoryRequestServer memReqSvr = new DefaultMemoryRequestServer();
private Job job;
//FROM PROPERTIES
@@ -53,7 +56,7 @@ public class KllDoublesSketchRankGaussianAccuracyProfile implements JobProfile {
private int numPlotPoints;
//Target sketch configuration & error analysis
- private int K;
+ private int k;
//DERIVED globals
private KllDoublesSketch sk;
@@ -104,7 +107,7 @@ public class KllDoublesSketchRankGaussianAccuracyProfile implements JobProfile {
//plotting & x-axis config
numPlotPoints = Integer.parseInt(job.getProperties().mustGet("NumPlotPoints"));
//Target sketch config
- K = Integer.parseInt(job.getProperties().mustGet("K"));
+ k = Integer.parseInt(job.getProperties().mustGet("K"));
}
@@ -126,8 +129,10 @@ public class KllDoublesSketchRankGaussianAccuracyProfile implements JobProfile {
}
void configureSketch() {
- sk = KllDoublesSketch.newHeapInstance(K);
- //sk = new KllDoublesSketch(K);
+ final WritableMemory wmem = WritableMemory.allocate(10000);
+ sk = KllDoublesSketch.newDirectInstance(k, wmem, memReqSvr);
+ //sk = KllDoublesSketch.newHeapInstance(k);
+ //sk = new KllDoublesSketch(k);
}
private void doJob() {
@@ -179,7 +184,9 @@ public class KllDoublesSketchRankGaussianAccuracyProfile implements JobProfile {
//Do numTrials for all plot points
for (int t = 0; t < numTrials; t++) {
- sk = KllDoublesSketch.newHeapInstance(K);
+ final WritableMemory wmem = WritableMemory.allocate(10000);
+ sk = KllDoublesSketch.newDirectInstance(k, wmem, memReqSvr);
+ // sk = KllDoublesSketch.newHeapInstance(k);
// sk = new KllDoublesSketch(K);
doTrial(sk, stream, trueValues, corrTrueValues, errQSkArr);
}
diff --git a/src/main/java/org/apache/datasketches/characterization/quantiles/KllSketchAccuracyProfile.java b/src/main/java/org/apache/datasketches/characterization/quantiles/KllSketchAccuracyProfile.java
index 4d9800b..54429f6 100644
--- a/src/main/java/org/apache/datasketches/characterization/quantiles/KllSketchAccuracyProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/quantiles/KllSketchAccuracyProfile.java
@@ -24,6 +24,8 @@ import static org.apache.datasketches.characterization.Shuffle.shuffle;
import org.apache.datasketches.Properties;
import org.apache.datasketches.kll.KllDoublesSketch;
import org.apache.datasketches.kll.KllFloatsSketch;
+import org.apache.datasketches.memory.DefaultMemoryRequestServer;
+import org.apache.datasketches.memory.WritableMemory;
/**
* This handles either floats or doubles.
@@ -31,7 +33,7 @@ import org.apache.datasketches.kll.KllFloatsSketch;
*
*/
public class KllSketchAccuracyProfile extends BaseQuantilesAccuracyProfile {
-
+ private static final DefaultMemoryRequestServer memReqSvr = new DefaultMemoryRequestServer();
private int k;
private float[] inputFloatValues;
private float[] floatQueryValues;
@@ -91,8 +93,11 @@ public class KllSketchAccuracyProfile extends BaseQuantilesAccuracyProfile {
if (useFloat) {
shuffle(inputFloatValues);
// build sketch
- final KllFloatsSketch sketch = KllFloatsSketch.newHeapInstance(k);
- //final KllFloatsSketch sketch = new KllFloatsSketch(k);
+ final WritableMemory wmem = WritableMemory.allocate(10000);
+ final KllFloatsSketch sketch;
+ sketch = KllFloatsSketch.newDirectInstance(k, wmem, memReqSvr);
+ //sketch = KllFloatsSketch.newHeapInstance(k);
+ //sketch = new KllFloatsSketch(k);
for (int i = 0; i < inputFloatValues.length; i++) {
sketch.update(inputFloatValues[i]);
}
@@ -116,8 +121,11 @@ public class KllSketchAccuracyProfile extends BaseQuantilesAccuracyProfile {
else if (useDouble) {
shuffle(inputDoubleValues);
// build sketch
- final KllDoublesSketch sketch = KllDoublesSketch.newHeapInstance(k);
- //final KllDoublesSketch sketch = new KllDoublesSketch(k);
+ final WritableMemory wmem = WritableMemory.allocate(10000);
+ final KllDoublesSketch sketch;
+ sketch = KllDoublesSketch.newDirectInstance(k, wmem, memReqSvr);
+ //sketch = KllDoublesSketch.newHeapInstance(k);
+ //sketch = new KllDoublesSketch(k);
for (int i = 0; i < inputDoubleValues.length; i++) {
sketch.update(inputDoubleValues[i]);
}
diff --git a/src/main/resources/quantiles/KllFloatsSketchRankGaussianAccuracyJob.conf b/src/main/resources/quantiles/KllFloatsSketchRankGaussianAccuracyJob.conf
index bd8c75c..1f52248 100644
--- a/src/main/resources/quantiles/KllFloatsSketchRankGaussianAccuracyJob.conf
+++ b/src/main/resources/quantiles/KllFloatsSketchRankGaussianAccuracyJob.conf
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-JobProfile=org.apache.datasketches.characterization.quantiles.KllFloatsSketchRandGaussianAccuracyProfile
+JobProfile=org.apache.datasketches.characterization.quantiles.KllFloatsSketchRankGaussianAccuracyProfile
# Trials config (indep of sketch)
## Stream lengths
diff --git a/src/main/resources/quantiles/KllSketchAccuracyJob.conf b/src/main/resources/quantiles/KllSketchAccuracyJob.conf
index beaf26e..63107bd 100644
--- a/src/main/resources/quantiles/KllSketchAccuracyJob.conf
+++ b/src/main/resources/quantiles/KllSketchAccuracyJob.conf
@@ -24,4 +24,4 @@ trials=10 # Trials at every stream length
lgMin=0 # The starting stream length
lgMax=23 # How high the stream length goes
PPO=8 # The horizontal x-resolution of trials points
-type=float
+type=double
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org