coser.classifiers.trees
类 BuildAndTestTree

java.lang.Object
  继承者 coser.classifiers.trees.BuildAndTestTree

public class BuildAndTestTree
extends java.lang.Object

构造并且测试决策树。执行不同的算法。
Summary: Build and test decision tree. Run different algorithms.

Author: Fan Min minfanphd@163.com
Copyright: The source code and all documents are open and free. PLEASE keep this header while revising the program.
Organization: Lab of Granular Computing, Zhangzhou Normal University, Fujian 363000, China.
Project: The cost-sensitive rough sets project.

Progress: Half done.
Written time: November 5, 2011.
Last modify time: January 27, 2012.


字段摘要
修饰符 和 类型 字段 和 描述
(专用软件包)  int[] algorithmsWinArray
          All lambda settings, cost-gain, and best training approach.
(专用软件包)  boolean comparePruneStrategies
          Compare different prune strategies or not.
(专用软件包)  boolean compareWithBalance
          Balance or not.
(专用软件包)  double costInTrainingSet
          The average cost in training set.
(专用软件包)  int cvFolds
          Number of folds for cross-validation.
(专用软件包)  double[] misclassificationCostSumArray
          If all algorithms, these elements correspond with no prune, preprune, postprune.
(专用软件包)  int numberOfLambdas
          Number of lambda.
(专用软件包)  int numberOfOmegas
          Number of omega.
(专用软件包)  int numberOfSchemes
          For different lambdas, cost-gain and competition approaches.
(专用软件包)  int testStrategy
          Test strategy, use training set, split-in-two, or cross-validation.
(专用软件包)  double trainingPercentage
          The percentage of the training.
 
构造方法摘要
构造函数 和 描述
BuildAndTestTree(BothCostsNominalDecisionSystem paraSystem, double paraTrainingPercentage, int paraTestStrategy, int paraNumberOfLambdas, int paraNumberOfOmegas, int paraCvFolds, boolean paraCompareWithBalance, boolean paraComparePruneStrategies)
          The only constructor.
 
方法摘要
修饰符 和 类型 方法 和 描述
 int[] getAlgorithmWinsArray()
          Get the algorithm wins array.
 double[] getCostSumArray()
          Get the cost sum array.
 java.lang.String oneRunAllAlgorithms(double paraLambdaLowerBound, double paraLambdaStepLength, double paraOmegaLowerBound, double paraOmegaLength, int paraPruneStrategy)
          One run, compare all lambda settings.
 double oneRunCV(int paraAlgorithm, double paraLambda, int paraPruneStrategy, boolean paraBalance)
          One run, cross-validation.
 java.lang.String oneRunPruneCompare(double paraLambdaLowerBound, double paraLambdaUpperBound, double paraLambdaStepLength, boolean paraBalance)
          One run, compare prune strategies.
 double oneRunSplitInTwo(int paraAlgorithm, double paraLambda, int paraPruneStrategy, boolean paraBalance)
          One run, split in two.
 double oneRunTrainingSet(int paraAlgorithm, double paraLambda, int paraPruneStrategy, boolean paraBalance)
          One run, test on the training set.
 void refreshTestCost()
          Refresh test cost.
 void refreshTrainingTestingSets()
          Refresh the training test set.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

trainingPercentage

double trainingPercentage
The percentage of the training. Used in the split-in-two scenario.
训练集的百分比。用于两分法。


testStrategy

int testStrategy
Test strategy, use training set, split-in-two, or cross-validation.
测试策略(使用训练集、两分法、交叉验证)


cvFolds

int cvFolds
Number of folds for cross-validation.
交叉验证的折数


costInTrainingSet

double costInTrainingSet
The average cost in training set. Only for the split-in-two scenario.
训练集的平均代价。仅仅用于两分法的时候。


misclassificationCostSumArray

double[] misclassificationCostSumArray
If all algorithms, these elements correspond with no prune, preprune, postprune. If only the weighted information gain algorithm, these elements correspond with different lambda values.
如果所有算法,这些元素对应无剪枝,预剪枝,后剪枝。如果仅仅是加权信息增益算法,这些元素对应于不同的兰布达值。


algorithmsWinArray

int[] algorithmsWinArray
All lambda settings, cost-gain, and best training approach.
所有兰布达值设置,代价增益和最优训练方法。


numberOfLambdas

int numberOfLambdas
Number of lambda.
兰布达值的个数


numberOfOmegas

int numberOfOmegas
Number of omega.
欧米伽值的个数


compareWithBalance

boolean compareWithBalance
Balance or not. When it is true, both appraoch will be tested.
平衡或者不是。当它为真的时候,两种方法都将被测试。


comparePruneStrategies

boolean comparePruneStrategies
Compare different prune strategies or not.
比较不同剪枝策略或者不。


numberOfSchemes

int numberOfSchemes
For different lambdas, cost-gain and competition approaches.
对于不同的兰布达值,代价增益和竞争方法。

构造方法详细信息

BuildAndTestTree

public BuildAndTestTree(BothCostsNominalDecisionSystem paraSystem,
                        double paraTrainingPercentage,
                        int paraTestStrategy,
                        int paraNumberOfLambdas,
                        int paraNumberOfOmegas,
                        int paraCvFolds,
                        boolean paraCompareWithBalance,
                        boolean paraComparePruneStrategies)
The only constructor. 构造方法

参数:
paraSystem - The BothCostsNominalDecisionSystem 测试代价和误分类代价决策系统
paraTrainingPercentage - The percentage of the training set. 训练集百分比
paraTestStrategy - The strategy of the test. 测试策略
paraNumberOfLambdas - The number of lambda values. 兰布达值的个数
paraNumberOfOmegas - The number of omega values. 欧米伽值的个数
paraCvFolds - The folds of cross validation. 交叉验证的折数
paraCompareWithBalance - 平衡或者不是。当它为真的时候,两种方法都将被测试。
方法详细信息

refreshTestCost

public void refreshTestCost()
                     throws java.lang.Exception
Refresh test cost.

抛出:
java.lang.Exception

getCostSumArray

public double[] getCostSumArray()
Get the cost sum array.
获得代价总和数组


getAlgorithmWinsArray

public int[] getAlgorithmWinsArray()
Get the algorithm wins array.
获得算法取胜次数数组


oneRunAllAlgorithms

public java.lang.String oneRunAllAlgorithms(double paraLambdaLowerBound,
                                            double paraLambdaStepLength,
                                            double paraOmegaLowerBound,
                                            double paraOmegaLength,
                                            int paraPruneStrategy)
                                     throws java.lang.Exception
One run, compare all lambda settings. Also compare different algorthms.
一次运行,比较所有兰布达设置。同时也比较不同算法。

参数:
paraLambdaLowerBound - The lower bound of lambda values 兰布达值的下界
paraLambdaStepLength - The step length of lambda values 兰布达值的步长
paraOmegaLowerBound - The lower bound of omega values 欧米伽值的下界
paraOmegaLength - The step length of omega values 欧米伽值的步长
paraPruneStrategy - The strategy of pruning tree 决策树剪枝策略
抛出:
java.lang.Exception

oneRunPruneCompare

public java.lang.String oneRunPruneCompare(double paraLambdaLowerBound,
                                           double paraLambdaUpperBound,
                                           double paraLambdaStepLength,
                                           boolean paraBalance)
                                    throws java.lang.Exception
One run, compare prune strategies.
一次运行,比较剪枝策略

抛出:
java.lang.Exception

oneRunTrainingSet

public double oneRunTrainingSet(int paraAlgorithm,
                                double paraLambda,
                                int paraPruneStrategy,
                                boolean paraBalance)
                         throws java.lang.Exception
One run, test on the training set.
一次运行,在训练集上测试

返回:
the average cost.
抛出:
java.lang.Exception

refreshTrainingTestingSets

public void refreshTrainingTestingSets()
                                throws java.lang.Exception
Refresh the training test set. Only for split in two scenario.
刷新训练测试集。仅仅对于两分法。

抛出:
java.lang.Exception

oneRunSplitInTwo

public double oneRunSplitInTwo(int paraAlgorithm,
                               double paraLambda,
                               int paraPruneStrategy,
                               boolean paraBalance)
                        throws java.lang.Exception
One run, split in two.
一次运行,划分成两部分

返回:
the average cost.
抛出:
java.lang.Exception

oneRunCV

public double oneRunCV(int paraAlgorithm,
                       double paraLambda,
                       int paraPruneStrategy,
                       boolean paraBalance)
                throws java.lang.Exception
One run, cross-validation.
一次运行,交叉验证

返回:
the average cost.
抛出:
java.lang.Exception