Repository: bigtop
Updated Branches:
  refs/heads/master 89393913a -> 37976e5a7


BIGTOP-1919. Remove fixConditional methods in BPS data generator


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/37976e5a
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/37976e5a
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/37976e5a

Branch: refs/heads/master
Commit: 37976e5a73c35151d63124302191031b483a12d6
Parents: 8939391
Author: RJ Nowling <[email protected]>
Authored: Sat Jul 11 11:35:07 2015 -0500
Committer: RJ Nowling <[email protected]>
Committed: Sat Jul 11 11:35:07 2015 -0500

----------------------------------------------------------------------
 .../ConditionalProbabilityDensityFunction.java  |  2 --
 .../framework/samplers/ConditionalSampler.java  |  2 --
 .../wfs/ConditionalWeightFunction.java          |  2 --
 .../customer/CustomerSamplerBuilder.java        |  5 ----
 .../purchase/PurchasingProcesses.java           |  6 -----
 .../transaction/CategoryWeightFunction.java     | 16 ++----------
 .../TransactionPurchasesHiddenMarkovModel.java  | 13 ----------
 .../transaction/TransactionTimePDF.java         | 26 +++++---------------
 .../customer/TestCustomerSampler.java           |  5 ----
 .../transaction/TestTransactionTimePDF.java     | 11 ---------
 10 files changed, 8 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/ConditionalProbabilityDensityFunction.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/ConditionalProbabilityDensityFunction.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/ConditionalProbabilityDensityFunction.java
index f879870..5161761 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/ConditionalProbabilityDensityFunction.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/ConditionalProbabilityDensityFunction.java
@@ -18,6 +18,4 @@ package 
org.apache.bigtop.bigpetstore.datagenerator.framework.pdfs;
 public interface ConditionalProbabilityDensityFunction<T, S>
 {
        public double probability(T datum, S conditionalDatum);
-       
-       public ProbabilityDensityFunction<T> fixConditional(S conditionalDatum);
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/ConditionalSampler.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/ConditionalSampler.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/ConditionalSampler.java
index 54506e2..c521333 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/ConditionalSampler.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/ConditionalSampler.java
@@ -18,6 +18,4 @@ package 
org.apache.bigtop.bigpetstore.datagenerator.framework.samplers;
 public interface ConditionalSampler<T, S>
 {
        public T sample(S conditional) throws Exception;
-       
-       public Sampler<T> fixConditional(S conditional) throws Exception;
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/wfs/ConditionalWeightFunction.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/wfs/ConditionalWeightFunction.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/wfs/ConditionalWeightFunction.java
index 21d0109..603e5e9 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/wfs/ConditionalWeightFunction.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/framework/wfs/ConditionalWeightFunction.java
@@ -18,6 +18,4 @@ package 
org.apache.bigtop.bigpetstore.datagenerator.framework.wfs;
 public interface ConditionalWeightFunction<T, S>
 {
        public double weight(T datum, S given);
-       
-       public WeightFunction<T> fixConditional(S given);
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/CustomerSamplerBuilder.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/CustomerSamplerBuilder.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/CustomerSamplerBuilder.java
index 209b099..4b449e8 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/CustomerSamplerBuilder.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/CustomerSamplerBuilder.java
@@ -62,11 +62,6 @@ public class CustomerSamplerBuilder
                                        {
                                                return 
locationSamplers.get(store).sample();
                                        }
-                                       
-                                       public Sampler<ZipcodeRecord> 
fixConditional(Store store)
-                                       {
-                                               return 
locationSamplers.get(store);
-                                       }
                                };
        }
        

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/purchase/PurchasingProcesses.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/purchase/PurchasingProcesses.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/purchase/PurchasingProcesses.java
index 746026b..d9a9849 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/purchase/PurchasingProcesses.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/purchase/PurchasingProcesses.java
@@ -36,10 +36,4 @@ public class PurchasingProcesses implements 
ConditionalSampler<Product, String>
        {
                return this.processes.get(productCategory).sample();
        }
-       
-       public Sampler<Product> fixConditional(String productCategory) throws 
Exception
-       {
-               return this.processes.get(productCategory);
-       }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/CategoryWeightFunction.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/CategoryWeightFunction.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/CategoryWeightFunction.java
index 10f195e..09b7327 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/CategoryWeightFunction.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/CategoryWeightFunction.java
@@ -33,19 +33,7 @@ public class CategoryWeightFunction implements 
ConditionalWeightFunction<Double,
        @Override
        public double weight(Double exhaustionTime, Double transactionTime)
        {
-               return fixConditional(transactionTime).weight(exhaustionTime);
-       }
-       
-       @Override
-       public WeightFunction<Double> fixConditional(final Double 
transactionTime)
-       {
-               return new WeightFunction<Double>()
-                       {
-                               public double weight(Double exhaustionTime)
-                               {
-                                       double remainingTime = Math.max(0.0, 
exhaustionTime - transactionTime);
-                                       return pdf.probability(remainingTime);
-                               }
-                       };
+               double remainingTime = Math.max(0.0, exhaustionTime - 
transactionTime);
+               return pdf.probability(remainingTime);
        }
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionPurchasesHiddenMarkovModel.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionPurchasesHiddenMarkovModel.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionPurchasesHiddenMarkovModel.java
index 8e6bd78..83924e3 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionPurchasesHiddenMarkovModel.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionPurchasesHiddenMarkovModel.java
@@ -105,17 +105,4 @@ public class TransactionPurchasesHiddenMarkovModel 
implements ConditionalSampler
                
                return purchasedProducts;
        }
-       
-       public Sampler<List<Product>> fixConditional(final Double 
transactionTime)
-       {
-               final ConditionalSampler<List<Product>, Double> sampler = this;
-               return new Sampler<List<Product>>()
-               {
-                       public List<Product> sample() throws Exception
-                       {
-                               return sampler.sample(transactionTime);
-                       }
-               };
-       }
-       
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionTimePDF.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionTimePDF.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionTimePDF.java
index 72dcc04..b2b284f 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionTimePDF.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TransactionTimePDF.java
@@ -16,30 +16,16 @@
 package org.apache.bigtop.bigpetstore.datagenerator.generators.transaction;
 
 import 
org.apache.bigtop.bigpetstore.datagenerator.framework.pdfs.ConditionalProbabilityDensityFunction;
-import 
org.apache.bigtop.bigpetstore.datagenerator.framework.pdfs.ProbabilityDensityFunction;
 
 public class TransactionTimePDF implements 
ConditionalProbabilityDensityFunction<Double, Double>
 {      
        public double probability(Double proposedTime, Double 
lastTransactionTime)
        {
-               return 
fixConditional(lastTransactionTime).probability(proposedTime);
-       }
-       
-       public ProbabilityDensityFunction<Double> fixConditional(final Double 
lastTransactionTime)
-       {
-               return new ProbabilityDensityFunction<Double>()
-                       {
-                               public double probability(Double 
proposedTransactionTime)
-                               {
-                                       if(proposedTransactionTime >= 
lastTransactionTime)
-                                       {
-                                               return 1.0;
-                                       }
-                                       else
-                                       {
-                                               return 0.0;
-                                       }
-                               }
-                       };
+               if(proposedTime >= lastTransactionTime)
+               {
+                       return 1.0;
+               }
+
+               return 0.0;
        }
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java
index 5865a83..380d9f0 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java
@@ -61,11 +61,6 @@ public class TestCustomerSampler
                                        {
                                                return 
locationSamplers.get(store).sample();
                                        }
-                                       
-                                       public Sampler<ZipcodeRecord> 
fixConditional(Store store)
-                                       {
-                                               return 
locationSamplers.get(store);
-                                       }
                                };
        }
 

http://git-wip-us.apache.org/repos/asf/bigtop/blob/37976e5a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
index 8c57f84..6c2bf31 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
@@ -32,15 +32,4 @@ public class TestTransactionTimePDF
                assertEquals(pdf.probability(0.5, 0.5), 1.0, 0.000001);
                assertEquals(pdf.probability(0.75, 0.5), 1.0, 0.000001);
        }
-       
-       @Test
-       public void testFixConditional() throws Exception
-       {
-               TransactionTimePDF pdf = new TransactionTimePDF();
-               
-               assertEquals(pdf.fixConditional(0.75).probability(0.5), 0.0, 
0.000001);
-               assertEquals(pdf.fixConditional(0.5).probability(0.5), 1.0, 
0.000001);
-               assertEquals(pdf.fixConditional(0.5).probability(0.75), 1.0, 
0.000001);
-       }
-
 }

Reply via email to