Examples of buildClassifier()


Examples of weka.classifiers.bayes.BayesNet.buildClassifier()

        BayesNet EmptyNet = new BayesNet();
        K2 oSearchAlgorithm = new K2();
        oSearchAlgorithm.setInitAsNaiveBayes(false);
        oSearchAlgorithm.setMaxNrOfParents(0);
        EmptyNet.setSearchAlgorithm(oSearchAlgorithm);
        EmptyNet.buildClassifier(instances);

        BayesNet NBNet = new BayesNet();
        oSearchAlgorithm.setInitAsNaiveBayes(true);
        oSearchAlgorithm.setMaxNrOfParents(1);
        NBNet.setSearchAlgorithm(oSearchAlgorithm);
View Full Code Here

Examples of weka.classifiers.bayes.BayesNet.buildClassifier()

        BayesNet NBNet = new BayesNet();
        oSearchAlgorithm.setInitAsNaiveBayes(true);
        oSearchAlgorithm.setMaxNrOfParents(1);
        NBNet.setSearchAlgorithm(oSearchAlgorithm);
        NBNet.buildClassifier(instances);

        // estimate CPTs
        for (int iAttribute = 0; iAttribute < instances.numAttributes(); iAttribute++) {
            if (iAttribute != instances.classIndex()) {
                  double w1 = 0.0, w2 = 0.0;
View Full Code Here

Examples of weka.classifiers.bayes.BayesNet.buildClassifier()

    try {
      BayesNet b = new BayesNet();
      b.setSearchAlgorithm( new ICSSearchAlgorithm());
      Instances instances = new Instances(new FileReader("C:\\eclipse\\workspace\\weka\\data\\contact-lenses.arff"));
      instances.setClassIndex(instances.numAttributes() - 1);
      b.buildClassifier(instances);
      System.out.println(b.toString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  } // main
View Full Code Here

Examples of weka.classifiers.bayes.NaiveBayesUpdateable.buildClassifier()

   */
  public void trainNaiveBayes(Instances data) {
      NaiveBayesUpdateable nb = new NaiveBayesUpdateable();
     
      try {
      nb.buildClassifier(data);
    } catch (Exception e) {
      e.printStackTrace();
    }
   
      for( int n = 0; n < data.size(); n++ ) {
View Full Code Here

Examples of weka.classifiers.bayes.NaiveBayesUpdateable.buildClassifier()

  trainingSets[i] = Filter.useFilter(trainingSets[i], disc);

  trainingSets[i].randomize(r);
  trainingSets[i].stratify(5);
  NaiveBayesUpdateable fullModel = new NaiveBayesUpdateable();
  fullModel.buildClassifier(trainingSets[i]);

  // add the errors for this branch of the split
  m_errors += NBTreeNoSplit.crossValidate(fullModel, trainingSets[i], r);
      } else {
  // if fewer than min obj then just count them as errors
View Full Code Here

Examples of weka.classifiers.bayes.NaiveBayesUpdateable.buildClassifier()

  trainingSets[i] = Filter.useFilter(trainingSets[i], disc);

  trainingSets[i].randomize(r);
  trainingSets[i].stratify(5);
  NaiveBayesUpdateable fullModel = new NaiveBayesUpdateable();
  fullModel.buildClassifier(trainingSets[i]);

  // add the errors for this branch of the split
  m_errors += NBTreeNoSplit.crossValidate(fullModel, trainingSets[i], r);
      } else {
  for (int j = 0; j < trainingSets[i].numInstances(); j++) {
View Full Code Here

Examples of weka.classifiers.functions.LibSVM.buildClassifier()

    public void train(ArrayList<LinkedHashMap<Integer, Double>> trainingSamples, ArrayList<Integer> labels, int maxNumFeats) {
        Instances trainingSet = fillDataSet(trainingSamples, labels, maxNumFeats);

        LibSVM cModel = new LibSVM();
        try {
            cModel.buildClassifier(trainingSet);
            saveTheModel(cModel, maxNumFeats);
            ArffSaver saver = new ArffSaver();
            saver.setInstances(trainingSet);
            saver.setFile(new File(PropertiesGetter.getProperty("TrainingDataSetObject")));
            saver.writeBatch();
View Full Code Here

Examples of weka.classifiers.functions.LinearRegression.buildClassifier()

    reducedInst = Filter.useFilter(reducedInst, attributeFilter);
   
    // build a linear regression for the training data using the
    // tested attributes
    LinearRegression temp = new LinearRegression();
    temp.buildClassifier(reducedInst);

    double [] lmCoeffs = temp.coefficients();
    double [] coeffs = new double [m_instances.numAttributes()];

    for (int i = 0; i < lmCoeffs.length - 1; i++) {
View Full Code Here

Examples of weka.classifiers.functions.MultilayerPerceptron.buildClassifier()

    // System.out.println(" Structure: " + structure);
     structure.setClassIndex(structure.numAttributes() - 1);
    
     // train NaiveBayes
     MultilayerPerceptron nn = new MultilayerPerceptron();
     nn.buildClassifier(structure);
    
     System.out.println(" Perceptron created1: " + nn);
    
     Attribute att;
     Instance newInstance = new DenseInstance(structure.numAttributes());
View Full Code Here

Examples of weka.classifiers.functions.SMO.buildClassifier()

      smo.setC(1.0); //same as default value for jkms
      RBFKernel rbf = new RBFKernel();
      rbf.setGamma(0.1); //same as default value for jkms
      smo.setKernel(rbf);
     
      smo.buildClassifier(train);
     
     
      Evaluation eval = new Evaluation(train);
      eval.evaluateModel(smo, test);
     
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.