程序包 weka.estimators
接口 ConditionalEstimator
- 所有超级接口:
RevisionHandler
- 所有已知实现类:
DDConditionalEstimator
,DKConditionalEstimator
,DNConditionalEstimator
,KDConditionalEstimator
,KKConditionalEstimator
,NDConditionalEstimator
,NNConditionalEstimator
Interface for conditional probability estimators. Example code:
NNConditionalEstimator newEst = new NNConditionalEstimator();
// Create 50 random points and add them
Random r = new Random(seed);
for(int i = 0; i < 50; i++) {
int x = Math.abs(r.nextInt() % 100);
int y = Math.abs(r.nextInt() % 100);
System.out.println("# " + x + " " + y);
newEst.addValue(x, y, 1);
}
// Pick a random conditional value
int cond = Math.abs(r.nextInt() % 100);
System.out.println("## Conditional = " + cond);
// Print the probabilities conditional on that value
Estimator result = newEst.getEstimator(cond);
for(int i = 0; i <= 100; i+= 5) {
System.out.println(" " + i + " " + result.getProbability(i));
}
- 版本:
- $Revision: 1.7 $
- 作者:
- Len Trigg (trigg@cs.waikato.ac.nz)
-
方法概要
修饰符和类型方法说明void
addValue
(double data, double given, double weight) Add a new data value to the current estimator.getEstimator
(double given) Get a probability estimator for a valuedouble
getProbability
(double data, double given) Get a probability for a value conditional on another value从接口继承的方法 weka.core.RevisionHandler
getRevision
-
方法详细资料
-
addValue
void addValue(double data, double given, double weight) Add a new data value to the current estimator.- 参数:
data
- the new data valuegiven
- the new value that data is conditional uponweight
- the weight assigned to the data value
-
getEstimator
Get a probability estimator for a value- 参数:
given
- the new value that data is conditional upon- 返回:
- the estimator for the supplied value given the condition
-
getProbability
double getProbability(double data, double given) Get a probability for a value conditional on another value- 参数:
data
- the value to estimate the probability ofgiven
- the new value that data is conditional upon- 返回:
- the estimator for the supplied value given the condition
-