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

📄 iddescription.java

📁 Boosting算法软件包
💻 JAVA
字号:
package jboost.examples;import jboost.controller.Configuration;import jboost.tokenizer.BadAttException;/** * The description for a private weight of each example. */public class IdDescription extends IntegerDescription {    public static final int MAX_ID = Integer.MAX_VALUE;    IdDescription(String name, Configuration config, int default_val)   throws ClassNotFoundException {    super(name,config);  }    /**    *  Reads an id    *  If no value is specified, default to 1   *  If the value is negative, return 0 as the weight.   *  If the value is greater than 1, return 1.   * @param weight the string representation of the weight   * @return Attribute the RealAttribute corresponding to the weight   */  public Attribute str2Att(String id) throws BadAttException {    double att = 1.0; // initialized because try complains otherwise.        if (id != null) {      id= id.trim();       if (id.length() != 0) {        try {          att= Double.parseDouble(id);        } catch (NumberFormatException nfe) {          throw new BadAttException(id + " is not a float",0,0);                  }        if (att < 0) {	    att= 0;	    throw new BadAttException("The id: " + id + " is less than 0",0,0);                  }        if (att > MAX_ID) {	    throw new BadAttException("The id: " + id + " is larger than MAX_ID=" + MAX_ID,0,0);                  }       }    }    return new RealAttribute (att);  }}

⌨️ 快捷键说明

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