@Test public void testDecision() { Decision decision = new NumericDecision(0, -3.1f, true); assertFalse(decision.isPositive(new Example(null, NumericFeature.forValue(-3.5f)))); assertTrue(decision.isPositive(new Example(null, NumericFeature.forValue(-3.1f)))); assertTrue(decision.isPositive(new Example(null, NumericFeature.forValue(-3.0f)))); assertTrue(decision.isPositive(new Example(null, NumericFeature.forValue(3.1f)))); assertTrue(decision.isPositive(new Example(null, new Feature[] {null}))); }
@Override public boolean isPositive(Example example) { NumericFeature feature = (NumericFeature) example.getFeature(getFeatureNumber()); return feature == null ? defaultDecision : feature.getValue() >= threshold; }
NumericDecision extends Decision { @Override public boolean isPositive(Example example) { NumericFeature feature = (NumericFeature) example.getFeature(getFeatureNumber()); return feature == null ? defaultDecision : feature.getValue() >= threshold; } }
NumericDecision extends Decision { @Override public boolean isPositive(Example example) { NumericFeature feature = (NumericFeature) example.getFeature(getFeatureNumber()); return feature == null ? defaultDecision : feature.getValue() >= threshold; } NumericDecision(int featureNumber, float threshold, boolean defaultDecision); private  NumericDecision(int featureNumber, float threshold, float mean); }
NumericDecision extends Decision { @Override public boolean isPositive(Example example) { NumericFeature feature = (NumericFeature) example.getFeature(getFeatureNumber()); return feature == null ? defaultDecision : feature.getValue() >= threshold; } NumericDecision(int featureNumber, float threshold, boolean defaultDecision); private  NumericDecision(int featureNumber, float threshold, float mean); float getThreshold(); @Override boolean getDefaultDecision(); @Override boolean isPositive(Example example); @Override FeatureType getType(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
NumericDecision extends Decision { @Override public boolean isPositive(Example example) { NumericFeature feature = (NumericFeature) example.getFeature(getFeatureNumber()); return feature == null ? defaultDecision : feature.getValue() >= threshold; } NumericDecision(int featureNumber, float threshold, boolean defaultDecision); private  NumericDecision(int featureNumber, float threshold, float mean); float getThreshold(); @Override boolean getDefaultDecision(); @Override boolean isPositive(Example example); @Override FeatureType getType(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }