blob: f8885d2855e7f6d6d3bc83416a027e0f47e1fc07 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.samoa.moa.classifiers.core.attributeclassobservers;
import org.apache.samoa.moa.classifiers.core.AttributeSplitSuggestion;
import org.apache.samoa.moa.classifiers.core.splitcriteria.SplitCriterion;
import org.apache.samoa.moa.options.OptionHandler;
/**
* Interface for observing the class data distribution for an attribute. This observer monitors the class distribution
* of a given attribute. Used in naive Bayes and decision trees to monitor data statistics on leaves.
*
* @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
* @version $Revision: 7 $
*/
public interface AttributeClassObserver extends OptionHandler {
/**
* Updates statistics of this observer given an attribute value, a class and the weight of the instance observed
*
* @param attVal
* the value of the attribute
* @param classVal
* the class
* @param weight
* the weight of the instance
*/
public void observeAttributeClass(double attVal, int classVal, double weight);
/**
* Gets the probability for an attribute value given a class
*
* @param attVal
* the attribute value
* @param classVal
* the class
* @return probability for an attribute value given a class
*/
public double probabilityOfAttributeValueGivenClass(double attVal,
int classVal);
/**
* Gets the best split suggestion given a criterion and a class distribution
*
* @param criterion
* the split criterion to use
* @param preSplitDist
* the class distribution before the split
* @param attIndex
* the attribute index
* @param binaryOnly
* true to use binary splits
* @return suggestion of best attribute split
*/
public AttributeSplitSuggestion getBestEvaluatedSplitSuggestion(
SplitCriterion criterion, double[] preSplitDist, int attIndex,
boolean binaryOnly);
public void observeAttributeTarget(double attVal, double target);
}