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

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

?? nodecategorizer.java

?? 數據倉庫挖掘與開發 ID3算法實現代碼
?? 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在线播放一区二区三区| 国产馆精品极品| 中文字幕一区二区三区在线不卡 | 欧美日韩精品一区二区三区蜜桃| 国产福利电影一区二区三区| 国产一区二区三区免费观看| 精品亚洲porn| 国产精品亚洲视频| 国产一区二区导航在线播放| 国产精品白丝av| 成人av电影免费在线播放| youjizz久久| 色www精品视频在线观看| 色久综合一二码| 欧美二区在线观看| 欧美va在线播放| 中文字幕亚洲在| 亚洲欧美另类图片小说| 亚洲一区二区三区影院| 天天综合色天天| 久久精品国产精品亚洲综合| 国产乱码精品一区二区三区忘忧草 | 91精品国产乱码| 欧美成人三级在线| 国产精品嫩草久久久久| 亚洲男人的天堂一区二区 | 久久精品国产第一区二区三区| 蜜桃av噜噜一区| 高清国产一区二区| 日本久久电影网| 欧美一区二区在线免费观看| 久久精品视频在线看| 亚洲少妇屁股交4| 老司机免费视频一区二区三区| 国产成人午夜视频| 欧美亚洲国产一区二区三区| 日韩一级视频免费观看在线| 国产精品视频你懂的| 日韩影院免费视频| 成人黄色一级视频| 欧美高清视频在线高清观看mv色露露十八| 欧美一区二区在线不卡| 国产精品欧美极品| 奇米影视一区二区三区小说| 不卡在线视频中文字幕| 欧美一区二区三区男人的天堂| 国产精品久久久久久久久免费樱桃| 亚洲一二三四区不卡| 国产999精品久久久久久绿帽| 欧美性xxxxxx少妇| 国产精品久久久久影视| 久久er精品视频| 欧美日本免费一区二区三区| 中文字幕一区二区三区av | 久久久久国产精品厨房| 午夜精品久久久久久久99樱桃| 成人一区二区视频| 欧美成人一区二区三区片免费 | 欧美一区二区福利在线| 亚洲一级二级三级| 97久久精品人人做人人爽| 日韩欧美不卡一区| 日韩制服丝袜av| 欧美制服丝袜第一页| 国产精品麻豆欧美日韩ww| 国产xxx精品视频大全| 精品欧美一区二区在线观看| 五月天欧美精品| 欧洲色大大久久| 亚洲男女一区二区三区| 成人丝袜高跟foot| 国产精品麻豆视频| 97久久超碰精品国产| 国产精品不卡视频| 91亚洲精品久久久蜜桃| 国产精品久久久久久久浪潮网站| 国产成人免费视频一区| 久久久99久久精品欧美| 国产高清不卡一区| 国产精品热久久久久夜色精品三区| 国产成人三级在线观看| 国产精品女同一区二区三区| 91在线免费播放| 亚洲成人激情社区| 91精品国产综合久久久久久久| 日本不卡视频在线观看| 精品国产一区a| 在线欧美日韩精品| 亚洲电影你懂得| 精品久久一区二区三区| 国产专区欧美精品| 亚洲婷婷在线视频| 欧美四级电影网| 久久激情五月激情| 国产精品超碰97尤物18| 欧美日免费三级在线| 久久国产麻豆精品| 国产精品国产三级国产| 欧美日韩一区二区三区视频| 久久91精品国产91久久小草| 国产精品污网站| 欧美亚洲一区三区| 国产一区三区三区| 亚洲日本韩国一区| 4438x成人网最大色成网站| 国产99精品视频| 性久久久久久久久久久久| 久久一夜天堂av一区二区三区| 不卡视频一二三| 免费在线看一区| 亚洲精品乱码久久久久久黑人| 日韩一区二区三区免费观看| 99热99精品| 精品一区二区三区av| 一色桃子久久精品亚洲| 在线播放/欧美激情| 成人福利视频网站| 日本免费新一区视频| 欧美激情一区二区三区不卡 | 久久99国产精品免费网站| 中文字幕一区日韩精品欧美| 91精品国产色综合久久ai换脸 | 欧美精品久久99| 国产成人午夜片在线观看高清观看| 亚洲一区二区影院| 国产精品国产精品国产专区不片 | 亚洲国产电影在线观看| 欧美精品一级二级| 色悠久久久久综合欧美99| 国产一二三精品| 日本不卡123| 亚洲va在线va天堂| 亚洲图片欧美激情| 国产精品免费视频观看| 久久久午夜电影| 欧美一区二区在线看| 欧美日韩美女一区二区| 91福利在线导航| 成人激情综合网站| 国产成人亚洲综合色影视| 久久99精品久久久久久动态图| 亚洲第一久久影院| 亚洲综合另类小说| 亚洲精品国产一区二区精华液| 欧美韩日一区二区三区| 精品国产乱码久久久久久闺蜜| 欧美精三区欧美精三区| 欧美男男青年gay1069videost| 日本精品视频一区二区三区| 色噜噜狠狠色综合中国| 色狠狠一区二区| 一本久久精品一区二区| 99在线视频精品| 99re亚洲国产精品| 日本韩国欧美国产| 欧美三级日韩三级国产三级| 欧美私模裸体表演在线观看| 欧美图区在线视频| 欧美日韩视频第一区| 欧美日韩一级二级| 久久人人97超碰com| 国产日韩欧美一区二区三区乱码| 久久综合色8888| 国产欧美中文在线| 亚洲色图在线播放| 亚洲国产一区二区a毛片| 亚洲电影视频在线| 国内不卡的二区三区中文字幕| 国产精品资源在线看| 成人免费视频视频在线观看免费 | 久久久久久免费网| 国产精品成人免费精品自在线观看| 国产精品成人一区二区三区夜夜夜 | 有码一区二区三区| 天天操天天色综合| 国产激情视频一区二区在线观看| 成人午夜av影视| 欧美色区777第一页| 精品久久久久久久久久久久包黑料 | 国产毛片精品视频| 不卡的av电影| 欧美精品v国产精品v日韩精品 | 精品福利在线导航| 1024国产精品| 成人精品gif动图一区| 99久久国产综合精品麻豆| 欧美日韩成人一区二区| 欧美国产国产综合| 亚洲成a人片在线观看中文| 精品一区二区三区免费毛片爱| 成人深夜福利app| 欧美高清视频www夜色资源网| 精品国产乱码久久久久久老虎| |精品福利一区二区三区| 美女一区二区久久| 色婷婷综合久久久久中文 | 99久久精品99国产精品| 欧美精品v国产精品v日韩精品| 国产精品青草综合久久久久99| 日韩制服丝袜先锋影音|