Examples of minimize()


Examples of dk.brics.automaton.Automaton.minimize()

            }
        }
        result.restoreInvariant(); // accept states have been modified
        result.addEpsilons(epsilons);
        result.determinize();
        result.minimize();
        return result;
    }
   
    /**
     * Returns an automaton accepting all characters considered digits by {@link Character#isDigit(char)}.
View Full Code Here

Examples of dk.brics.automaton.Automaton.minimize()

        for (State s : b.getStates()) {
            epsilons.add(new StatePair(initial, s));
        }
        b.setInitialState(initial);
        b.addEpsilons(epsilons);
        b.minimize();
        return b;
    }

    @Override
    public String toString() {
View Full Code Here

Examples of dk.brics.automaton.Automaton.minimize()

                }
            }
        }
        b.setDeterministic(false);
        b.reduce();
        b.minimize();
        return b;
    }

    @Override
    public String toString() {
View Full Code Here

Examples of dk.brics.automaton.Automaton.minimize()

        for (State s : a1s) {
            for (Transition t : map.get(s).getTransitions()) {
                s.addTransition(new Transition(Character.MIN_VALUE, Character.MAX_VALUE, t.getDest()));
            }
        }
        a1.minimize();
        return a1;
    }

    @Override
    public String toString() {
View Full Code Here

Examples of edu.stanford.nlp.optimization.GoldenSectionLineSearch.minimize()

   * problems.
   */
  public void adjustBias(List<List<IN>> develData, Function<Double,Double> evalFunction, double low, double high) {
    LineSearcher ls = new GoldenSectionLineSearch(true,1e-2,low,high);
    CRFBiasedClassifierOptimizer optimizer = new CRFBiasedClassifierOptimizer(this, evalFunction);
    double optVal = ls.minimize(optimizer);
    int bi = featureIndex.indexOf(BIAS);
    System.err.println("Class bias of "+weights[bi][0]+" reaches optimal value "+optVal);
  }

  /** The main method, which is essentially the same as in CRFClassifier. See the class documentation. */
 
View Full Code Here

Examples of edu.stanford.nlp.optimization.GoldenSectionLineSearch.minimize()

      System.err.printf(": %8g%n", sumScore);
      return sumScore;
    };

    GoldenSectionLineSearch gsls = new GoldenSectionLineSearch(true);
    sigma = gsls.minimize(CVSigmaToPerplexity, 0.01, 0.0001, 2.0);
    System.out.println("Sigma used: " + sigma);
  }

  /**
   * Create a ClassifierFactory.
View Full Code Here

Examples of edu.stanford.nlp.optimization.LineSearcher.minimize()

   * problems.
   */
  public void adjustBias(List<List<IN>> develData, Function<Double,Double> evalFunction, double low, double high) {
    LineSearcher ls = new GoldenSectionLineSearch(true,1e-2,low,high);
    CRFBiasedClassifierOptimizer optimizer = new CRFBiasedClassifierOptimizer(this, evalFunction);
    double optVal = ls.minimize(optimizer);
    int bi = featureIndex.indexOf(BIAS);
    System.err.println("Class bias of "+weights[bi][0]+" reaches optimal value "+optVal);
  }

  /** The main method, which is essentially the same as in CRFClassifier. See the class documentation. */
 
View Full Code Here

Examples of edu.stanford.nlp.optimization.QNMinimizer.minimize()

      qn.useDiagonalScaling();
      qn.terminateOnAverageImprovement(true);
      qn.terminateOnNumericalZero(true);
      qn.terminateOnRelativeNorm(true);

      theta = qn.minimize(gcFunc, op.trainOptions.qnTolerance, theta, op.trainOptions.qnIterationsPerBatch);
      break;
    }
    case 2:{
      //Minimizer smd = new SGDMinimizer();      double tol = 1e-4;      theta = smd.minimize(gcFunc,tol,theta,op.trainOptions.qnIterationsPerBatch);
      double lastCost = 0, currCost = 0;
View Full Code Here

Examples of edu.stanford.nlp.optimization.QNMinimizer.minimize()

    }
    int totalFeatures = sumValues[numFeatures - 1] + numValues[numFeatures - 1] + 1;
    System.err.println("total feats " + totalFeatures);
    LogConditionalObjectiveFunction<L, F> objective = new LogConditionalObjectiveFunction<L, F>(totalFeatures, numClasses, newdata, labels, prior, sigma, 0.0);
    Minimizer<DiffFunction> min = new QNMinimizer();
    double[] argmin = min.minimize(objective, 1e-4, objective.initial());
    double[][] wts = objective.to2D(argmin);
    System.out.println("weights have dimension " + wts.length);
    return new NBWeights(wts, numValues);
  }
View Full Code Here

Examples of edu.stanford.nlp.optimization.QNMinimizer.minimize()

  private NBWeights trainWeightsCL(int[][] data, int[] labels, int numFeatures, int numClasses) {

    LogConditionalEqConstraintFunction objective = new LogConditionalEqConstraintFunction(numFeatures, numClasses, data, labels, prior, sigma, 0.0);
    Minimizer<DiffFunction> min = new QNMinimizer();
    double[] argmin = min.minimize(objective, 1e-4, objective.initial());
    double[][][] wts = objective.to3D(argmin);
    double[] priors = objective.priors(argmin);
    return new NBWeights(priors, wts);
  }
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.