blob: 4c4f85daa699043a5d1c63abc1e5785bd8dd56e3 [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.conditionaltests;
import org.apache.samoa.instances.Instance;
import org.apache.samoa.instances.InstancesHeader;
import org.apache.samoa.moa.AbstractMOAObject;
/**
* Abstract conditional test for instances to use to split nodes in Hoeffding trees.
*
* @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
* @version $Revision: 7 $
*/
public abstract class InstanceConditionalTest extends AbstractMOAObject {
/**
* Returns the number of the branch for an instance, -1 if unknown.
*
* @param inst
* the instance to be used
* @return the number of the branch for an instance, -1 if unknown.
*/
public abstract int branchForInstance(Instance inst);
/**
* Gets whether the number of the branch for an instance is known.
*
* @param inst
* @return true if the number of the branch for an instance is known
*/
public boolean resultKnownForInstance(Instance inst) {
return branchForInstance(inst) >= 0;
}
/**
* Gets the number of maximum branches, -1 if unknown.
*
* @return the number of maximum branches, -1 if unknown..
*/
public abstract int maxBranches();
/**
* Gets the text that describes the condition of a branch. It is used to describe the branch.
*
* @param branch
* the number of the branch to describe
* @param context
* the context or header of the data stream
* @return the text that describes the condition of the branch
*/
public abstract String describeConditionForBranch(int branch,
InstancesHeader context);
/**
* Returns an array with the attributes that the test depends on.
*
* @return an array with the attributes that the test depends on
*/
public abstract int[] getAttsTestDependsOn();
}