binner.java

来自「用于multivariate时间序列分类」· Java 代码 · 共 42 行

JAVA
42
字号
/**  * What this class does goes here  *  *   * @author Waleed Kadous  * @version $Id: Binner.java,v 1.1.1.1 2002/06/28 07:36:16 waleed Exp $  */package tclass.learnalg;   import tclass.*; import tclass.util.*; // Messiness note. To make four bins, i need 3 values. So ten bins needs nine values. public class Binner {    float[] boundaries;    Binner(int numBins){	boundaries = new float[numBins-1];     }    void setBound(int num, float val){	boundaries[num] = val; 	if(num > 0){	    Debug.myassert(boundaries[num-1] < boundaries[num], 			 "DANGER!!! Bin boundaries are not sequential!!"			 + boundaries[num-1] + " > " + boundaries[num]); 	    	}	    }    int findBin(float value){	for(int i=0; i < boundaries.length; i++){	    if(value < boundaries[i]){		return i; 	    }	}	return boundaries.length;     }        public String toString(){	return "Discretisation boundaries are: " + EqualFreqDiscretiser.d2str(boundaries);     }}

⌨️ 快捷键说明

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