/** * Add a new data value to the current estimator. * * @param data the new data value * @param given the new value that data is conditional upon * @param weight the weight assigned to the data value */ public void addValue(double data, double given, double weight) { m_Estimators[(int)given].addValue(data, weight); }
/** * Add a new data value to the current estimator. * * @param data the new data value * @param given the new value that data is conditional upon * @param weight the weight assigned to the data value */ public void addValue(double data, double given, double weight) { m_Estimators[(int)given].addValue(data, weight); }
/** * Add a new data value to the current estimator. * * @param data the new data value * @param given the new value that data is conditional upon * @param weight the weight assigned to the data value */ public void addValue(double data, double given, double weight) { m_Estimators[(int)data].addValue(given, weight); m_Weights.addValue((int)data, weight); }
/** * Add a new data value to the current estimator. * * @param data the new data value * @param given the new value that data is conditional upon * @param weight the weight assigned to the data value */ public void addValue(double data, double given, double weight) { m_Estimators[(int)data].addValue(given, weight); m_Weights.addValue((int)data, weight); }
/** * Add a new data value to the current estimator. * * @param data the new data value * @param given the new value that data is conditional upon * @param weight the weight assigned to the data value */ public void addValue(double data, double given, double weight) { m_Estimators[(int)data].addValue(given, weight); m_Weights.addValue((int)data, weight); }
/** * Add a new data value to the current estimator. * * @param data the new data value * @param given the new value that data is conditional upon * @param weight the weight assigned to the data value */ public void addValue(double data, double given, double weight) { m_Estimators[(int)data].addValue(given, weight); m_Weights.addValue((int)data, weight); }
System.out.println("Prediction for " + current + " = " + newEst.getProbability(current)); newEst.addValue(current, 1);
System.out.println("Prediction for " + current + " = " + newEst.getProbability(current)); newEst.addValue(current, 1);
System.out.println("Prediction for " + current + " = " + newEst.getProbability(current)); newEst.addValue(current, 1);
System.out.println("Prediction for " + current + " = " + newEst.getProbability(current)); newEst.addValue(current, 1);
System.out.println("Prediction for " + current + " = " + newEst.getProbability(current)); newEst.addValue(current, 1);
System.out.println("Prediction for " + current + " = " + newEst.getProbability(current)); newEst.addValue(current, 1);
protected static void testAggregation() { DiscreteEstimator df = new DiscreteEstimator(5, true); DiscreteEstimator one = new DiscreteEstimator(5, true); DiscreteEstimator two = new DiscreteEstimator(5, true); java.util.Random r = new java.util.Random(1); for (int i = 0; i < 100; i++) { int z = r.nextInt(5); df.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(df.toString()); System.out.println("Prob (0): " + df.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(); } }
protected static void testAggregation() { DiscreteEstimator df = new DiscreteEstimator(5, true); DiscreteEstimator one = new DiscreteEstimator(5, true); DiscreteEstimator two = new DiscreteEstimator(5, true); java.util.Random r = new java.util.Random(1); for (int i = 0; i < 100; i++) { int z = r.nextInt(5); df.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(df.toString()); System.out.println("Prob (0): " + df.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(); } }
@Override public MTask call() { for (int l = m_start; l < m_end; l++) { Instance in = m_inst.instance(l); for (int i = 0; i < m_num_clusters; i++) { for (int j = 0; j < m_num_attribs; j++) { if (m_inst.attribute(j).isNominal()) { m_taskModel[i][j].addValue(in.value(j), in.weight() * m_weights[l][i]); } else { m_taskModelNormal[i][j][0] += (in.value(j) * in.weight() * m_weights[l][i]); m_taskModelNormal[i][j][2] += in.weight() * m_weights[l][i]; m_taskModelNormal[i][j][1] += (in.value(j) * in.value(j) * in.weight() * m_weights[l][i]); } } } } // completedMTask(this, true); return this; } }
@Override public MTask call() { for (int l = m_start; l < m_end; l++) { Instance in = m_inst.instance(l); for (int i = 0; i < m_num_clusters; i++) { for (int j = 0; j < m_num_attribs; j++) { if (m_inst.attribute(j).isNominal()) { m_taskModel[i][j].addValue(in.value(j), in.weight() * m_weights[l][i]); } else { m_taskModelNormal[i][j][0] += (in.value(j) * in.weight() * m_weights[l][i]); m_taskModelNormal[i][j][2] += in.weight() * m_weights[l][i]; m_taskModelNormal[i][j][1] += (in.value(j) * in.value(j) * in.weight() * m_weights[l][i]); } } } } // completedMTask(this, true); return this; } }
if (!inst.isMissing(j)) { if (data.attribute(j).isNominal()) { m_model[cluster][j].addValue(inst.value(j), inst.weight()); } else { m_modelNormal[cluster][j][0] += inst.weight() * inst.value(j);
if (!inst.isMissing(j)) { if (data.attribute(j).isNominal()) { m_model[cluster][j].addValue(inst.value(j), inst.weight()); } else { m_modelNormal[cluster][j][0] += inst.weight() * inst.value(j);