|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | ||||||||
java.lang.ObjectId3
coser.classifiers.trees.CostSensitiveDecisionTree
public class CostSensitiveDecisionTree extends Id3
构造一个代价敏感决策树。从Id3.java中复制并修改而来。
Summary: Build a decision tree for a cost sensitive decision system. Modified
from Id3.java
Author: Fan Min minfanphd@163.com
For more information of the data model please refer to our papers:
\@ARTICLE{MinZhu2012Induction,
author = {Fan Min and William Zhu},
title = {Induction of cost-time-sensitive decision trees},
journal = {submitted to RSKT 2012},
year = {2012}
}
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 28, 2011.
| 修饰符 和 类型 | 字段 和 描述 |
|---|---|
protected double |
accuracy
The accuracy after classification. |
static int |
ALL_ALGORITHMS
The weighted test cost algorithm. |
protected double |
averageCost
The average cost after classfication. |
protected boolean |
balance
Whether or not balance according to the misclassification matrix. |
static int |
COST_GAIN
The cost gain algorithm. |
static int |
EXPONENTIAL_GAIN
The power information gain algorithm. |
protected double |
maximalCostGain
The maximal cost gain. |
static int |
NO_PRUNE
No prune. |
static int |
POST_PRUNE
Postprune. |
static int |
PRE_PRUNE
Preprune. |
static long |
serialVersionUID
For serialization |
static int |
WEIGHTED_GAIN
The weighted test cost algorithm. |
| 构造函数 和 描述 |
|---|
CostSensitiveDecisionTree(BothCostsNominalDecisionSystem paraDs,
boolean paraBalance)
Construct the object. |
| 修饰符 和 类型 | 方法 和 描述 |
|---|---|
void |
buildClassifier(int paraAlgorithm,
double paraLabmda,
int paraPrune)
Build the cost-sensitive decision tree using the specified algorithm and prune strategy. |
double |
classifyInstance(Instance instance)
Classifies a given test instance using the decision tree. |
double |
classifyInstances()
Classifies using the training set. |
double |
classifyInstances(BothCostsNominalDecisionSystem paraTestingSet)
Classifies a given test set using the decision tree. |
double |
getAccuracy()
Get the classification accuracy. |
double |
getAverageCost()
Get the average cost. |
TechnicalInformation |
getTechnicalInformation()
Gets an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on. |
java.lang.String |
globalInfo()
Get a string describing the classifier. |
double |
instanceTestCost(Instance instance,
double paraTestCost)
Compute the instance's test cost while classification. |
static void |
main(java.lang.String[] args)
Main method. |
void |
setBalance(boolean paraBalance)
Set the balance variable. |
void |
setDecisionSystem(BothCostsNominalDecisionSystem paraDs)
Set the decision system. |
java.lang.String |
toString()
Prints the decision tree using the toString(int) method. |
java.lang.String |
toString(int level)
Outputs a tree at a certain level. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
public static final long serialVersionUID
public static final int COST_GAIN
public static final int WEIGHTED_GAIN
public static final int EXPONENTIAL_GAIN
public static final int ALL_ALGORITHMS
public static final int NO_PRUNE
public static final int PRE_PRUNE
public static final int POST_PRUNE
protected double accuracy
protected double maximalCostGain
protected double averageCost
protected boolean balance
| 构造方法详细信息 |
|---|
public CostSensitiveDecisionTree(BothCostsNominalDecisionSystem paraDs,
boolean paraBalance)
throws java.lang.Exception
paraBalance - wether or not balance 是否平衡java.lang.Exception| 方法详细信息 |
|---|
public java.lang.String globalInfo()
public void setBalance(boolean paraBalance)
public TechnicalInformation getTechnicalInformation()
public void setDecisionSystem(BothCostsNominalDecisionSystem paraDs)
public double getAccuracy()
public double getAverageCost()
public void buildClassifier(int paraAlgorithm,
double paraLabmda,
int paraPrune)
throws java.lang.Exception
paraAlgorithm - 0 for cost gain, 1 for weighted cost gainparaLabmda - only valid while the algorithm is weighted cost gainparaPrune - the prune strategy, 0 for no prune, 1 for pre-prune, 2 for
post-prunejava.lang.Exception - if classifier can't be built successfullymakeTree(int, double, boolean)
public double classifyInstance(Instance instance)
throws NoSupportForMissingValuesException
instance - the instance to be classifiedNoSupportForMissingValuesException - if instance has missing values
public double instanceTestCost(Instance instance,
double paraTestCost)
throws NoSupportForMissingValuesException,
java.lang.Exception
instance - the instance to be classifiedNoSupportForMissingValuesException - if instance has missing valuesjava.lang.Exception
public double classifyInstances()
throws java.lang.Exception
java.lang.Exception - if something wrong happens
public double classifyInstances(BothCostsNominalDecisionSystem paraTestingSet)
throws java.lang.Exception
paraTestingSet - the testing setjava.lang.Exception - if something wrong happenspublic java.lang.String toString()
toString(int)public java.lang.String toString(int level)
level - the level at which the tree is to be printedpublic static void main(java.lang.String[] args)
args - the options for the classifier
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | ||||||||