/** * Constructor * * @param numCondSymbols the number of conditioning symbols * @param precision the precision to which numeric values are given. For * example, if the precision is stated to be 0.1, the values in the * interval (0.25,0.35] are all treated as 0.3. */ public NDConditionalEstimator(int numCondSymbols, double precision) { m_Estimators = new NormalEstimator [numCondSymbols]; for(int i = 0; i < numCondSymbols; i++) { m_Estimators[i] = new NormalEstimator(precision); } }
/** * Constructor * * @param numCondSymbols the number of conditioning symbols * @param precision the precision to which numeric values are given. For * example, if the precision is stated to be 0.1, the values in the * interval (0.25,0.35] are all treated as 0.3. */ public NDConditionalEstimator(int numCondSymbols, double precision) { m_Estimators = new NormalEstimator [numCondSymbols]; for(int i = 0; i < numCondSymbols; i++) { m_Estimators[i] = new NormalEstimator(precision); } }
/** * Constructor * * @param numSymbols the number of symbols * @param precision the precision to which numeric values are given. For * example, if the precision is stated to be 0.1, the values in the * interval (0.25,0.35] are all treated as 0.3. */ public DNConditionalEstimator(int numSymbols, double precision) { m_Estimators = new NormalEstimator [numSymbols]; for(int i = 0; i < numSymbols; i++) { m_Estimators[i] = new NormalEstimator(precision); } m_Weights = new DiscreteEstimator(numSymbols, true); }
/** * Constructor * * @param numSymbols the number of symbols * @param precision the precision to which numeric values are given. For * example, if the precision is stated to be 0.1, the values in the * interval (0.25,0.35] are all treated as 0.3. */ public DNConditionalEstimator(int numSymbols, double precision) { m_Estimators = new NormalEstimator [numSymbols]; for(int i = 0; i < numSymbols; i++) { m_Estimators[i] = new NormalEstimator(precision); } m_Weights = new DiscreteEstimator(numSymbols, true); }
/** * Main method for testing this class. * * @param argv should contain a sequence of numeric values */ public static void main(String[] argv) { try { if (argv.length == 0) { System.out.println("Please specify a set of instances."); return; } NormalEstimator newEst = new NormalEstimator(0.01); for (int i = 0; i < argv.length; i++) { double current = Double.valueOf(argv[i]).doubleValue(); System.out.println(newEst); System.out.println("Prediction for " + current + " = " + newEst.getProbability(current)); newEst.addValue(current, 1); } NormalEstimator.testAggregation(); } catch (Exception e) { System.out.println(e.getMessage()); } } }
/** * Main method for testing this class. * * @param argv should contain a sequence of numeric values */ public static void main(String[] argv) { try { if (argv.length == 0) { System.out.println("Please specify a set of instances."); return; } NormalEstimator newEst = new NormalEstimator(0.01); for (int i = 0; i < argv.length; i++) { double current = Double.valueOf(argv[i]).doubleValue(); System.out.println(newEst); System.out.println("Prediction for " + current + " = " + newEst.getProbability(current)); newEst.addValue(current, 1); } NormalEstimator.testAggregation(); } catch (Exception e) { System.out.println(e.getMessage()); } } }
public static void testAggregation() { NormalEstimator ne = new NormalEstimator(0.01); NormalEstimator one = new NormalEstimator(0.01); NormalEstimator two = new NormalEstimator(0.01); java.util.Random r = new java.util.Random(1); for (int i = 0; i < 100; i++) { double z = r.nextDouble(); ne.addValue(z, 1); if (i < 50) { one.addValue(z, 1); } else { two.addValue(z, 1); } } try { System.out.println("\n\nFull\n"); System.out.println(ne.toString()); System.out.println("Prob (0): " + ne.getProbability(0)); System.out.println("\nOne\n" + one.toString()); System.out.println("Prob (0): " + one.getProbability(0)); System.out.println("\nTwo\n" + two.toString()); System.out.println("Prob (0): " + two.getProbability(0)); one = one.aggregate(two); System.out.println("\nAggregated\n"); System.out.println(one.toString()); System.out.println("Prob (0): " + one.getProbability(0)); } catch (Exception ex) { ex.printStackTrace(); } }
public static void testAggregation() { NormalEstimator ne = new NormalEstimator(0.01); NormalEstimator one = new NormalEstimator(0.01); NormalEstimator two = new NormalEstimator(0.01); java.util.Random r = new java.util.Random(1); for (int i = 0; i < 100; i++) { double z = r.nextDouble(); ne.addValue(z, 1); if (i < 50) { one.addValue(z, 1); } else { two.addValue(z, 1); } } try { System.out.println("\n\nFull\n"); System.out.println(ne.toString()); System.out.println("Prob (0): " + ne.getProbability(0)); System.out.println("\nOne\n" + one.toString()); System.out.println("Prob (0): " + one.getProbability(0)); System.out.println("\nTwo\n" + two.toString()); System.out.println("Prob (0): " + two.getProbability(0)); one = one.aggregate(two); System.out.println("\nAggregated\n"); System.out.println(one.toString()); System.out.println("Prob (0): " + one.getProbability(0)); } catch (Exception ex) { ex.printStackTrace(); } }
m_Distributions[attIndex][j] = new KernelEstimator(numPrecision); } else { m_Distributions[attIndex][j] = new NormalEstimator(numPrecision);
m_Distributions[attIndex][j] = new KernelEstimator(numPrecision); } else { m_Distributions[attIndex][j] = new NormalEstimator(numPrecision);