⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 evaluationbase.java

📁 Multi-label classification 和weka集成
💻 JAVA
字号:
package mulan.evaluation;
import weka.core.Utils;

/**
 * Common base class for concrete Evaluation classes.  
 *
 */
abstract class EvaluationBase
{
	/**
	 * This is all the information needed to derive
	 * the measures and curves.
	 */
	protected BinaryPrediction[][] predictions;
		
	/**
	 * Constructor
	 * @param predictions The predictions to used to calculate measures
	 */
	protected EvaluationBase(BinaryPrediction[][] predictions)
	{
		this.predictions = predictions;
	}

	/**
	 * @return size of the testset. (total number of predictions)
	 */
	public int numInstances()
	{
		return predictions.length;
	}

	/**
	 * 
	 * @return total number of possible labels
	 */
	public int numLabels()
	{
		return predictions[0].length;
	}
	
	protected double computeFMeasure(double precision, double recall)
	{
	    if (Utils.eq(precision + recall, 0)) return 0;
	    else return 2 * precision * recall / (precision + recall);
	}


	public abstract double accuracy();
	public abstract double recall();
	public abstract double precision();
	public abstract double fmeasure();
	protected abstract void computeMeasures();

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -