當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。