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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? nodecategorizer.java

?? 此編碼是一個數(shù)據(jù)挖掘的決策樹各種算法。以作為入門提示
?? 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; }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久久久久电影| 欧美一区二区国产| 国产精品18久久久久久久久| 午夜久久久久久电影| 亚洲午夜日本在线观看| 亚洲综合清纯丝袜自拍| 亚洲成人免费影院| 男人的天堂久久精品| 免费观看成人av| 国产精品一二一区| 国产91丝袜在线18| 不卡的av电影| 欧美午夜精品一区二区三区| 欧美视频三区在线播放| 欧美麻豆精品久久久久久| 91精品福利在线一区二区三区 | 精品久久久久久无| 欧美不卡视频一区| 国产精品丝袜91| 亚洲欧美一区二区三区久本道91| 亚洲人午夜精品天堂一二香蕉| 亚洲欧美乱综合| 天天综合天天做天天综合| 久久精品99久久久| 国产 欧美在线| 在线亚洲免费视频| 欧美一级高清片在线观看| 国产欧美日韩在线| 亚洲欧美激情视频在线观看一区二区三区| 亚洲精品高清在线观看| 久久福利资源站| 99久久99久久精品国产片果冻 | 韩国欧美国产1区| av激情亚洲男人天堂| 欧美日产在线观看| 国产亚洲va综合人人澡精品| 亚洲精品免费视频| 热久久久久久久| 91麻豆精品一区二区三区| 日韩欧美一区二区不卡| 亚洲欧美日韩一区二区三区在线观看| 日本在线不卡视频一二三区| www.欧美日韩国产在线| 日韩一级二级三级| 一区二区在线免费观看| 国产成人综合网| 337p亚洲精品色噜噜| 中文字幕在线不卡| 国产麻豆精品视频| 日韩一区二区精品葵司在线| 成人免费一区二区三区视频| 久久国内精品视频| 欧美色偷偷大香| 17c精品麻豆一区二区免费| 美脚の诱脚舐め脚责91| 在线观看视频一区二区欧美日韩| 久久综合九色欧美综合狠狠| 视频一区欧美日韩| 色94色欧美sute亚洲13| 国产精品高潮呻吟| 国产主播一区二区| 精品国产欧美一区二区| 亚洲bdsm女犯bdsm网站| 色综合色综合色综合色综合色综合| 精品久久久久久久人人人人传媒| 午夜a成v人精品| 欧美午夜精品一区二区三区| 亚洲免费在线视频| 99在线精品一区二区三区| 国产人久久人人人人爽| 国产盗摄一区二区| 国产欧美综合在线观看第十页| 免费人成网站在线观看欧美高清| 在线不卡中文字幕| 石原莉奈一区二区三区在线观看| 欧美午夜一区二区三区| 午夜视频一区二区三区| 在线观看国产日韩| 亚洲成人www| 欧美大片在线观看一区二区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 久草在线在线精品观看| 日韩一区二区三区在线| 另类小说一区二区三区| 精品国产91洋老外米糕| 国产在线精品国自产拍免费| 久久九九99视频| 成人h精品动漫一区二区三区| 国产精品久久久久久久第一福利 | 亚洲二区在线观看| 在线综合+亚洲+欧美中文字幕| 秋霞国产午夜精品免费视频| 精品久久久久久久久久久久包黑料| 激情综合色播五月| 国产精品亲子伦对白| 91电影在线观看| 蜜桃一区二区三区在线| 欧美精品一区二区三区视频| 成人污污视频在线观看| 亚洲精品成人精品456| 欧美精品第一页| 国产99一区视频免费| 一区二区三区在线影院| 日韩欧美三级在线| av不卡在线观看| 日韩国产精品91| 国产农村妇女毛片精品久久麻豆| av在线不卡电影| 免费成人av资源网| 亚洲欧洲av另类| 日韩一区二区视频| 99九九99九九九视频精品| 日本欧洲一区二区| 中文字幕日本乱码精品影院| 8x8x8国产精品| 99久久精品免费精品国产| 免费国产亚洲视频| 国产精品情趣视频| 精品免费视频.| 欧美老肥妇做.爰bbww| 国产91丝袜在线播放0| 日韩影院在线观看| 国产精品久久精品日日| 日韩一区二区在线观看视频| 在线日韩国产精品| 国产成人免费xxxxxxxx| 蜜臀av在线播放一区二区三区| 日韩一区日韩二区| 欧美韩国日本不卡| 久久亚洲综合av| 日韩午夜av一区| 欧美日韩亚洲综合一区| 波多野结衣中文字幕一区二区三区 | 欧美视频精品在线观看| 成人国产免费视频| 国产精品一区二区免费不卡 | 欧洲一区在线电影| a4yy欧美一区二区三区| 91免费看片在线观看| 日韩中文字幕亚洲一区二区va在线| 国产精品嫩草影院av蜜臀| 欧美成人三级电影在线| 91麻豆精品国产无毒不卡在线观看| 91啪在线观看| 91免费视频观看| 色综合天天综合狠狠| 成人理论电影网| 国产中文字幕精品| 国产精品一区二区男女羞羞无遮挡| 麻豆传媒一区二区三区| 免费在线观看一区| 日韩精品成人一区二区在线| 亚洲一区二区在线免费观看视频| 亚洲视频一区二区在线观看| 成人免费视频在线观看| 依依成人精品视频| 亚洲一区二区三区精品在线| 亚洲一区二区五区| 日韩精品一二区| 麻豆精品精品国产自在97香蕉| 奇米综合一区二区三区精品视频 | 国产经典欧美精品| 国产成人啪免费观看软件 | 中文字幕一区二区三区不卡在线 | 精品国产sm最大网站| 久久蜜臀精品av| 中文字幕永久在线不卡| 亚洲青青青在线视频| 亚洲精品精品亚洲| 日韩二区三区四区| 精品一区二区在线免费观看| 日韩黄色免费电影| 国产乱码一区二区三区| 成人av片在线观看| 色噜噜狠狠色综合欧洲selulu| 91久久精品网| 欧美成人一级视频| 国产精品入口麻豆原神| 一区二区三区精品在线| 免费成人结看片| 成人免费视频app| 欧美高清一级片在线| 久久精品这里都是精品| 亚洲欧美一区二区三区极速播放| 亚洲va欧美va人人爽午夜| 精品无人码麻豆乱码1区2区| 97精品电影院| 欧美一区二区福利视频| 中文字幕精品一区| 五月天久久比比资源色| 国产黑丝在线一区二区三区| 色综合久久综合中文综合网| 宅男噜噜噜66一区二区66| 国产精品久久看| 首页国产欧美久久| 91在线观看成人| 26uuu精品一区二区| 一区二区三区在线视频免费| 美女mm1313爽爽久久久蜜臀| 91麻豆国产在线观看|