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

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

?? nodecategorizer.java

?? java數據挖掘算法
?? JAVA
字號:
package id3;
import java.lang.*;
import java.util.*;
import shared.*;
import shared.Error;
/** An abstract base class categorizer for categorizers that may sit in nodes of
 * decision trees, graphs, etc. Categorizers of this sort generally categorize by
 * making a decision about the instance, and then asking one or more other
 * categorizers in the graph to categorize. The recursion ends when a
 * NodeCategorizer can decide on the category (or distribution, in the case of
 * scoring) without consulting other categorizers.
 *
 * @author James Louis 4/16/2002 Java implementation.
 * @author Clay Kunz 08/08/97 Initial revision (.h,.c)
 */
abstract public class NodeCategorizer extends Categorizer{
    
    //	public NodeCategorizer(){}
    
    // Member data
    private NodeLoss lossInfo;
    private Node nodePtr;
    private CGraph cGraph;
    private boolean smoothDistribution;
    private double smoothFactor;
    //   private DBG_DECLARE(boolean checkGraph;)
    
    
    /** Prints an empty string to System.out.
     */
    public void stop(){
        System.out.print("");
    }
    
    
    
    
    /** Constructor.
     * @param noCat The category for this NodeCategorizer.
     * @param dscr Description of this NodeCategorizer.
     * @param schema Schema for the data this categorizer classifies.
     */
    public NodeCategorizer(int noCat,  String dscr,  Schema schema) {
        super(noCat, dscr, schema);
        nodePtr = null;
        cGraph = null;
        smoothDistribution = false;
        smoothFactor = 0.0;
        lossInfo = new NodeLoss();
        
        //   DBG(checkGraph = true);
        reset_node_loss();
    }
    //used in NodeInfo.toString()
    /** Creates a String representation of this NodeCategorizer.
     * @return A String representation of this NodeCategorizer.
     */
    public String toString() {
        return description();
    }
    
    /** Clears the loss information.
     */
    public void reset_node_loss() {
        lossInfo.totalWeight = 0.0;
        lossInfo.totalLoss = 0.0;
        lossInfo.totalLossSquared = 0.0;
    }
    
    /** Returns TRUE if a graph has been set for this NodeCategorizer, FALSE otherwise.
     * @return TRUE if a graph has been set for this NodeCategorizer, FALSE otherwise.
     */
    public boolean in_graph()  { return (cGraph != null); }
    
    /** Splits the instance list according to the value returned by branch() for each
     * instance.
     * @param il The InstanceList to be split.
     * @return A array of partitions of the given InstanceList.
     */
    public  InstanceList[] split_instance_list( InstanceList il)
    
    {
        //   DBGSLOW(if (!get_schema().equal(il.get_schema()))
        //	   Error.err("NodeCategorizer::split_instance_list: my schema " +
        //			get_schema() + " is not the same as the schema of the instance list to split: " +
        //			il.get_schema() + "-->fatal_error");
        
        // Note num_cat() + 1, and NOT num_cat() because the count starts
        //   from UNKNOWN and not from FIRST.
        InstanceList[] ila =new InstanceList[num_categories() + 1];
        //(Globals.UNKNOWN_CATEGORY_VAL, num_categories() + 1);
        //   for (int i = ila.low(); i <= ila->high(); i++)
        for (int i = 0; i < ila.length; i++)
            ila[i] = new InstanceList(il.get_schema());
        for (ListIterator pix = il.instance_list().listIterator(); pix.hasNext();) {
            Instance instance = (Instance)pix.next();
            ila[branch(instance).num()].add_instance(instance);
            //ila[(int)(branch(instance))].add_instance(instance);
        }
        
        return ila;
    }
    
    /** Traverses the graph of nodes from this NodeCategorizer to determine the category
     * the given instance should be predicted as.
     * @param inst The instance for which a prediction is requested.
     * @return The category for the given instance.
     */
    abstract public AugCategory branch(Instance inst);
    
    
    /** Categorize an instance.
     * @param instance The instance to be categorized.
     * @return The category of the given instance.
     */
    public AugCategory categorize(Instance instance) {
        if (!in_graph())
            Error.fatalErr("NodeCategorizer::categorize: can only categorize from "
            +"inside a graph");
        return get_child_categorizer(instance).categorize(instance);
    }
    
    /** Returns TRUE if scoring supported by this node categorizer. TRUE is always
     * returned.
     * @return TRUE.
     */
    public  boolean supports_scoring()  { return true; }
    /** Score an instance. Scoring function contains the option of carrying the loss
     * information through the graph.
     * @param inst The instance to be scored.
     * @return The score of the given instance.
     */
    public  CatDist score( Instance inst){ return score(inst, false); }
    /** Score an instance. Scoring function contains the option of carrying the loss
     * information through the graph.
     * @param inst The instance to be scored.
     * @param addLoss TRUE if the loss information is to be carried through the graph, FALSE
     * otherwise.
     * @return The score of the given instance.
     */
    public  CatDist score( Instance inst, boolean addLoss) {
        if (!in_graph())
            Error.err("NodeCategorizer::score: can only score from inside a graph-->fatal_error");
        CatDist dist = get_child_categorizer(inst).score(inst, addLoss);
        // smoothing is not yet supported
        //      if (smoothDistribution) {
        //         Error.err("NodeCategorizer::score: smoothing is not yet supported-->fatal_error");
        //         dist.smooth_toward(get_distr(), smoothFactor);
        //      }
        if (addLoss)
            add_instance_loss(inst, dist);
        return dist;
    }
    
    /** Updates the loss information for this node to reflect the node's performance on
     * the given instance, and the given prediction.
     *
     * @param instance The instance to which given prediction applies.
     * @param pred The prediction of category distributions.
     */
    public  void add_instance_loss( Instance instance,
    CatDist pred) {
        int correctCat = Globals.UNKNOWN_CATEGORY_VAL;
        
        AugCategory predictedCat = pred.best_category();
        correctCat = instance.label_info().get_nominal_val(instance.get_label());
        if (correctCat == Globals.UNKNOWN_CATEGORY_VAL)
            Error.err("NodeCategorizer::add_instance_loss: instance " + instance + " has UNKNOWN_CATEGORY_VAL-->fatal_error");
        double loss;
        if (get_schema().has_loss_matrix())
            loss = get_schema().get_loss_matrix()[correctCat][predictedCat.num()];
        else if (predictedCat.num() == correctCat)
            loss = 0;
        else
            loss = 1;
        
        update_loss(instance.get_weight(), loss);
    }
    
    /** Returns the child categorizer of this node that is found by following the edge
     * with the given label.
     *
     * @param branch The category of the edge for which the child categorizer is requested.
     * @return The child categorizer.
     */
    public  NodeCategorizer get_child_categorizer(AugCategory branch) {
        Node childNode = get_graph().get_child(get_node(), branch);
        return ((NodeInfo)get_graph().entry(childNode)).get_categorizer();
    }
    
    /** Retrieves the appropriate categorizer one level down in the graph, obtained by
     * following the edge appropriate for the instance provided.
     *
     * @param inst The instance provided for determining which edge to traverse.
     * @return The child categorizer of the appropriate edge.
     */
    public  NodeCategorizer get_child_categorizer(Instance inst) {
        return get_child_categorizer(branch(inst));
    }
    
    /** Updates the loss information with the given values.
     * @param weight The new weight value.
     * @param loss The new loss value.
     */
    protected void update_loss(double weight, double loss) { lossInfo.update(weight, loss); }
    
    /** Returns the graph for this NodeCategorizer.
     * @return The graph for this NodeCategorizer.
     */
    protected  CGraph get_graph() {
        if (cGraph == null)
            Error.err("NodeCategorizer::get_graph: the graph is null-->fatal_error");
        return cGraph;
    }
    
    /** Returns the node for this NodeCategorizer.
     * @return The node for this NodeCategorizer.
     */
    protected Node get_node() {
        if (nodePtr == null)
            Error.err("NodeCategorizer::get_node: the node is null-->fatal_error");
        return nodePtr;
    }
    
    /** Recomputes the distribution of the categorizer according to the given instance
     * list, splits it, and redistributes the split lists among the child categorizers.
     * This process is used to backfit an instance list to a graph structure.
     *
     * @param il The instance list used for recomputation.
     * @param pruningFactor The amount of pruning being done.
     * @param pessimisticErrors The pessimistic Error value.
     * @param ldType Leaf distribution type.
     * @param leafDistParameter The leaf distribution.
     * @param parentWeightDist The weight distribution of the parent categorizer.
     * @param saveOriginalDistr TRUE if the original distribution should be preserved, FALSE otherwise.
     */
    public  void distribute_instances( InstanceList il,
    double pruningFactor,
    DoubleRef pessimisticErrors,
    int ldType,  			//TDDTInducer.LeafDistType
    double leafDistParameter,
    double[] parentWeightDist,
    boolean saveOriginalDistr) {
        CGraph myGraph = get_graph();
        Node myNode = get_node();
        if (myNode.outdeg() <= 0)
            Error.err("NodeCategorizer::distribute_instances: " +
            "this node has no children -- leaf categorizers " +
            "should be held inside a LeafCategorizer-->fatal_error");
        
        if (saveOriginalDistr && has_distr())
            set_original_distr(get_distr());
        build_distr(il);
        
        double[] myWeightDistribution = null;
        double[] augmentedWeightDist = null;
        
        if (il.no_weight())
            myWeightDistribution = parentWeightDist;
        else {
            double[] distrNoUnknown = get_distr();
            augmentedWeightDist = new double[distrNoUnknown.length + 1];
            //	 new Array<double>(UNKNOWN_CATEGORY_VAL, distrNoUnknown.size() + 1, 0);
            for (int i = 0; i < augmentedWeightDist.length; i++)
                augmentedWeightDist[i] = distrNoUnknown[i];
            myWeightDistribution = augmentedWeightDist;
        }
        
        InstanceList[] instLists = split_instance_list(il);
        //   forall_adj_edges(edgePtr, myNode) {
        for(Edge edgePtr = myNode.First_Adj_Edge(0);
        edgePtr != null;
        edgePtr = edgePtr.Succ_Adj_Edge(myNode)){
            int num = ((AugCategory)myGraph.inf(edgePtr)).num();
            Node child = edgePtr.target();
            //      ASSERT((instLists)[num]);
            NodeCategorizer childCat = ((NodeInfo)myGraph.inf(child)).get_categorizer();
            childCat.distribute_instances(instLists[num], pruningFactor,
            pessimisticErrors, ldType,
            leafDistParameter, myWeightDistribution,
            saveOriginalDistr);
            instLists[num] = null;
        }
        
        augmentedWeightDist = null;
        
        //   DBG(
        //       // Make sure we don't have any leftover instances or this is a bug
        //       for (Category cat = instLists->low(); cat <= instLists->high(); cat++)
        //          if ((instLists)[cat] != null)
        //	     // Maybe we don't have unknown edges
        //	     if ((instLists)[cat]->no_weight()) {
        //	        delete (instLists)[cat];
        //	        (instLists)[cat] = null;
        //	     } else
        //	        Error.err("NodeCategorizer::distribute_inst: Missed InstanceList " + cat + "-->fatal_error");
        //       );
        instLists = null;
    }
    
    /** Install the graph and node into the object.
     * @param aGraph The graph of NodeCategorizers.
     * @param aNode The node for this NodeCategorizer.
     */
    public void set_graph_and_node(CGraph aGraph, Node aNode) {
        if (aGraph == null || aNode == null)
            Error.err("NodeCategorizer::set_graph_and_node: neither the graph nor the node may be null-->fatal_error");
        if (cGraph != null || nodePtr != null)
            Error.err("NodeCategorizer::set_graph_and_node: the node and graph have already been set-->fatal_error");
        
        cGraph = aGraph;
        nodePtr = aNode;
        //   DBG(OK(0));
    }
    
    /** Returns the loss information.
     * @return The loss information.
     */
    public NodeLoss get_loss() { return lossInfo; }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩专区在线视频| 国产不卡在线视频| 日韩一卡二卡三卡| 日产国产高清一区二区三区| 欧美日韩在线观看一区二区| 亚洲高清不卡在线观看| 在线日韩av片| 偷拍与自拍一区| 欧美一级生活片| 裸体一区二区三区| 亚洲韩国精品一区| 欧美日韩精品一区二区三区| 亚洲成人动漫av| 日韩欧美国产不卡| 国产一区二区在线视频| 国产无遮挡一区二区三区毛片日本 | 欧美日韩亚洲综合一区 | 亚洲欧美日韩电影| 色综合久久久网| 亚洲国产视频a| 91精品国产丝袜白色高跟鞋| 精品一区二区三区日韩| 国产日韩v精品一区二区| aaa亚洲精品一二三区| 亚洲人成在线观看一区二区| 色婷婷综合久色| 亚洲视频一区二区在线观看| 99久久精品免费观看| 亚洲午夜影视影院在线观看| 日韩欧美一级片| 丁香亚洲综合激情啪啪综合| 亚洲久草在线视频| 制服丝袜在线91| 国产美女娇喘av呻吟久久| 中文字幕一区二区三区视频| 欧美性一区二区| 精品系列免费在线观看| 国产精品乱人伦中文| 欧美色图在线观看| 蜜臀av一区二区在线观看| 久久精品人人做人人综合 | 欧美视频在线一区二区三区| 久久精品久久精品| 欧美极品aⅴ影院| 色国产综合视频| 麻豆免费精品视频| 国产精品久久久久天堂| 欧美三级电影一区| 国产在线国偷精品免费看| 亚洲裸体在线观看| 日韩一区二区三区视频在线 | 欧美成人猛片aaaaaaa| 成人a区在线观看| 肉色丝袜一区二区| 国产精品久久久久久户外露出| 欧美日韩在线三区| 粉嫩av一区二区三区在线播放| 亚洲一区精品在线| 久久久久久亚洲综合| 色噜噜狠狠色综合中国| 国精产品一区一区三区mba桃花 | 国产91丝袜在线播放0| 一区二区免费在线| 久久久久97国产精华液好用吗| 91麻豆成人久久精品二区三区| 免费观看在线色综合| 成人欧美一区二区三区| 欧美一区二区精品久久911| www.一区二区| 久久草av在线| 一区二区免费在线| 国产欧美一区二区三区网站| 4438成人网| 国产福利一区二区三区视频在线 | 亚洲美女偷拍久久| 久久久亚洲欧洲日产国码αv| 色婷婷av一区二区三区gif | 色综合网色综合| 狠狠色丁香久久婷婷综合_中| 亚洲综合色噜噜狠狠| 26uuu色噜噜精品一区二区| 99精品视频在线免费观看| 日韩va欧美va亚洲va久久| 亚洲欧洲无码一区二区三区| 欧美zozo另类异族| 欧美日韩在线观看一区二区| 99免费精品视频| 国产一区二区日韩精品| 日韩激情一二三区| 一区二区三区色| 久久久久久久精| 欧美一级理论片| 欧美色国产精品| 99久久精品国产观看| 国产不卡视频在线观看| 激情文学综合丁香| 日日摸夜夜添夜夜添国产精品| 亚洲最新在线观看| 国产精品传媒在线| 亚洲国产精品传媒在线观看| 欧美成人猛片aaaaaaa| 91麻豆精品国产综合久久久久久 | 91麻豆精品国产91久久久使用方法| 91亚洲男人天堂| 高清国产午夜精品久久久久久| 久久99精品国产麻豆婷婷洗澡| 视频一区中文字幕国产| 亚洲激情在线播放| 亚洲欧洲性图库| 国产精品卡一卡二| 中文字幕 久热精品 视频在线| 久久在线观看免费| 2022国产精品视频| 欧美成人精品1314www| 欧美高清hd18日本| 欧美视频一二三区| 在线精品视频免费观看| 91亚洲资源网| 粉嫩aⅴ一区二区三区四区| 狠狠久久亚洲欧美| 青青草一区二区三区| 日韩电影一区二区三区四区| 午夜激情综合网| 视频在线观看国产精品| 日日夜夜一区二区| 美日韩一区二区| 久久国产精品72免费观看| 韩国毛片一区二区三区| 激情图片小说一区| 国产一区二区免费看| 国产一区美女在线| 丁香天五香天堂综合| 丰满白嫩尤物一区二区| 成人av资源下载| 99国产精品久久久久久久久久| 91欧美一区二区| 欧日韩精品视频| 欧美日韩国产美| 日韩亚洲欧美成人一区| 在线播放亚洲一区| 欧美一区二视频| 6080午夜不卡| 日韩三级视频在线看| 精品久久久久久久久久久院品网 | 久久久久久麻豆| 欧美国产精品久久| 中文字幕在线播放不卡一区| 亚洲精品视频观看| 午夜私人影院久久久久| 麻豆一区二区三区| 国产91丝袜在线18| 91蜜桃在线免费视频| 欧美视频完全免费看| 日韩欧美在线网站| 久久久久久久久免费| 最新国产成人在线观看| 一区二区免费在线| 亚洲777理论| 久久爱www久久做| 成人污视频在线观看| 色伊人久久综合中文字幕| 在线精品亚洲一区二区不卡| 欧美一区二区免费| 亚洲国产成人午夜在线一区| 国产精品色婷婷| 一区二区日韩av| 六月婷婷色综合| gogogo免费视频观看亚洲一| 欧洲色大大久久| 日韩女优av电影在线观看| 欧美韩国日本综合| 亚洲一区二区三区四区五区黄| 日韩黄色免费电影| 国产福利91精品一区| 色婷婷av一区| 精品久久五月天| 亚洲免费伊人电影| 美腿丝袜亚洲色图| 99热在这里有精品免费| 精品久久免费看| 亚洲va中文字幕| av在线免费不卡| 精品91自产拍在线观看一区| 亚洲国产综合人成综合网站| 国产69精品一区二区亚洲孕妇| 7777精品伊人久久久大香线蕉最新版 | 欧美乱妇20p| 中文字幕欧美一| 国产一区二区三区黄视频 | 日韩欧美国产高清| 亚洲一区二区三区四区的| 懂色av中文一区二区三区| 精品少妇一区二区三区日产乱码| 一区二区三区中文字幕电影| 成人综合婷婷国产精品久久蜜臀 | 亚洲五月六月丁香激情| 成人黄色片在线观看| 欧美精品一区二区三区视频| 婷婷中文字幕一区三区| 一本大道综合伊人精品热热|