Package ca.uwo.csd.ai.nlp.libsvm

Examples of ca.uwo.csd.ai.nlp.libsvm.svm_problem


    private static svm_problem prepareProblem(Instance[] instances) {
        return prepareProblem(instances, 0, instances.length - 1);
    }
   
    private static svm_problem prepareProblem(Instance[] instances, int begin, int end) {
        svm_problem prob = new svm_problem();
        prob.l = (end - begin) + 1;
        prob.y = new double[prob.l];
        prob.x = new svm_node[prob.l];
       
        for (int i = begin; i <= end; i++) {
View Full Code Here


     * @param param
     * @return
     */
    public static svm_model train(Instance[] instances, svm_parameter param) {
        //prepare svm_problem
        svm_problem prob = prepareProblem(instances);
       
        String error_msg = svm.svm_check_parameter(prob, param);

        if (error_msg != null) {
            System.err.print("ERROR: " + error_msg + "\n");
View Full Code Here

     * @param param parameters
     * @param nr_fold number of folds (N)
     * @param binary whether doing binary classification
     */
    public static void doCrossValidation(Instance[] instances, svm_parameter param, int nr_fold, boolean binary) {
        svm_problem prob = prepareProblem(instances);
       
        int i;
        int total_correct = 0;
        double total_error = 0;
        double sumv = 0, sumy = 0, sumvv = 0, sumyy = 0, sumvy = 0;
View Full Code Here

TOP

Related Classes of ca.uwo.csd.ai.nlp.libsvm.svm_problem

Copyright © 2018 www.massapicom. 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.