Examples of BinaryLabeledInstance


Examples of com.etsy.conjecture.data.BinaryLabeledInstance

    final double eps = 0.000001;
    final SGDOptimizer optimizer = new ElasticNetOptimizer();

    BinaryLabeledInstance getPositiveInstance() {
        BinaryLabeledInstance bli = new BinaryLabeledInstance(1.0);
        bli.setCoordinate("foo", 1.0);
        bli.setCoordinate("bar", 2.0);
        return bli;
    }
View Full Code Here

Examples of com.etsy.conjecture.data.BinaryLabeledInstance

        bli.setCoordinate("bar", 2.0);
        return bli;
    }

    BinaryLabeledInstance getNegativeInstance() {
        BinaryLabeledInstance bli = new BinaryLabeledInstance(0.0);
        bli.setCoordinate("foo", 1.0);
        bli.setCoordinate("baz", -1.0);
        return bli;
    }
View Full Code Here

Examples of com.etsy.conjecture.data.BinaryLabeledInstance

        assertTrue(p.predict(getPositiveInstance().getVector()).getValue() > 0.5);
        assertTrue(p.predict(getNegativeInstance().getVector()).getValue() < 0.5);
    }

    public void testInstanceNotModified(UpdateableLinearModel model) {
        BinaryLabeledInstance instance = getPositiveInstance();
        StringKeyedVector instanceCopy = instance.getVector().copy();
        model.update(instance);
        assertEquals(instance.getVector().getCoordinate("foo"), instanceCopy.getCoordinate("foo"), 0.0);
        assertEquals(instance.getVector().getCoordinate("bar"), instanceCopy.getCoordinate("bar"), 0.0);
    }
View Full Code Here

Examples of com.etsy.conjecture.data.BinaryLabeledInstance

    public void update(LabeledInstance<MulticlassLabel> instance) {
        for (Map.Entry<String, UpdateableLinearModel<BinaryLabel>> e : param.entrySet()) {
            String category = e.getKey();
            UpdateableLinearModel<BinaryLabel> model = e.getValue();
            double label = e.getKey().equals(instance.getLabel().getLabel()) ? 1.0 : 0.0;
            BinaryLabeledInstance blInstance = new BinaryLabeledInstance(label, instance.getVector());
            model.update(blInstance);
        }
        epoch++;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.