Interim update
diff --git a/src/main/java/org/apache/datasketches/MonotonicPoints.java b/src/main/java/org/apache/datasketches/MonotonicPoints.java
index a7c6a24..31f3898 100644
--- a/src/main/java/org/apache/datasketches/MonotonicPoints.java
+++ b/src/main/java/org/apache/datasketches/MonotonicPoints.java
@@ -23,6 +23,9 @@
import static java.lang.Math.exp;
import static java.lang.Math.log;
import static java.lang.Math.min;
+import static java.lang.Math.pow;
+import static java.lang.Math.round;
+import static org.apache.datasketches.Util.powerSeriesNextDouble;
import static org.apache.datasketches.Util.pwr2SeriesNext;
import java.util.Random;
@@ -138,7 +141,8 @@
}
/**
- * Counts the actual number of plotting points between lgStart and lgEnd assuming the given PPO.
+ * Counts the actual number of plotting points between lgStart and lgEnd assuming the given PPO
+ * and a logBase of 2.
* This is not a simple linear function due to points that may be skipped in the low range.
* @param lgStart Log2 of the starting value
* @param lgEnd Log2 of the ending value
@@ -156,4 +160,24 @@
return count;
}
+ /**
+ * Counts the actual number of plotting points between lgStart and lgEnd assuming the given PPO
+ * and a logBase of 2.
+ * This is not a simple linear function due to points that may be skipped in the low range.
+ * @param log10Start Log10 of the starting value
+ * @param log10End Log10 of the ending value
+ * @param ppb the number of logarithmically evenly spaced points per base = 10.
+ * @return the actual number of plotting points between lgStart and lgEnd.
+ */
+ public static final int countLog10Points(final int log10Start, final int log10End, final int ppb) {
+ long p = round(pow(10, log10Start));
+ final long end = round(pow(10, log10End));
+ int count = 0;
+ while (p <= end) {
+ p = (long)powerSeriesNextDouble(ppb, p, true, 10.0);
+ count++;
+ }
+ return count;
+ }
+
}
diff --git a/src/main/java/org/apache/datasketches/characterization/AccuracyStats.java b/src/main/java/org/apache/datasketches/characterization/AccuracyStats.java
index b714fe9..f9bd056 100644
--- a/src/main/java/org/apache/datasketches/characterization/AccuracyStats.java
+++ b/src/main/java/org/apache/datasketches/characterization/AccuracyStats.java
@@ -94,7 +94,7 @@
*/
public static final AccuracyStats[] buildLog10AccuracyStatsArray(
final int log10Min, final int log10Max, final int ppb, final int lgQK) {
- final int qLen = MonotonicPoints.countPoints(log10Min, log10Max, ppb);
+ final int qLen = MonotonicPoints.countLog10Points(log10Min, log10Max, ppb);
final AccuracyStats[] qArr = new AccuracyStats[qLen];
long p = round(pow(10, log10Min));
for (int i = 0; i < qLen; i++) {
diff --git a/src/main/java/org/apache/datasketches/characterization/hll/HllAccuracyProfile.java b/src/main/java/org/apache/datasketches/characterization/hll/HllAccuracyProfile.java
index c51116e..c93abb2 100644
--- a/src/main/java/org/apache/datasketches/characterization/hll/HllAccuracyProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/hll/HllAccuracyProfile.java
@@ -33,6 +33,7 @@
@Override
public void configure() {
//Configure Sketch
+ final int lgK = Integer.parseInt(prop.mustGet("LgK"));
final boolean direct = Boolean.parseBoolean(prop.mustGet("HLL_direct"));
useComposite = Boolean.parseBoolean(prop.mustGet("HLL_useComposite"));
final String useCharArrStr = prop.get("Trials_charArr");
diff --git a/src/main/java/org/apache/datasketches/characterization/hll/ZetaHllAccuracyProfile.java b/src/main/java/org/apache/datasketches/characterization/hll/ZetaHllAccuracyProfile.java
index 2d8efa4..c7f64c2 100644
--- a/src/main/java/org/apache/datasketches/characterization/hll/ZetaHllAccuracyProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/hll/ZetaHllAccuracyProfile.java
@@ -38,6 +38,7 @@
@Override
public void configure() {
+ final int lgK = Integer.parseInt(prop.mustGet("LgK"));
lgSP = Integer.parseInt(prop.mustGet("LgSP"));
zetaType = prop.mustGet("ZetaType");
hllBuilder = new HyperLogLogPlusPlus.Builder();
diff --git a/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyIntersectionProfile.java b/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyIntersectionProfile.java
new file mode 100644
index 0000000..a47a275
--- /dev/null
+++ b/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyIntersectionProfile.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.datasketches.characterization.theta;
+
+import org.apache.datasketches.Family;
+import org.apache.datasketches.ResizeFactor;
+import org.apache.datasketches.characterization.AccuracyStats;
+import org.apache.datasketches.characterization.uniquecount.BaseAccuracyProfile;
+import org.apache.datasketches.theta.Intersection;
+import org.apache.datasketches.theta.SetOperationBuilder;
+import org.apache.datasketches.theta.UpdateSketch;
+import org.apache.datasketches.theta.UpdateSketchBuilder;
+
+public class ThetaAccuracyIntersectionProfile extends BaseAccuracyProfile {
+ private int myLgK; //avoids temporary conflict with BaseAccuracyProfile
+ private boolean rebuild;
+ private UpdateSketch skSm;
+ private UpdateSketch skLg;
+ private Intersection intersection;
+
+ @Override
+ public void configure() {
+ //Theta Sketch Profile
+ myLgK = Integer.parseInt(prop.mustGet("LgK"));
+ rebuild = Boolean.parseBoolean(prop.mustGet("Rebuild"));
+ final Family family = Family.stringToFamily(prop.mustGet("THETA_famName"));
+ final ResizeFactor rf = ResizeFactor.getRF(Integer.parseInt(prop.mustGet("LgRF")));
+ final float p = Float.parseFloat(prop.mustGet("P"));
+ //final boolean direct = Boolean.parseBoolean(prop.mustGet("Direct"));
+ final UpdateSketchBuilder udBldr = new UpdateSketchBuilder()
+ .setLogNominalEntries(myLgK)
+ .setFamily(family)
+ .setP(p)
+ .setResizeFactor(rf);
+ skSm = udBldr.build();
+ skLg = udBldr.build();
+ final SetOperationBuilder soBldr = new SetOperationBuilder()
+ .setLogNominalEntries(myLgK);
+ intersection = soBldr.buildIntersection();
+ }
+
+ @Override
+ public void doTrial() {
+ final int qArrLen = qArr.length;
+ skSm.reset();
+ skLg.reset();
+ long lastUniques = 0;
+ for (int i = 0; i < qArrLen; i++) {
+ final AccuracyStats q = qArr[i];
+ final long delta = (long)(q.trueValue - lastUniques);
+ for (long u = 0; u < delta; u++) {
+ if (i == 0) { skSm.update(vIn); }
+ skLg.update(vIn++);
+ }
+ lastUniques += delta;
+ if (rebuild) {
+ skSm.rebuild();
+ skLg.rebuild();
+ }
+ final double est = intersection.intersect(skLg, skSm).getEstimate();
+ q.update(est);
+ }
+ }
+
+}
+
diff --git a/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyIntersectionVsIEProfile.java b/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyIntersectionVsIEProfile.java
deleted file mode 100644
index 9d96e70..0000000
--- a/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyIntersectionVsIEProfile.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.datasketches.characterization.theta;
-
-import org.apache.datasketches.Job;
-import org.apache.datasketches.JobProfile;
-import org.apache.datasketches.Properties;
-import org.apache.datasketches.ResizeFactor;
-import org.apache.datasketches.theta.Intersection;
-import org.apache.datasketches.theta.SetOperationBuilder;
-import org.apache.datasketches.theta.Union;
-import org.apache.datasketches.theta.UpdateSketch;
-import org.apache.datasketches.theta.UpdateSketchBuilder;
-
-public class ThetaAccuracyIntersectionVsIEProfile implements JobProfile {
- final static String LS = System.getProperty("line.separator");
- Job job;
- Properties prop;
- long vIn = 0;
- int lgK;
- ResizeFactor rf;
- float p;
- boolean direct;
- boolean rebuild;
-
- int trials;
- int minLg10U;
- int maxLg10U;
- int ppom;
-
- UpdateSketch skSm;
- UpdateSketch skLg;
- Intersection intersection;
- Union union;
-
- int plotPoints;
- long[] uPoints;
- double[] fArr;
- double[] yTheorThetaREArr; // sqrt(F) * 1/sqrt(k) //plot of theoretical Theta RE
- double[] yTheorIE_REArr; // F * 1/sqrt(k) //plot of theoretical IE RE
- double[] yThetaREArr; //plot of measured Theta RE
- double[] yIE_REArr; //plot of meausred IE RE
-
- double[] yThetaRESumArr;
- double[] yIE_RESumArr;
-
- @Override
- public void start(final Job job) {
- this.job = job;
- prop = job.getProperties();
- lgK = Integer.parseInt(prop.mustGet("LgK"));
- rf = ResizeFactor.getRF(Integer.parseInt(prop.mustGet("LgRF")));
- p = Float.parseFloat(prop.mustGet("P"));
- direct = Boolean.parseBoolean(prop.mustGet("Direct"));
- rebuild = Boolean.parseBoolean(prop.mustGet("Rebuild"));
-
- trials = Integer.parseInt(prop.mustGet("Trials"));
-
- minLg10U = Integer.parseInt(prop.mustGet("MinLg10U"));
- maxLg10U = Integer.parseInt(prop.mustGet("MaxLg10U"));
- ppom = Integer.parseInt(prop.mustGet("PPOM"));
- configure();
- doTrials();
- process();
- shutdown();
- cleanup();
- job.println("");
- }
-
- void configure() {
- final double theorRSE = 1.0 / Math.sqrt(1 << lgK);
- plotPoints = (maxLg10U - minLg10U) * ppom + 1;
- fArr = new double[plotPoints];
- uPoints = new long[plotPoints];
- yTheorThetaREArr = new double[plotPoints];
- yTheorIE_REArr = new double[plotPoints];
- yThetaREArr = new double[plotPoints];
- yIE_REArr = new double[plotPoints];
-
- yThetaRESumArr = new double[plotPoints];
- yIE_RESumArr = new double[plotPoints];
-
- final double inc = 1.0 / ppom;
- for (int i = 0; i < plotPoints; i++) {
- final long aUb = (long)Math.pow(10, minLg10U + (i * inc));
- uPoints[i] = aUb;
- final long aIb = uPoints[0];
- final double F = (double)aUb / aIb;
- fArr[i] = F;
- yTheorIE_REArr[i] = F * theorRSE;
- yTheorThetaREArr[i] = Math.sqrt(F) * theorRSE;
- }
- configureSketches();
- }
-
- void configureSketches() {
- final UpdateSketchBuilder udBldr = new UpdateSketchBuilder()
- .setLogNominalEntries(lgK)
- .setP(p)
- .setResizeFactor(rf);
- skSm = udBldr.build();
- skLg = udBldr.build();
- final SetOperationBuilder soBldr = new SetOperationBuilder()
- .setLogNominalEntries(lgK);
- intersection = soBldr.buildIntersection();
- union = soBldr.buildUnion();
- }
-
- void doTrials() {
- for (int t = 1; t <= trials; t++) {
- doTrial();
- }
- for (int pp = 0; pp < plotPoints; pp++) {
- yThetaREArr[pp] = yThetaRESumArr[pp] / trials;
- yIE_REArr[pp] = yIE_RESumArr[pp] / trials;
- }
- }
-
- void doTrial() {
- final long base = uPoints[0];
- for (long u = 0; u < base; u++) {
- skSm.update(vIn);
- skLg.update(vIn++);
- }
- skSm.rebuild();
- skLg.rebuild();
- yThetaRESumArr[0] += (intersection.intersect(skLg, skSm).getEstimate() / base - 1.0) * 2.0;
- yIE_RESumArr[0] +=
- ((skSm.getEstimate() + skLg.getEstimate() - union.union(skSm, skLg).getEstimate()) / base - 1.0) * 2.0;
-
- for (int pp = 1; pp < plotPoints; pp++) {
- final long delta = uPoints[pp] - uPoints[pp - 1];
- for (long u = 0; u < delta; u++) {
- skLg.update(vIn++);
- }
- skLg.rebuild();
- yThetaRESumArr[pp] += intersection.intersect(skLg, skSm).getEstimate() / base - 1.0;
- yIE_RESumArr[pp] += (skSm.getEstimate() + skLg.getEstimate() - union.union(skSm, skLg).getEstimate())
- / base - 1.0;
- }
- skSm.reset();
- skLg.reset();
- }
-
- final String[] hdr = {"PP","F", "TheorThetaRE", "TheorIE_RE", "ThetaRE", "IE_RE"};
- final String hfmt = "%6s %12s %12s %12s %12s %12s" + LS;
- final String fmt = "%6d %12.3e %12.6f %12.6f %12.6f %12.6f" + LS;
-
- void process() {
- job.println("");
- job.printf(hfmt, (Object[]) hdr );
- for (int i = 0; i < plotPoints; i++) {
- job.printf(fmt, i, fArr[i], yTheorThetaREArr[i], yTheorIE_REArr[i], yThetaREArr[i], yIE_REArr[i]);
- }
- }
-
- @Override
- public void shutdown() { }
-
- @Override
- public void cleanup() { }
-
-}
-
diff --git a/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyProfile.java b/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyProfile.java
index 0b81f82..9cdcf63 100644
--- a/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/theta/ThetaAccuracyProfile.java
@@ -33,11 +33,12 @@
*/
public class ThetaAccuracyProfile extends BaseAccuracyProfile {
private UpdateSketch sketch;
- private boolean rebuild; //Theta QS Sketch Accuracy
+ private boolean rebuild;
@Override
public void configure() {
- //Configure Sketch
+ //Theta Sketch Profile
+ final int lgK = Integer.parseInt(prop.mustGet("LgK"));
final Family family = Family.stringToFamily(prop.mustGet("THETA_famName"));
final float p = Float.parseFloat(prop.mustGet("THETA_p"));
final ResizeFactor rf = ResizeFactor.getRF(Integer.parseInt(prop.mustGet("THETA_lgRF")));
diff --git a/src/main/java/org/apache/datasketches/characterization/theta/ThetaUnionAccuracyProfile.java b/src/main/java/org/apache/datasketches/characterization/theta/ThetaUnionAccuracyProfile.java
index 6e38876..7d2a490 100644
--- a/src/main/java/org/apache/datasketches/characterization/theta/ThetaUnionAccuracyProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/theta/ThetaUnionAccuracyProfile.java
@@ -40,6 +40,7 @@
@Override
public void configure() {
//Configure Sketch
+ final int lgK = Integer.parseInt(prop.mustGet("LgK"));
//final Family family = Family.stringToFamily(prop.mustGet("THETA_famName"));
final float p = Float.parseFloat(prop.mustGet("THETA_p"));
final ResizeFactor rf = ResizeFactor.getRF(Integer.parseInt(prop.mustGet("THETA_lgRF")));
diff --git a/src/main/java/org/apache/datasketches/characterization/theta/ThetaUnionAccuracyProfile2.java b/src/main/java/org/apache/datasketches/characterization/theta/ThetaUnionAccuracyProfile2.java
index 55c370d..613e095 100644
--- a/src/main/java/org/apache/datasketches/characterization/theta/ThetaUnionAccuracyProfile2.java
+++ b/src/main/java/org/apache/datasketches/characterization/theta/ThetaUnionAccuracyProfile2.java
@@ -43,6 +43,7 @@
@Override
public void configure() {
+ final int lgK = Integer.parseInt(prop.mustGet("LgK"));
final Family family = Family.stringToFamily(prop.mustGet("THETA_famName"));
final float p = Float.parseFloat(prop.mustGet("THETA_p"));
final ResizeFactor rf = ResizeFactor.getRF(Integer.parseInt(prop.mustGet("THETA_lgRF")));
diff --git a/src/main/java/org/apache/datasketches/characterization/theta/concurrent/ConcurrentThetaAccuracyProfile.java b/src/main/java/org/apache/datasketches/characterization/theta/concurrent/ConcurrentThetaAccuracyProfile.java
index 1d16435..9c1bd1c 100644
--- a/src/main/java/org/apache/datasketches/characterization/theta/concurrent/ConcurrentThetaAccuracyProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/theta/concurrent/ConcurrentThetaAccuracyProfile.java
@@ -48,7 +48,7 @@
@Override
public void configure() {
//Configure Sketches
- sharedLgK = lgK;
+ sharedLgK = Integer.parseInt(prop.mustGet("LgK"));
localLgK = Integer.parseInt(prop.mustGet("CONCURRENT_THETA_localLgK"));
poolThreads = Integer.parseInt(prop.mustGet("CONCURRENT_THETA_poolThreads"));
maxConcurrencyError = Double.parseDouble(prop.mustGet("CONCURRENT_THETA_maxConcurrencyError"));
diff --git a/src/main/java/org/apache/datasketches/characterization/uniquecount/BaseAccuracyProfile.java b/src/main/java/org/apache/datasketches/characterization/uniquecount/BaseAccuracyProfile.java
index 0f43707..27a639a 100644
--- a/src/main/java/org/apache/datasketches/characterization/uniquecount/BaseAccuracyProfile.java
+++ b/src/main/java/org/apache/datasketches/characterization/uniquecount/BaseAccuracyProfile.java
@@ -54,17 +54,23 @@
public void start(final Job job) {
this.job = job;
prop = job.getProperties();
+ //Uniques Profile
+ lgMinU = Integer.parseInt(prop.mustGet("Trials_lgMinU"));
+ lgMaxU = Integer.parseInt(prop.mustGet("Trials_lgMaxU"));
+ uPPO = Integer.parseInt(prop.mustGet("Trials_UPPO"));
+ //Trials Profile
lgMinT = Integer.parseInt(prop.mustGet("Trials_lgMinT"));
lgMaxT = Integer.parseInt(prop.mustGet("Trials_lgMaxT"));
tPPO = Integer.parseInt(prop.mustGet("Trials_TPPO"));
- lgMinU = Integer.parseInt(prop.mustGet("Trials_lgMinU"));
- lgMaxU = Integer.parseInt(prop.mustGet("Trials_lgMaxU"));
+
+ lgQK = Integer.parseInt(prop.mustGet("Trials_lgQK"));
interData = Boolean.parseBoolean(prop.mustGet("Trials_interData"));
postPMFs = Boolean.parseBoolean(prop.mustGet("Trials_postPMFs"));
- uPPO = Integer.parseInt(prop.mustGet("Trials_UPPO"));
- lgQK = Integer.parseInt(prop.mustGet("Trials_lgQK"));
- qArr = AccuracyStats.buildLog2AccuracyStatsArray(lgMinU, lgMaxU, uPPO, lgQK);
+ //Sketch Profile
lgK = Integer.parseInt(prop.mustGet("LgK"));
+
+ qArr = AccuracyStats.buildLog2AccuracyStatsArray(lgMinU, lgMaxU, uPPO, lgQK);
+
final String getSizeStr = prop.get("Trials_bytes");
getSize = getSizeStr == null ? false : Boolean.parseBoolean(getSizeStr);
configure();
diff --git a/src/main/resources/theta/ThetaAccuracyIntersectionJob.conf b/src/main/resources/theta/ThetaAccuracyIntersectionJob.conf
new file mode 100644
index 0000000..88922c7
--- /dev/null
+++ b/src/main/resources/theta/ThetaAccuracyIntersectionJob.conf
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Used by Job
+
+## Job Profile
+JobProfile=org.apache.datasketches.characterization.theta.ThetaAccuracyIntersectionProfile
+
+## Date-Time Profile
+TimeZone=PST
+TimeZoneOffset=-28800000 # offset in millisec
+FileNameDateFormat=yyyyMMdd'_'HHmmssz
+ReadableDateFormat=yyyy/MM/dd HH:mm:ss
+
+# Used by BaseAccuracyProfile
+
+## Uniques Profile
+Trials_lgMinU=20 #The starting # of uniques that is printed at the end.
+Trials_lgMaxU=24 #How high the # uniques go
+Trials_UPPO=1 #The horizontal x-resolution of trials points
+
+## Trials Profile
+Trials_lgMinT=6 #prints intermediate results starting w/ this lgMinT
+Trials_lgMaxT=6 #The max trials
+Trials_TPPO=1 #how often intermediate results are printed
+
+Trials_lgQK=12 #size of quantiles sketch
+Trials_interData=true
+Trials_postPMFs=false
+
+Trials_bytes=false
+
+# Used by ThetaAccuracyIntersectionVsIEProfile
+
+## Theta Sketch Profile
+LgK=12
+THETA_famName=QUICKSELECT #QUICKSELECT Cannot use ALPHA until 0.10.4
+THETA_lgRF=0 #set the log resize factor to 0 (RF = 1)
+THETA_p=1.0
+THETA_direct=false
+THETA_rebuild=true
+
diff --git a/src/main/resources/theta/ThetaAccuracyIntersectionVsIEJob.conf b/src/main/resources/theta/ThetaAccuracyIntersectionVsIEJob.conf
deleted file mode 100644
index 6cc8ffe..0000000
--- a/src/main/resources/theta/ThetaAccuracyIntersectionVsIEJob.conf
+++ /dev/null
@@ -1,42 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Job
-
-# Job Profile
-JobProfile=org.apache.datasketches.characterization.theta.ThetaAccuracyIntersectionVsIEProfile
-
-#Theta Sketch configure
-LgK=12
-LgRF=0 #set the log resize factor to 0 (RF = 1)
-P=1.0
-Direct=false
-Rebuild=true
-
-# Trials
-Trials=500
-
-# X-Axis, Uniques
-MinLg10U=6
-MaxLg10U=7
-PPOM=4 # points per order-of-magnitude
-
-# Date-Time Profile
-TimeZone=PST
-TimeZoneOffset=-28800000 # offset in millisec
-FileNameDateFormat=yyyyMMdd'_'HHmmssz
-ReadableDateFormat=yyyy/MM/dd HH:mm:ss
diff --git a/src/main/resources/theta/ThetaAccuracyJob.conf b/src/main/resources/theta/ThetaAccuracyJob.conf
index ead6d09..fc2102d 100644
--- a/src/main/resources/theta/ThetaAccuracyJob.conf
+++ b/src/main/resources/theta/ThetaAccuracyJob.conf
@@ -15,34 +15,42 @@
# specific language governing permissions and limitations
# under the License.
-# Job
+# Used by Job
-#Uniques Profile
+## Job Profile
+JobProfile=org.apache.datasketches.characterization.theta.ThetaAccuracyProfile
+
+## Date-Time Profile
+TimeZone=PST
+TimeZoneOffset=-28800000 # offset in millisec
+FileNameDateFormat=yyyyMMdd'_'HHmmssz
+ReadableDateFormat=yyyy/MM/dd HH:mm:ss
+
+# Used by BaseAccuracyProfile
+
+## Uniques Profile
Trials_lgMinU=0 #The starting # of uniques that is printed at the end.
Trials_lgMaxU=20 #How high the # uniques go
Trials_UPPO=16 #The horizontal x-resolution of trials points
-# Trials Profile
-Trials_lgMinT=8 #prints intermediate results starting w/ this lgMinT
+## Trials Profile
+Trials_lgMinT=8 #prints intermediate results starting w/ this lgMinT
Trials_lgMaxT=18 #The max trials
Trials_TPPO=1 #how often intermediate results are printed
Trials_lgQK=12 #size of quantiles sketch
Trials_interData=true
Trials_postPMFs=false
+
Trials_bytes=false
-# Date-Time Profile
-TimeZone=PST
-TimeZoneOffset=-28800000 # offset in millisec
-FileNameDateFormat=yyyyMMdd'_'HHmmssz
-ReadableDateFormat=yyyy/MM/dd HH:mm:ss
+# Used by ThetaAccuracyProfile
-#Job Profile
-JobProfile=org.apache.datasketches.characterization.theta.ThetaAccuracyProfile
+## Theta Sketch Profile
LgK=12
-THETA_lgRF=0 #set the log resize factor to 0 (RF = 1)
THETA_famName=QUICKSELECT #QUICKSELECT Cannot use ALPHA until 0.10.4
THETA_p=1.0
+THETA_lgRF=0 #set the log resize factor to 0 (RF = 1)
THETA_direct=false
THETA_rebuild=false
+
diff --git a/src/test/java/org/apache/datasketches/MonotonicPointsTest.java b/src/test/java/org/apache/datasketches/MonotonicPointsTest.java
index f56b6ee..d6a45d2 100644
--- a/src/test/java/org/apache/datasketches/MonotonicPointsTest.java
+++ b/src/test/java/org/apache/datasketches/MonotonicPointsTest.java
@@ -20,6 +20,8 @@
package org.apache.datasketches;
import static org.testng.Assert.assertEquals;
+import static org.apache.datasketches.MonotonicPoints.*;
+import static org.apache.datasketches.Util.*;
import org.testng.annotations.Test;
@@ -47,10 +49,44 @@
assertEquals(arr[2], 7.0);
}
- @Test void checkEvenlySpacedPoints() {
+ @Test
+ public void checkEvenlySpacedPoints() {
double[] arr = Util.evenlySpaced(0.0, 100.0, 21);
for (int i = 0; i < arr.length; i++) { println(arr[i] + ""); }
}
+ @Test
+ public void checkCountPoints() {
+ int lgStart = 0;
+ int start = 1 << lgStart;
+ int lgEnd = 4;
+ int end = 1 << lgEnd;
+ final int p = countPoints(lgStart, lgEnd, 4);
+ println(p);
+ println("-");
+ int q = start;
+ while (q <= end) {
+ println(q);
+ q = pwr2SeriesNext(4, q);
+ }
+ }
+
+ @Test
+ public void checkCountLog10Points() {
+ int log10Start = 0;
+ int start = 1;
+ int log10End = 2;
+ int end = 100;
+ int ppb = 4;
+ final int p = countLog10Points(log10Start, log10End, ppb);
+ println(p);
+ println("-");
+ int q = start;
+ while (q <= end) {
+ println(q);
+ q = (int)powerSeriesNextDouble(ppb, q, true, 10.0);
+ }
+ }
+
static void println(Object o) { System.out.println(o.toString()); }
}
diff --git a/src/test/java/org/apache/datasketches/characterization/AccuracyStatsTest.java b/src/test/java/org/apache/datasketches/characterization/AccuracyStatsTest.java
new file mode 100644
index 0000000..80e9e00
--- /dev/null
+++ b/src/test/java/org/apache/datasketches/characterization/AccuracyStatsTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.datasketches.characterization;
+
+import static org.apache.datasketches.characterization.AccuracyStats.*;
+import org.testng.annotations.Test;
+
+public class AccuracyStatsTest {
+
+ @Test
+ public void checkBuildLog10AccuracyStatsArray() {
+ final int log10Min = 6;
+ final int log10Max = 8;
+ final int ppb = 4;
+ final int lgQK = 10;
+ AccuracyStats[] asArr =
+ buildLog10AccuracyStatsArray(log10Min, log10Max, ppb, lgQK);
+ println(asArr.length);
+ }
+
+ static void println(Object o) { System.out.println(o.toString()); }
+}
+