Examples of calc()


Examples of org.fnlp.ml.loss.Loss.calc()

    for (int i = 0; i < testSet.size(); i++) {
      Instance carrier = testSet.get(i);
      int[] pred = (int[]) cl.classify(carrier).getLabel(0);
      if (acc) {
        len += pred.length;
        double e = loss.calc(carrier.getTarget(), pred);
        error += e;
        if(e != 0)
          senError++;
        //测试中英混杂语料
        if(hasENG) {
View Full Code Here

Examples of org.fnlp.ml.loss.struct.HammingLoss.calc()

    for (int i = 0; i < testSet.size(); i++) {
      Instance carrier = testSet.get(i);
      int[] pred = (int[]) cl.classify(carrier).getLabel(0);
      if (hasLabel) {
        len += pred.length;
        float e = loss.calc(carrier.getTarget(), pred);
        error += e;
        if(e != 0)
          senError++;

      }
View Full Code Here

Examples of org.fnlp.ml.loss.struct.HammingLoss.calc()

    for (int i = 0; i < testSet.size(); i++) {
      Instance carrier = testSet.get(i);
      int[] pred = (int[]) cl.classify(carrier).getLabel(0);
      if (acc) {
        len += pred.length;
        double e = loss.calc(carrier.getTarget(), pred);
        error += e;
        if(e != 0)
          senError++;
        //测试中英混杂语料
        if(hasENG) {
View Full Code Here

Examples of org.fnlp.ml.loss.struct.HammingLoss.calc()

    for (int i = 0; i < testSet.size(); i++) {
      Instance carrier = testSet.get(i);
      int[] pred = (int[]) cl.classify(carrier).getLabel(0);
      if (acc) {
        len += pred.length;
        double e = loss.calc(carrier.getTarget(), pred);
        error += e;
        if(e != 0)
          senError++;
        //测试中英混杂语料
        if(hasENG) {
View Full Code Here

Examples of org.jamesii.core.math.parsetree.BinaryNode.calc()

  }

  @Override
  public void testCalc() {
    BinaryNode node = new MinusNode(new ValueNode<>(2.), new ValueNode<>(1.));
    ValueNode<Double> res = node.calc(null);
    assertTrue(res.getValue().compareTo(1.) == 0);

    node = new MinusNode(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Integer> res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(1) == 0);
View Full Code Here

Examples of org.jamesii.core.math.parsetree.BinaryNode.calc()

    BinaryNode node = new MinusNode(new ValueNode<>(2.), new ValueNode<>(1.));
    ValueNode<Double> res = node.calc(null);
    assertTrue(res.getValue().compareTo(1.) == 0);

    node = new MinusNode(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Integer> res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(1) == 0);

    node = getInstance(new ValueNode<>(2), new ValueNode<>(3.));
    ValueNode<Double> res3 = node.calc(null);
    assertTrue(res3.getValue().compareTo(-1.) == 0);
View Full Code Here

Examples of org.jamesii.core.math.parsetree.BinaryNode.calc()

    node = new MinusNode(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Integer> res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(1) == 0);

    node = getInstance(new ValueNode<>(2), new ValueNode<>(3.));
    ValueNode<Double> res3 = node.calc(null);
    assertTrue(res3.getValue().compareTo(-1.) == 0);

    node =
        getInstance(getInstance(new ValueNode<>(1), new ValueNode<>(3.)),
            getInstance(new ValueNode<>(2), new ValueNode<>(3.)));
View Full Code Here

Examples of org.jamesii.core.math.parsetree.BinaryNode.calc()

    assertTrue(res3.getValue().compareTo(-1.) == 0);

    node =
        getInstance(getInstance(new ValueNode<>(1), new ValueNode<>(3.)),
            getInstance(new ValueNode<>(2), new ValueNode<>(3.)));
    ValueNode<Double> res4 = node.calc(null);
    assertTrue(res4.getValue().compareTo(-1.) == 0);

  }

}
View Full Code Here

Examples of org.jamesii.core.math.parsetree.INode.calc()

        return (N) p.getSecondValue().calc(cEnv);
      }
    }

    if (defaultExpr != null) {
      return (N) defaultExpr.calc(cEnv);
    }

    return null;
  }
View Full Code Here

Examples of org.jamesii.core.math.parsetree.INode.calc()

    node = getInstance(getA(3));
    ValueNode<Double> res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(Math.sinh(1.)) == 0);

    node = getInstance(getA(4));
    res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(Math.sinh(-1.)) == 0);

    node = getInstance(getA(5));
    res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(Math.sinh(0.)) == 0);
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.