Tabnine Logo
weka.classifiers
Code IndexAdd Tabnine to your IDE (free)

How to use weka.classifiers

Best Java code snippets using weka.classifiers (Showing top 20 results out of 324)

origin: stackoverflow.com

 Classifier cModel = (Classifier)new NaiveBayes();  
cModel.buildClassifier(isTrainingSet);  

weka.core.SerializationHelper.write("/some/where/nBayes.model", cModel);

Classifier cls = (Classifier) weka.core.SerializationHelper.read("/some/where/nBayes.model");

// Test the model
Evaluation eTest = new Evaluation(isTrainingSet);
eTest.evaluateModel(cls, isTrainingSet);
origin: stackoverflow.com

 //load model
String rootPath="/some/where/"; 
Classifier cls = (Classifier) weka.core.SerializationHelper.read(rootPath+"tree.model");

//predict instance class values
Instances originalTrain= //load or create Instances to predict

//which instance to predict class value
int s1=0;  

//perform your prediction
double value=cls.classifyInstance(originalTrain.instance(s1));

//get the name of the class value
String prediction=originalTrain.classAttribute().value((int)value); 

System.out.println("The predicted value of instance "+
          Integer.toString(s1)+
          ": "+prediction);
origin: droidefense/engine

public Evaluation classify(Classifier model, Instances trainingSet, Instances testingSet) throws Exception {
  Evaluation evaluation = new Evaluation(trainingSet);
  model.buildClassifier(trainingSet);
  evaluation.evaluateModel(model, testingSet);
  return evaluation;
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Calculates the class membership probabilities for the given test
 * instance.
 *
 * @param instance     the instance to be classified
 * @return         preedicted class probability distribution
 * @throws Exception     if distribution can't be computed successfully
 */
public double[] distributionForInstance(Instance instance) throws Exception {
 return m_Classifier.distributionForInstance(instance);
}
origin: nz.ac.waikato.cms.weka/discriminantAnalysis

/**
 * configures the CheckClassifier instance used throughout the tests
 * 
 * @return    the fully configured CheckClassifier instance used for testing
 */
protected CheckClassifier getTester() {
 CheckClassifier     result;
 
 result = super.getTester();
 result.setNumInstances(40);
 
 return result;
}
origin: nz.ac.waikato.cms.weka/weka-stable

private boolean replaceStrings(Instances dataset) throws Exception {
 boolean nonDouble = false;
 for (int i = 0; i < m_size; i++) {
  for (int j = 0; j < m_size; j++) {
   if (getCell(i, j) instanceof String) {
    setCell(i, j, new InstanceExpression((String) getCell(i, j), dataset));
    nonDouble = true;
   } else if (getCell(i, j) instanceof InstanceExpression) {
    nonDouble = true;
   }
  }
 }
 return nonDouble;
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * tests whether the scheme declares a serialVersionUID.
 */
public void testSerialVersionUID() {
 boolean[] result;
 result = m_Tester.declaresSerialVersionUID();
 if (!result[0]) {
  fail("Doesn't declare serialVersionUID!");
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * tests whether the toString method of the classifier works even though the
 * classifier hasn't been built yet.
 */
public void testToString() {
 boolean[] result;
 result = m_Tester.testToString();
 if (!result[0]) {
  fail("Error in toString() method!");
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * returns a custom PostProcessor for the CheckClassifier datasets..
 * 
 * @return        a custom PostProcessor
 * @see AbsPostProcessor
 */
protected PostProcessor getPostProcessor() {
 return new AbsPostProcessor();
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Same as size
 * 
 * @return the number of rows
 */
public int numRows() {
 return size();
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * returns a string for the class type
 * 
 * @param type the class type
 * @return the class type as string
 */
protected String getClassTypeString(int type) {
 return CheckClassifier.attributeTypeToString(type);
}
origin: net.sf.meka/meka

/**
 * Returns the distribution for the given instance.
 *
 * @param instance     the test instance
 * @return         the distribution array
 * @throws Exception     if distribution can't be computed successfully
 */
@Override
public double[] distributionForInstance(Instance instance) throws Exception {
  return m_Classifier.distributionForInstance(instance);
}
origin: nz.ac.waikato.cms.weka/discriminantAnalysis

/**
 * configures the CheckClassifier instance used throughout the tests
 * 
 * @return    the fully configured CheckClassifier instance used for testing
 */
protected CheckClassifier getTester() {
 CheckClassifier     result;
 
 result = super.getTester();
 result.setNumInstances(40);
 
 return result;
}
origin: Waikato/weka-trunk

/**
 * tests whether the scheme declares a serialVersionUID.
 */
public void testSerialVersionUID() {
 boolean[] result;
 result = m_Tester.declaresSerialVersionUID();
 if (!result[0]) {
  fail("Doesn't declare serialVersionUID!");
 }
}
origin: Waikato/weka-trunk

/**
 * tests whether the toString method of the classifier works even though the
 * classifier hasn't been built yet.
 */
public void testToString() {
 boolean[] result;
 result = m_Tester.testToString();
 if (!result[0]) {
  fail("Error in toString() method!");
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * returns a custom PostProcessor for the CheckClassifier datasets..
 * 
 * @return        a custom PostProcessor
 * @see AbsPostProcessor
 */
protected PostProcessor getPostProcessor() {
 return new AbsPostProcessor();
}
origin: Waikato/meka

/**
 * Returns the distribution for the given instance.
 *
 * @param instance     the test instance
 * @return         the distribution array
 * @throws Exception     if distribution can't be computed successfully
 */
@Override
public double[] distributionForInstance(Instance instance) throws Exception {
  return m_Classifier.distributionForInstance(instance);
}
origin: nz.ac.waikato.cms.weka/paceRegression

/**
 * configures the CheckClassifier instance used throughout the tests
 * 
 * @return    the fully configured CheckClassifier instance used for testing
 */
protected CheckClassifier getTester() {
 CheckClassifier     result;
 
 result = super.getTester();
 result.setNumInstances(60);
 
 return result;
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * returns a custom PostProcessor for the CheckClassifier datasets..
 * 
 * @return        a custom PostProcessor
 * @see AbsPostProcessor
 */
protected PostProcessor getPostProcessor() {
 return new AbsPostProcessor();
}
origin: nz.ac.waikato.cms.weka/discriminantAnalysis

/**
 * configures the CheckClassifier instance used throughout the tests
 * 
 * @return    the fully configured CheckClassifier instance used for testing
 */
protected CheckClassifier getTester() {
 CheckClassifier     result;
 
 result = super.getTester();
 result.setNumInstances(40);
 
 return result;
}
weka.classifiers

Most used classes

  • Classifier
    Classifier interface. All schemes for numeric or nominal prediction in Weka implement this interface
  • AbstractClassifier
    Abstract classifier. All schemes for numeric or nominal prediction in Weka extend this class. Note t
  • Evaluation
    Class for evaluating machine learning models. -----------------------------------------------------
  • J48
    Class for generating a pruned or unpruned C4.5 decision tree. For more information, see Ross Quinl
  • NaiveBayes
    Class for a Naive Bayes classifier using estimator classes. Numeric estimator precision values are
  • Logistic,
  • SMO,
  • ZeroR,
  • Evaluation,
  • CheckClassifier,
  • NominalPrediction,
  • LinearRegression,
  • MultilayerPerceptron,
  • IBk,
  • Bagging,
  • RandomizableClassifier,
  • SingleClassifierEnhancer,
  • UpdateableClassifier,
  • NaiveBayesUpdateable
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now