亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? instance.java

?? 用JAVA實現的C4.5算法
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package shared;
import java.lang.*;
import java.io.*;

/** The class Instance provides instances with or without label and
 * support for describing instances, iterating through values, and looking at
 * the instance label. Most effort was directed at categorization of labelled
 * instances for supervised learning. Has been extended to tree-structured
 * attributes.
 */

public class Instance {
    
    /** The Schema for the data stored in this Instance. **/
    private Schema schema;
    /** The values for each Attribute stored in this Instance. **/
    public AttrValue[] values;
    /** The weight assigned to this Instance of data. **/
    private double weight;
    /** Count of the references to this Instance object.
     */
    private int refCount;
    /** The label this Instance is categorized as. **/
    private AttrValue labelValue;
    
    /** A string used for displaying purposes. **/
    private static final String INSTANCE_WRAP_INDENT = "   ";
    /** A string used for displaying purposes. **/
    private static final char END_OF_INSTANCE_LINE = '.';
    
    /** Cloning function for the Instance class. Provides a deep copy.
     * @return A copy of the Object.
     * @throws CloneNotSupportedException if the cloning process for contained data members encounters a
     * CloneNotSupportedException.
     */
    public Object clone() throws CloneNotSupportedException {
        Instance newClone = new Instance(schema);
        newClone.set_weight(weight);
        newClone.set_label((AttrValue)labelValue.clone());
        for(int i=0;i<schema.num_attr();i++)
            newClone.values[i] = (AttrValue)get_value(i).clone();
        
        return newClone;
    }
    
    /** Constructor for the Instance class.
     * @param newSchema	The Schema for the data stored in this Instance.
     */
    public Instance(Schema newSchema) {
        values = new AttrValue[newSchema.num_attr()];
        for(int i = 0; i < values.length; values[i++] = new AttrValue());
        refCount = 1;
        weight = 1.0; //default value
        schema = newSchema;
        //DBG(init_values())
        //DBG(OK())
    }
    
    /** Copy constructor for the Instance class.
     * @param source	The original Instance to be copied.
     */
    public Instance(Instance source) {
        schema = source.schema;
        values = source.values;
        labelValue = source.labelValue;
        refCount = 1;
        
        weight = source.weight;
        //      DBG(OK());
    }
    
    
    /** Returns the Schema of attributes for this Instance.
     * @return The Schema for this Instance.
     */
    public Schema get_schema(){return schema;}
    
    /** Returns the number of attributes for data in this Instance.
     * @return The number of attributes in this Instance.
     */
    public int num_attr(){return schema.num_attr();}
    
    /** Returns the label this Instance is categorized as.
     * @return The labelValue for this Instance.
     */
    public AttrValue get_label(){return labelValue;}
    
    /** Returns a copy with only the attributes included that are are indicated
     * by the mask. Schema.project() should be called to create the new Schema
     * for the Instance.
     * @return The new Instance with the attributes specified.
     * @param shortSchema	The Schema for the new Instance created.
     * @param attrMask		An array of boolean values equal in length to the
     * original number of attributes. Each element
     * relates to an attribute of the original
     * instance. If the element is set TRUE, the
     * corresponding attribute is included in the new
     * Instance.
     */
    public Instance project(Schema shortSchema, boolean[] attrMask) {
        //DBG(OK());
        //ASSERT(attrMask.size() == num_attr());
        
        if(get_schema().is_labelled() != shortSchema.is_labelled())
            Error.err("Instance.project: short schema "
            +" has different labelled status from this schema-->"
            +"fatal_error");
        
        Instance newInst = new Instance(shortSchema);
        int newnum = 0;
        for(int i=0;i<num_attr();i++) {
            if(attrMask[i]) {
                newInst.values[newnum] = values[i];
                newnum++;
            }
        }
        
        if(get_schema().is_labelled())
            newInst.set_label(get_label());
        
        //set the weight for this instance
        newInst.set_weight(get_weight());
        
        return newInst;
    }
    
    // reimplementation of overrided [] method
    /** Returns the attribute value at the specified attribute.
     * @return The attribute value stored for the attribute at that index.
     * @param index	The index number for the specified attribute.
     */
    public AttrValue get_value(int index) {
        return values[index];
    }
    
    /** Sets the Schema for this Instance.
     * @param schemaRC	The new Schema for this Instance.
     */
    public void set_schema(Schema schemaRC) //SchemaRC
    {
        if(schemaRC.num_attr() != schema.num_attr())
            Error.err("Instance::set_schema(): attribute "
            +"count does not match -->fatal_error");
        schema = schemaRC;
    }
    
    /** Sets the weight for this Instance.
     * @param wt	The new weight for this Instance.
     */
    public void set_weight(double wt) {
        weight = wt;
    }
    
    /** Sets the label for this Instance.
     * @param lvalue	The new label value for this Instance.
     */
    public void set_label(AttrValue lvalue) {
        if(!schema.is_labelled())
            System.out.println("Instance::set_label():labelInfo is not set ->fe");
        schema.label_info().check_in_range(lvalue);
        labelValue = lvalue;
    }
    
    /** Returns the weight for this Instance.
     * @return The weight for this Instance.
     */
    public double get_weight(){return weight;}
    
    /** Displays the Instance with labels.
     * @param displayWeight	TRUE if the weight for this Instance should be shown,
     * FALSE otherwise.
     * @param normalizeReals TRUE if the attribute values should be normalized,
     * FALSE otherwise.
     */
    public void display(boolean displayWeight, boolean normalizeReals) {
        display_unlabelled(displayWeight, normalizeReals);
        if(is_labelled()){
            if(schema.num_attr() > 0)
                System.out.print(", ");
            AttrInfo ai = schema.label_info();
            String data = ai.attrValue_to_string(labelValue);
            //if(protectChars)
            //   data = protect_chars(data);
            System.out.print(data);
        }
        System.out.println();
        
    }
    
    /** Displays the Instance without labels.
     * @param normalizeReal TRUE if the attribute values should be normalized,
     * FALSE otherwise.
     * @param displayWeight TRUE if the weight for this Instance should be shown,
     * FALSE otherwise.
     */
    public void display_unlabelled(boolean displayWeight, boolean normalizeReal) {
        String separator =  new String(", ");
        if(displayWeight)
            System.out.println(weight+separator);
        for(int attrNum = 0;attrNum<schema.num_attr();attrNum++){
            AttrInfo ai = schema.attr_info(attrNum);
            if(normalizeReal && ai.can_cast_to_real()){
                RealAttrInfo rai = ai.cast_to_real();
                if(rai.is_unknown(values[attrNum]))
                    System.out.print(AttrInfo.UNKNOWN_VAL_STR);
                else
                    System.out.print(rai.normalized_value(values[attrNum]));
                if(attrNum < schema.num_attr() -1)
                    System.out.print(separator);
            }
            else{
                //System.out.println("Values.length = " + values.length);
                //System.out.println("attrNum = "+attrNum);
                if(values[attrNum] == null)System.out.println("Error");
                String data = ai.attrValue_to_string(values[attrNum]);
                if(ai.can_cast_to_nominal())// && protectChars)
                    ;// data = protect_chars(data);
                System.out.print(data);
                if((attrNum < (schema.num_attr()-1))&&(!(data.equals(""))))
                    System.out.print(separator);
                
            }
        }
    }
    
    /** Checks if this Instance is labelled.
     * @returns TRUE if the Instance is labelled, FALSE otherwise.
     * @return TRUE if the Instance contains a label value, FALSE otherwise.
     */
    public boolean is_labelled() {
        boolean fatalOnFalse = false;
        return schema.is_labelled();
    }
    
    /** Checks if this Instance is labelled.
     * @return TRUE if the Instance is labelled, FALSE otherwise.
     * @param fatalOnFalse TRUE if an Error message should be displayed if there
     * is no label for this Instance, FALSE otherwise.
     */
    public boolean is_labelled(boolean fatalOnFalse) {
        return schema.is_labelled(fatalOnFalse);
    }
    
    
    /** Returns the information about the label this Instance is categorized as.
     * @return The information about the label value.
     */
    public AttrInfo label_info() {
        if (!schema.is_labelled())
            Error.fatalErr("Instance::label_info(): label is not set ");
        return schema.label_info();
    }
    
    /** Transfers this Instance to a String value.
     * @return A String with representations of the data stored in this Instance.
     */
    public String toString() {
        boolean displayWeight = false;
        boolean normalizeReals = false;
        String rtrn = "";
        String separator =  new String(", ");
        if(displayWeight)
            rtrn = rtrn + weight + separator;
        for(int attrNum = 0;attrNum<schema.num_attr();attrNum++){
            AttrInfo ai = schema.attr_info(attrNum);
            if(normalizeReals && ai.can_cast_to_real()){
                RealAttrInfo rai = ai.cast_to_real();
                if(rai.is_unknown(values[attrNum]))
                    rtrn = rtrn + "?";//Globals.UNKNOWN_VAL_STR;
                else
                    rtrn = rtrn + rai.normalized_value(values[attrNum]);
                if(attrNum < schema.num_attr() -1)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品欧美二区三区中文字幕| 成人精品视频一区| 久久先锋资源网| www..com久久爱| 日韩精品欧美精品| 亚洲国产成人一区二区三区| 色婷婷亚洲精品| 久久99精品国产.久久久久| 中文字幕乱码久久午夜不卡| 欧美三级三级三级| av在线一区二区三区| 蜜臀久久久99精品久久久久久| 国产精品天干天干在观线| 3d动漫精品啪啪| 在线观看一区二区精品视频| 国产成人精品免费视频网站| 亚洲成人精品影院| 亚洲综合在线视频| 亚洲精品美腿丝袜| 18欧美乱大交hd1984| 欧美激情中文不卡| 国产精品网站在线观看| 精品国产欧美一区二区| 日韩欧美久久久| 日韩一级片网站| 精品久久人人做人人爰| 91精品国产麻豆| 久久综合999| 久久影视一区二区| 久久久久久久网| 国产三级一区二区三区| 欧美国产亚洲另类动漫| 久久亚洲一区二区三区四区| 精品久久五月天| 久久精品视频一区| 国产精品久久久久久一区二区三区 | 一区二区三区日韩在线观看| 国产精品每日更新在线播放网址| 国产亚洲va综合人人澡精品 | 国产午夜精品一区二区| 久久综合色天天久久综合图片| 久久精品免费在线观看| 国产精品免费久久| 亚洲国产人成综合网站| 国内精品伊人久久久久av一坑| 国产精品一区二区男女羞羞无遮挡 | 日韩成人一区二区| 成人影视亚洲图片在线| 欧美美女一区二区三区| 欧美国产在线观看| 蜜桃视频在线观看一区二区| 成人深夜在线观看| 日韩欧美激情四射| 亚洲综合区在线| 北岛玲一区二区三区四区| 精品国产成人系列| 午夜久久久久久| 91女厕偷拍女厕偷拍高清| 26uuu久久天堂性欧美| 亚洲va在线va天堂| 色哟哟一区二区| 国产精品高潮久久久久无| 免费高清在线视频一区·| 91国产丝袜在线播放| 中文字幕在线不卡国产视频| 国产精品一区免费在线观看| 欧美精品日韩精品| 亚洲一级二级在线| 欧美日韩一级二级三级| 亚洲一区二区三区中文字幕在线| 91在线云播放| 亚洲猫色日本管| 欧美最猛黑人xxxxx猛交| 中文字幕一区在线观看视频| 91玉足脚交白嫩脚丫在线播放| 国产欧美日韩激情| 色香色香欲天天天影视综合网| 中文字幕亚洲一区二区av在线| 成人av资源网站| 亚洲高清免费观看| 精品国产99国产精品| 成人avav影音| 天天色 色综合| 国产三级精品视频| 91视频.com| 激情综合亚洲精品| 一片黄亚洲嫩模| 精品国产精品一区二区夜夜嗨| 成人午夜视频在线| 日本va欧美va精品| 日韩美女精品在线| 日韩欧美第一区| 欧美色图免费看| 国产99久久久国产精品潘金网站| 亚洲精品日产精品乱码不卡| 日韩免费一区二区| 欧美日韩国产色站一区二区三区| 国产精品正在播放| 免费国产亚洲视频| 亚洲大尺度视频在线观看| 国产欧美精品国产国产专区| 欧美裸体bbwbbwbbw| 欧美综合在线视频| 91亚洲资源网| aaa国产一区| 粉嫩在线一区二区三区视频| 免费的成人av| 免费国产亚洲视频| 国产在线国偷精品产拍免费yy| 亚洲国产精品久久久久婷婷884| 国产欧美精品一区| 国产欧美日韩视频一区二区| 久久免费视频一区| 中文字幕不卡在线播放| 国产精品三级电影| 中文字幕字幕中文在线中不卡视频| 国产精品美女久久久久aⅴ国产馆| 欧美亚州韩日在线看免费版国语版| 一区二区免费在线| 精品国产乱码久久久久久影片| 欧美三级蜜桃2在线观看| 高清不卡一二三区| av亚洲精华国产精华| 99精品在线免费| 欧美久久一二三四区| 日韩一区二区麻豆国产| 久久久久久久网| 洋洋成人永久网站入口| 免费在线一区观看| 波多野结衣一区二区三区| 欧洲一区二区三区在线| 日韩一区二区不卡| 1区2区3区精品视频| 天天综合日日夜夜精品| 国产一区二区看久久| 在线观看日韩电影| 久久精品这里都是精品| 亚洲猫色日本管| 国产综合色产在线精品| 欧美撒尿777hd撒尿| 国产精品久久久99| 日本视频一区二区| 色婷婷精品大在线视频 | 国产精品自在在线| 欧美日韩一区二区三区在线| 国产日本欧美一区二区| 五月天激情综合| 色哟哟在线观看一区二区三区| 精品国产一区a| 久久国产精品免费| 欧美日韩成人一区| 亚洲成人av中文| 欧美性大战久久久| 一区二区三区高清| 色婷婷综合久色| 综合中文字幕亚洲| www.99精品| 亚洲美女偷拍久久| 91福利国产成人精品照片| **欧美大码日韩| 99在线热播精品免费| 中文字幕在线观看不卡视频| 成人av资源下载| 亚洲国产三级在线| 日韩一区二区免费电影| 国产一区二区三区黄视频 | 久久99日本精品| 久久综合久久综合亚洲| 成人免费视频一区二区| 亚洲视频狠狠干| 91精品久久久久久久久99蜜臂| 亚洲一级片在线观看| 欧美刺激脚交jootjob| 成人一区在线观看| 一区二区三区在线免费视频| 欧美一区二区三区精品| 国产精品1区2区3区在线观看| 国产精品人妖ts系列视频| 欧美色图12p| 成人av资源网站| 青青青伊人色综合久久| 国产精品乱码一区二区三区软件| 99精品视频在线免费观看| 日本人妖一区二区| 亚洲美女偷拍久久| 国产亚洲欧美在线| 日韩精品一区二区三区四区视频| 岛国精品在线观看| 日韩1区2区3区| 亚洲午夜在线观看视频在线| 欧美激情在线一区二区三区| 欧美一区三区四区| 欧美挠脚心视频网站| 91麻豆swag| 成熟亚洲日本毛茸茸凸凹| 美女在线视频一区| 日本系列欧美系列| 久久99久久久久| 激情综合亚洲精品| 国产99久久久精品|