weka.classifiers.trees.J48.setOptions()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中weka.classifiers.trees.J48.setOptions()方法的一些代码示例,展示了J48.setOptions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。J48.setOptions()方法的具体详情如下:
包路径:weka.classifiers.trees.J48
类名称:J48
方法名:setOptions

J48.setOptions介绍

[英]Parses a given list of options. Valid options are:

-U 
Use unpruned tree.
-O 
Do not collapse tree.
-C <pruning confidence> 
Set confidence threshold for pruning. 
(default 0.25)
-M <minimum number of instances> 
Set minimum number of instances per leaf. 
(default 2)
-R 
Use reduced error pruning.
-N <number of folds> 
Set number of folds for reduced error 
pruning. One fold is used as pruning set. 
(default 3)
-B 
Use binary splits only.
-S 
Don't perform subtree raising.
-L 
Do not clean up after the tree has been built.
-A 
Laplace smoothing for predicted probabilities.
-J 
Do not use MDL correction for info gain on numeric attributes.
-Q <seed> 
Seed for random data shuffling (default 1).
-doNotMakeSplitPointActualValue 
Do not make split point actual value.

[中]解析给定的选项列表。有效选项包括:

-U 
Use unpruned tree.
-O 
Do not collapse tree.
-C <pruning confidence> 
Set confidence threshold for pruning. 
(default 0.25)
-M <minimum number of instances> 
Set minimum number of instances per leaf. 
(default 2)
-R 
Use reduced error pruning.
-N <number of folds> 
Set number of folds for reduced error 
pruning. One fold is used as pruning set. 
(default 3)
-B 
Use binary splits only.
-S 
Don't perform subtree raising.
-L 
Do not clean up after the tree has been built.
-A 
Laplace smoothing for predicted probabilities.
-J 
Do not use MDL correction for info gain on numeric attributes.
-Q <seed> 
Seed for random data shuffling (default 1).
-doNotMakeSplitPointActualValue 
Do not make split point actual value.

代码示例

代码示例来源:origin: org.dkpro.similarity/dkpro-similarity-algorithms-ml-gpl

public static Classifier getClassifier(WekaClassifier classifier)
  throws IllegalArgumentException
{
  try {
    switch (classifier)
    {
      case NAIVE_BAYES:
        return new NaiveBayes();
      case J48:
        J48 j48 = new J48();			
        j48.setOptions(new String[] { "-C", "0.25", "-M", "2" });
        return j48;
      case SMO:
        SMO smo = new SMO();
        smo.setOptions(Utils.splitOptions("-C 1.0 -L 0.001 -P 1.0E-12 -N 0 -V -1 -W 1 -K \"weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0\""));
        return smo;
      case LOGISTIC:
        Logistic logistic = new Logistic();
        logistic.setOptions(Utils.splitOptions("-R 1.0E-8 -M -1"));
        return logistic;
      default:
        throw new IllegalArgumentException("Classifier " + classifier + " not found!");
    }
  }
  catch (Exception e) {
    throw new IllegalArgumentException(e);
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.similarity.algorithms/de.tudarmstadt.ukp.similarity.algorithms.ml-asl

public static Classifier getClassifier(WekaClassifier classifier)
  throws IllegalArgumentException
{
  try {
    switch (classifier)
    {
      case NAIVE_BAYES:
        return new NaiveBayes();
      case J48:
        J48 j48 = new J48();			
        j48.setOptions(new String[] { "-C", "0.25", "-M", "2" });
        return j48;
      case SMO:
        SMO smo = new SMO();
        smo.setOptions(Utils.splitOptions("-C 1.0 -L 0.001 -P 1.0E-12 -N 0 -V -1 -W 1 -K \"weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0\""));
        return smo;
      case LOGISTIC:
        Logistic logistic = new Logistic();
        logistic.setOptions(Utils.splitOptions("-R 1.0E-8 -M -1"));
        return logistic;
      default:
        throw new IllegalArgumentException("Classifier " + classifier + " not found!");
    }
  }
  catch (Exception e) {
    throw new IllegalArgumentException(e);
  }
}

代码示例来源:origin: dkpro/dkpro-similarity

public static Classifier getClassifier(WekaClassifier classifier)
  throws IllegalArgumentException
{
  try {
    switch (classifier)
    {
      case NAIVE_BAYES:
        return new NaiveBayes();
      case J48:
        J48 j48 = new J48();			
        j48.setOptions(new String[] { "-C", "0.25", "-M", "2" });
        return j48;
      case SMO:
        SMO smo = new SMO();
        smo.setOptions(Utils.splitOptions("-C 1.0 -L 0.001 -P 1.0E-12 -N 0 -V -1 -W 1 -K \"weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0\""));
        return smo;
      case LOGISTIC:
        Logistic logistic = new Logistic();
        logistic.setOptions(Utils.splitOptions("-R 1.0E-8 -M -1"));
        return logistic;
      default:
        throw new IllegalArgumentException("Classifier " + classifier + " not found!");
    }
  }
  catch (Exception e) {
    throw new IllegalArgumentException(e);
  }
}

相关文章