当前位置: 首页>>代码示例>>Java>>正文


Java HoeffdingTree类代码示例

本文整理汇总了Java中moa.classifiers.trees.HoeffdingTree的典型用法代码示例。如果您正苦于以下问题:Java HoeffdingTree类的具体用法?Java HoeffdingTree怎么用?Java HoeffdingTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HoeffdingTree类属于moa.classifiers.trees包,在下文中一共展示了HoeffdingTree类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
public void run(int numInstances, boolean isTesting){
	Classifier learner = new HoeffdingTree();
	RandomRBFGenerator stream = new RandomRBFGenerator();
	stream.prepareForUse();

	learner.setModelContext(stream.getHeader());
	learner.prepareForUse();

	int numberSamplesCorrect = 0;
	int numberSamples = 0;
	long evaluateStartTime = TimingUtils.getNanoCPUTimeOfCurrentThread();
	while (stream.hasMoreInstances() && numberSamples < numInstances) {
		Instance trainInst = stream.nextInstance().getData();
		if (isTesting) {
			if (learner.correctlyClassifies(trainInst)){
				numberSamplesCorrect++;
			}
		}
		numberSamples++;
		learner.trainOnInstance(trainInst);
	}
	double accuracy = 100.0 * (double) numberSamplesCorrect/ (double) numberSamples;
	double time = TimingUtils.nanoTimeToSeconds(TimingUtils.getNanoCPUTimeOfCurrentThread()- evaluateStartTime);
	System.out.println(numberSamples + " instances processed with " + accuracy + "% accuracy in "+time+" seconds.");
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:26,代码来源:MOA.java

示例2: createAndShowGUI

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
private static void createAndShowGUI() {

        // Create and set up the window.
        JFrame frame = new JFrame("Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Create and set up the content pane.
        Options options = new HoeffdingTree().getOptions();
        JPanel panel = new OptionsConfigurationPanel(null, options);
        // createLabelledOptionComponentListPanel(options
        // .getOptionArray(), null);
        panel.setOpaque(true); // content panes must be opaque
        frame.setContentPane(panel);

        // Display the window.
        frame.pack();
        // frame.setSize(400, 400);
        frame.setVisible(true);
    }
 
开发者ID:Waikato,项目名称:moa,代码行数:20,代码来源:OptionsConfigurationPanel.java

示例3: enforceMemoryLimit

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
/**
 * Checks if the memory limit is exceeded and if so prunes the classifiers in the ensemble.
 */
protected void enforceMemoryLimit() {
	double memoryLimit = this.maxByteSizeOption.getValue() / (double) (this.learners.length + 1);

	for (int i = 0; i < this.learners.length; i++) {
		((HoeffdingTree) this.learners[(int) this.weights[i][1]]).maxByteSizeOption.setValue((int) Math
				.round(memoryLimit));
		((HoeffdingTree) this.learners[(int) this.weights[i][1]]).enforceTrackerLimit();
	}
}
 
开发者ID:Waikato,项目名称:moa,代码行数:13,代码来源:AccuracyUpdatedEnsemble.java

示例4: enforceMemoryLimit

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
/**
 * Checks if the memory limit is exceeded and if so prunes the classifiers in the ensemble.
 */
protected void enforceMemoryLimit() {
	double memoryLimit = this.maxByteSizeOption.getValue() / (double) (this.ensemble.length + 1);

	for (int i = 0; i < this.ensemble.length; i++) {
		((HoeffdingTree) this.ensemble[(int) this.weights[i][1]].classifier).maxByteSizeOption.setValue((int) Math
				.round(memoryLimit));
		((HoeffdingTree) this.ensemble[(int) this.weights[i][1]].classifier).enforceTrackerLimit();
	}
}
 
开发者ID:Waikato,项目名称:moa,代码行数:13,代码来源:OnlineAccuracyUpdatedEnsemble.java

示例5: getClassVotes

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
@Override
public double[] getClassVotes(Instance inst, HoeffdingTree ht) {
    if (getWeightSeen() >= ((HoeffdingTreeClassifLeaves) ht).nbThresholdOption.getValue()) {
        return this.classifier.getVotesForInstance(inst);
    }
    return super.getClassVotes(inst, ht);
}
 
开发者ID:Waikato,项目名称:moa,代码行数:8,代码来源:HoeffdingTreeClassifLeaves.java

示例6: getClassVotes

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
@Override
public double[] getClassVotes(Instance inst, HoeffdingTree ht) {
    if (getWeightSeen() >= ((HoeffdingAdaptiveTreeClassifLeaves) ht).nbThresholdOption.getValue()) {
	return this.classifier.getVotesForInstance(inst);
    }
    return super.getClassVotes(inst, ht);
}
 
开发者ID:Waikato,项目名称:moa,代码行数:8,代码来源:HoeffdingAdaptiveTreeClassifLeaves.java

示例7: learnFromInstance

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
@Override
public void learnFromInstance(Instance inst, HoeffdingTree ht) {
	List<Integer> labels = ((MultilabelHoeffdingTree) ht).getRelevantLabels(inst);
	for (int l : labels){
		this.observedClassDistribution.addToValue( l, inst.weight());
	}
}
 
开发者ID:Waikato,项目名称:moa,代码行数:8,代码来源:MultilabelHoeffdingTree.java

示例8: describeSubtree

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
public void describeSubtree(HoeffdingTree ht, StringBuilder out,
							int indent) {
	StringUtils.appendIndented(out, indent, "Leaf ");
	out.append(" = ");
	out.append(" weights: ");
	this.observedClassDistribution.getSingleLineDescription(out,
			this.observedClassDistribution.numValues());
	StringUtils.appendNewline(out);
}
 
开发者ID:Waikato,项目名称:moa,代码行数:10,代码来源:MultilabelHoeffdingTree.java

示例9: learnFromInstance

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
@Override
public void learnFromInstance(Instance inst, HoeffdingTree ht) {
    this.classifier.trainOnInstance(inst);
    super.learnFromInstance(inst, ht);
}
 
开发者ID:Waikato,项目名称:moa,代码行数:6,代码来源:HoeffdingTreeClassifLeaves.java

示例10: learnFromInstance

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
@Override
public void learnFromInstance(Instance inst, HoeffdingTree ht) {
    learnFromInstance(inst);
}
 
开发者ID:Waikato,项目名称:moa,代码行数:5,代码来源:RuleActiveLearningNode.java

示例11: getClassVotes

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
@Override
public double[] getClassVotes(Instance inst, HoeffdingTree ht) {

	return this.classifier.getVotesForInstance(inst); 			
}
 
开发者ID:Waikato,项目名称:moa,代码行数:6,代码来源:MultilabelHoeffdingTree.java

示例12: getPredictionForInstance

import moa.classifiers.trees.HoeffdingTree; //导入依赖的package包/类
public Prediction getPredictionForInstance(Instance inst, HoeffdingTree ht) {

			return this.classifier.getPredictionForInstance(inst);
		}
 
开发者ID:Waikato,项目名称:moa,代码行数:5,代码来源:MultilabelHoeffdingTree.java


注:本文中的moa.classifiers.trees.HoeffdingTree类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。