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

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

?? decisiontree.java

?? 數據倉庫挖掘與開發 ID3算法實現代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package id3;
import java.io.*;
import shared.*;
import shared.Error;

/** DecisonTrees are RootedCatGraphs where each node other than the root has
 * exactly one parent.  The root has no parents.
 * @author James Louis 5/29/2001   Ported to Java.
 * @author Eric Eros 4/18/96 Added delete_subtree
 * @author Ronny Kohavi  4/16/96 Added treeviz display
 * @author Richard Long 9/02/93 Initial revision (.c,.h)
 */

public class DecisionTree extends RootedCatGraph {
    /** Indicates if this DecisionTree is sparsely populated.
     */
    boolean isGraphSparse = false;
    
    /** Constructor.
     */
    public DecisionTree() {
        super(false);
    }
    
    /** Constructor.
     * @param grph The CGraph object to be used to maintain the DecisionTree.
     */
    public DecisionTree(CGraph grph) {
        super(grph, false);
    }
    
    /** Distribute instances to a subtree. This function is used whenever we
     * replace a node with its child.  The distributions of the child include
     * only the instances there while if we replace, we must update all the
     * counts. This function is also the backfitting function for decision trees.
     * @param subtree The subtree over which Instances will be distributed.
     * @param il InstanceList to be distributed over the DecisionTree.
     * @param pruningFactor The amount of pruning to be done on this tree.
     * @param pessimisticErrors Number of errors estimated for the new distribution.
     * @param ldType Leaf Distribution Type.
     * @param leafDistParameter The distribution of instances that reach this leaf node.
     * @param parentWeightDist The weight distribution of the parent node.
     */
    public void distribute_instances(Node subtree,
    InstanceList il,
    double pruningFactor,
    DoubleRef pessimisticErrors,
    int ldType, 			//TDDTInducer.LeafDistType
    double leafDistParameter,
    double[] parentWeightDist) {
        distribute_instances(subtree,il,pruningFactor,pessimisticErrors,ldType,
        leafDistParameter,parentWeightDist,false);
    }
    
    /** Distribute instances to a subtree. This function is used whenever we
     * replace a node with its child.  The distributions of the child include
     * only the instances there while if we replace, we must update all the
     * counts. This function is also the backfitting function for decision trees.
     * @param subtree The subtree over which Instances will be distributed.
     * @param il InstanceList to be distributed over the DecisionTree.
     * @param pruningFactor The amount of pruning to be done on this tree.
     * @param pessimisticErrors Number of errors estimated for the new distribution.
     * @param ldType Leaf Distribution Type.
     * @param leafDistParameter The distribution of instances that reach this leaf node.
     * @param parentWeightDist The weight distribution of the parent node.
     * @param saveOriginalDistr TRUE if the original instance distribution should be preserved, FALSE otherwise.
     */
    public void distribute_instances(Node subtree,
    InstanceList il,
    double pruningFactor,
    DoubleRef pessimisticErrors,
    int ldType, 			//TDDTInducer.LeafDistType
    double leafDistParameter,
    double[] parentWeightDist,
    boolean saveOriginalDistr) {
        //   DBGSLOW(check_node_in_graph(subtree, TRUE));
        NodeCategorizer splitCat = ((NodeInfo)cGraph.inf(subtree)).get_categorizer();
        
        logOptions.LOG(3, "Distributing instances: " + il + '\n' + "categorizer is "
        +splitCat.description()+'\n');
        
        splitCat.distribute_instances(il, pruningFactor, pessimisticErrors, ldType,
        leafDistParameter, parentWeightDist,
        saveOriginalDistr);
    }
    
    /** Removes a subtree recursively. This is used to                           <BR>
     * a)  Remove a node and all nodes below it if the second parameter is NULL,<BR>
     * b)  Remove just the nodes under a particular node, if both parameters are
     * the same (the named node remains in the graph).                          <BR>
     * c)  Replace the subtree rooted at the first parameter with the subtree
     * rooted at the second parameter, if the two parameters are not equal, and
     * are non-null.                                                            <P>
     * We allow replacing node X with a child of node X (or a node related
     * through comman ancestors) or, in general, replacing a subtree with
     * another subtree. In both cases, we disconnect the parents of the new node
     * node from the new node.                                                  <P>
     * We do not allow replacing node X with an ancester (parent, etc.) of
     * node X, as this would make no sense.                                     <P>
     * The method is as follows:                                                <P>
     * 1)  If 'node' is to be deleted, delete the edges connecting it to its
     * parents.                                                                 <BR>
     * 2)  If 'node' is to be replaced by 'newNode', delete the edges connecting
     * 'newNode' to its parents.                                                <BR>
     * 3)  Delete the edges from 'node' to all its children.                    <BR>
     * 4)  If 'node' is to be deleted, since it's now completely disconnected,
     * delete it.                                                               <BR>
     * 5)  If 'node' is to be replaced by 'newNode',                            <BR>
     * 5a)  Connect all of 'newNode's children to 'node' (adding edges),        <BR>
     * 5b)  Delete all the edges from 'newNode' to its children.                <BR>
     * 5c)  Since 'newNode' is now completely disconnected, delete it.          <BR>
     * 6)  For all the children discovered in step 3, recurse to delete them.
     * @param node Node to be replaced.
     * @param newNode New Node to be used for replacement.
     */
    public void delete_subtree(Node node, Node newNode) {
        if (node == null)
            Error.fatalErr("DecisionTree::delete_subtree: node is NULL");
        
        // Delete a subtree, given the starting  node.  The second parameter
        //   NULL means the top-most node is deleted--it is set NULL for all
        //   recursive calls from here, so that all children are deleted.  If the
        //   second parameter is non-NULL, it needs to point to a node in the
        //   same cGraph as the first.
        boolean deleteNode = (newNode == null);
        boolean replaceWithSelf = (node == newNode);
        boolean replaceWithOther = !deleteNode && !replaceWithSelf;
        
        // We can extend this routine to support the new node being the root,
        //   but it seems very strange to do so, since we usually delete the
        //   newNode.
        //   One would need to set the new node to be the root.  For safely
        //   it's better to abort in this case that can't happen right now.
        // Note that replacing the root with a child is OK and the root
        //   will be the new node because it's the categorizer that's replace,
        //   and the root reference remains valid
        if (!replaceWithSelf && newNode == get_root())
            Error.fatalErr("DecisionTree::delete_subtree: new node cannot be root");
        
        if (deleteNode)
            logOptions.LOG(5, " 1. Deleting the node " + node + '\n');
        else
            logOptions.LOG(5, " 2. Removing the subtree from node " + node + '\n');
        if (!deleteNode && !replaceWithSelf)
            logOptions.LOG(5, " 3. Replacing it with the node " + newNode + '\n');
        
        // Ensure specified node(s) in graph (check_node_in_graph(node, TRUE)
        //   aborts when node isn't in graph.)
        //   DBGSLOW(check_node_in_graph(node, TRUE));
        if (replaceWithOther) {
            check_node_in_graph(newNode, true);
            // 'node' is to be replaced with 'newNode'.  This is only legal when
            //   'newNode' is NOT an ancester of 'node'.
            // The following function is only called once, as newNode is NULL in
            //   all recursive calls.
            //      DBG(if (check_node_reachable(newNode, node))
            //	    err << "DecisionTree::delete_subtree: attempt to replace a "
            //	       "node with its own ancestor" << fatal_error);
        }
        
        Edge iterEdge;
        Edge oldEdge;
        if (deleteNode) {
            // If 'node' is to be deleted, remove the edges from its parent(s).
            iterEdge = node.first_in_edge();
            while (iterEdge != null) {
                oldEdge = iterEdge;
                iterEdge = oldEdge.in_succ(oldEdge);
                //	 oldEdge.entry() = null;
                cGraph.del_edge(oldEdge);
            }
            MLJ.ASSERT(node.indeg() == 0,"DecisionTree.delete_subtree: node.indeg() != 0");
        }
        
        // 'node' is to be replaced with 'newNode'.  That means that the
        //   current incoming edges to 'newNode' are extraneous, and need
        //   to be removed.
        if (replaceWithOther) {
            iterEdge = newNode.first_in_edge();
            while (iterEdge != null) {
                oldEdge = iterEdge;
                iterEdge = oldEdge.in_succ(oldEdge);
                Node parentNode = oldEdge.source();
                logOptions.LOG(5, " 4. Removing parent " + parentNode + " from " + newNode
                + " (deleting edge " + oldEdge + ")" + '\n');
                //	 cGraph[oldEdge] = null;
                cGraph.del_edge(oldEdge);
            }
            MLJ.ASSERT(newNode.indeg() == 0,"DecisionTree.delete_subtree: newNode.indeg() != 0");
        }
        // Disconnect 'node' (the old node) from all outgoing edges.  Save references
        //   to the targets of these edges so we can (effectively) follow them,
        int numChildren = node.outdeg();
        int currentChild = 0;
        
        MLJ.ASSERT(numChildren >= 0,"DecisionTree.delete_subtree: numChildren < 0");
        // Declared before the loop because we use it after the if
        //    for replaceWithSelf.
        Node[] children = new Node[numChildren];
        if (numChildren > 0) {
            // We're not a leaf, we've got children to delete.
            //    a) Copy the (references to the) children nodes.
            //    b) Delete the edges.
            iterEdge = node.first_adj_edge();
            while (iterEdge != null) {
                logOptions.LOG(5, " 7. Disconnecting edge " + iterEdge
                + " from node " + node + " to its child " + '\n'
                +  iterEdge.target() + '\n');
                oldEdge = iterEdge;
                iterEdge = oldEdge.adj_succ();
                // Save the other node attached to this edge.
                Node childNode = oldEdge.target();
                children[currentChild++] = childNode;
                // Delete the connection.
                //	 cGraph[oldEdge] = null;
                cGraph.del_edge(oldEdge);
            }
        }
        MLJ.ASSERT(currentChild == numChildren,"DecisionTree.delete_subtree: currentChild != numChildren");
        MLJ.ASSERT(node.outdeg() == 0,"DecisionTree.delete_subtree: node.outdeg() != 0");
        
        // Delete the node.
        if (deleteNode) {
            logOptions.LOG(5, " 8. Deleting the node " + node + '\n');
            MLJ.ASSERT(node.indeg() == 0,"DecisionTree.delete_subtree: node.indeg() != 0");
            MLJ.ASSERT(node.outdeg() == 0,"DecisionTree.delete_subtree: node.outdeg() != 0");
            //      cGraph[node] = null;
            cGraph.del_node(node);
        }
        else if (replaceWithOther) {
            // Delete 'newNode' after moving all its children over to 'node',
            //  and assigning its categorizer to 'node'.
            cGraph.assign_categorizer(node, newNode);
            iterEdge = newNode.first_adj_edge();
            while (iterEdge != null) {
                oldEdge = iterEdge;
                iterEdge = oldEdge.adj_succ();
                Node childNode = oldEdge.target();
                AugCategory aug = new
                AugCategory(cGraph.edge_info(oldEdge).num(),
                cGraph.edge_info(oldEdge).description());
                cGraph.new_edge(node, childNode, aug);
                //	 cGraph[oldEdge] = null;
                cGraph.del_edge(oldEdge);
            }
            MLJ.ASSERT(newNode.indeg() == 0,"DecisionTree.delete_subtree: newNode.indeg() != 0");
            MLJ.ASSERT(newNode.outdeg() == 0,"DecisionTree.delete_subtree: newNode.outdeg() != 0");
            //      cGraph.entry(newNode) = null;
            cGraph.del_node(newNode);
            // Re-assign the levels of each node in the subtree we just moved.
            if (get_graph().node_info(node).level() != CGraph.DEFAULT_LEVEL)
                assign_subtree_levels(node, get_graph().node_info(node).level());
        }
        // Recurse--all children must delete themselves.
        for (currentChild = 0; currentChild < numChildren; currentChild++) {
            logOptions.LOG(5, " 9. Now to delete child " + currentChild + " of "
            + numChildren + " children" + '\n');
            delete_subtree(children[currentChild], null);
        }
    }
    
    /** Creates NodeInfo objects for every Node in the branch starting at the
     * given Node and assigns each NodeInfo its appropriate level in the tree.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区免费观看| 亚洲综合网站在线观看| 欧美日韩成人激情| 一本久久综合亚洲鲁鲁五月天| 国产成人午夜视频| 岛国一区二区三区| www.综合网.com| 色综合久久综合网97色综合| 99riav久久精品riav| 色综合色狠狠天天综合色| 一本久久综合亚洲鲁鲁五月天| 91丨九色丨国产丨porny| 色综合久久久久综合体| 精品视频1区2区3区| 欧美精品精品一区| 精品国产乱码久久久久久牛牛| 欧美成人福利视频| 国产欧美日产一区| 亚洲一区在线观看网站| 婷婷综合另类小说色区| 麻豆精品久久精品色综合| 激情综合五月婷婷| 99精品在线观看视频| 欧美在线综合视频| 精品少妇一区二区三区在线播放 | 久久国产精品99精品国产| 免费观看91视频大全| 国产成人av电影在线| 91亚洲午夜精品久久久久久| 欧美日韩成人综合在线一区二区| 欧美成人免费网站| 亚洲免费观看高清完整版在线观看| 亚洲国产成人av网| 韩国精品一区二区| 91色porny在线视频| 欧美人伦禁忌dvd放荡欲情| 精品久久久久久无| 亚洲一区二区视频在线观看| 日本午夜一区二区| 91老师国产黑色丝袜在线| 欧美一卡二卡三卡| 亚洲精品国产一区二区三区四区在线| 午夜欧美2019年伦理| 成人久久18免费网站麻豆| 欧美二区乱c少妇| 亚洲视频图片小说| 国产成人欧美日韩在线电影| 色老汉一区二区三区| 久久久久久久久久久久久久久99 | 香蕉加勒比综合久久| 国产成人精品三级麻豆| 欧美日韩免费高清一区色橹橹 | 亚洲视频一区二区在线| 蜜桃免费网站一区二区三区| 91网站在线观看视频| 久久久久国产精品厨房| 日韩影院精彩在线| 欧美在线视频全部完| 国产精品乱人伦| 国产一区二区三区四区五区入口| 欧美在线观看18| 亚洲天堂网中文字| 成人激情图片网| 欧美xxxx在线观看| 日本免费在线视频不卡一不卡二| 欧美在线制服丝袜| 一区二区三区欧美| 色综合色综合色综合色综合色综合 | 欧美中文字幕一二三区视频| 国产精品欧美经典| 成人免费毛片a| 中文字幕免费观看一区| 久久99国产精品尤物| 宅男噜噜噜66一区二区66| 亚洲综合激情另类小说区| 91美女蜜桃在线| 日韩伦理电影网| 在线亚洲一区二区| 偷拍与自拍一区| 欧美丰满一区二区免费视频| 亚洲成av人片www| 欧美肥大bbwbbw高潮| 蜜桃av一区二区在线观看| 欧美电影免费观看高清完整版在线 | 国v精品久久久网| 精品粉嫩超白一线天av| 国产一区二区女| 国产香蕉久久精品综合网| 成人一区在线看| 亚洲欧洲一区二区在线播放| 日本乱码高清不卡字幕| 午夜视频一区二区| 91精品国产综合久久久久久久| 亚洲欧美一区二区三区极速播放| 久久99精品久久久| 日韩欧美激情在线| 懂色av一区二区三区蜜臀| 国产精品免费久久久久| 97se亚洲国产综合在线| 亚洲宅男天堂在线观看无病毒| 欧美日韩一区二区三区四区五区| 男男视频亚洲欧美| 久久久久久久久一| 日本黄色一区二区| 久久激五月天综合精品| 欧美国产成人在线| 欧美区视频在线观看| 国产精品一区专区| 亚洲一区中文在线| 久久在线免费观看| 色噜噜狠狠一区二区三区果冻| 蜜臀国产一区二区三区在线播放| 久久精品亚洲精品国产欧美| 色屁屁一区二区| 国产一区视频导航| 亚洲一区二区三区四区在线 | 色综合色综合色综合| 天堂久久一区二区三区| 国产女人18水真多18精品一级做| 在线亚洲一区观看| 国产1区2区3区精品美女| 亚洲va欧美va人人爽| 国产精品视频线看| 日韩一区二区免费电影| 色94色欧美sute亚洲线路一ni| 国产一区二区视频在线播放| 午夜日韩在线观看| 亚洲欧美日韩国产综合在线| 日韩一区二区三区电影在线观看| 色狠狠av一区二区三区| 国产成人精品三级| 久久成人免费网站| 亚洲综合在线观看视频| 国产精品天天看| www国产精品av| 日韩一区和二区| 69av一区二区三区| 在线成人午夜影院| 欧美日韩三级一区| 91成人在线精品| 91免费观看视频在线| 东方aⅴ免费观看久久av| 国产在线精品一区二区不卡了 | 午夜精品久久久久久久99樱桃| 国产精品的网站| 中文字幕久久午夜不卡| 久久婷婷一区二区三区| 精品久久久久久久久久久久包黑料| 在线观看日韩高清av| 一本色道久久综合精品竹菊| 成人久久视频在线观看| 丁香亚洲综合激情啪啪综合| 国产高清精品在线| 成人黄页在线观看| 丁香桃色午夜亚洲一区二区三区| 久草精品在线观看| 国产精品一品二品| 国产成人精品免费网站| 成人精品高清在线| 国产69精品久久久久毛片| 成人福利视频在线| av影院午夜一区| 91色综合久久久久婷婷| 91激情五月电影| 欧美人与z0zoxxxx视频| 制服丝袜亚洲播放| 日韩亚洲欧美在线观看| 337p日本欧洲亚洲大胆精品| 国产欧美视频一区二区| 《视频一区视频二区| 亚洲国产视频网站| 蜜臀av在线播放一区二区三区 | 亚洲视频电影在线| 亚洲一区二区在线观看视频| 午夜精品久久久久久久| 精品一二三四区| 成人激情文学综合网| 色94色欧美sute亚洲13| 欧美一级夜夜爽| 国产欧美一区二区三区在线看蜜臀| 国产精品久久久一本精品| 亚洲永久免费av| 国产最新精品免费| 在线视频国内一区二区| 欧美大片在线观看一区二区| 国产精品美女久久久久久久久| 一区二区三区免费网站| 久久国产剧场电影| 欧美最新大片在线看| 精品国产a毛片| 亚洲视频一区二区在线观看| 天堂一区二区在线| 99精品偷自拍| 精品少妇一区二区三区视频免付费| 国产精品毛片无遮挡高清| 日韩在线a电影| 色婷婷综合五月| 精品国精品国产尤物美女| 亚洲精品菠萝久久久久久久| 久久99精品久久久|