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

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

?? decisiontree.java

?? Decision Tree 決策樹算法ID3 數(shù)據(jù)挖掘 分類
?? 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.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91丨九色丨蝌蚪丨老版| 国产黄色成人av| 在线观看日韩av先锋影音电影院| 亚洲欧洲日产国码二区| 91在线小视频| 一区二区三区视频在线看| 91福利在线观看| 日韩av一区二区三区| 日韩免费观看2025年上映的电影| 麻豆国产欧美一区二区三区| 久久免费午夜影院| 成人美女视频在线看| 日韩毛片在线免费观看| 欧美视频中文字幕| 激情文学综合插| 亚洲欧洲精品一区二区三区| 欧美色网站导航| 免费国产亚洲视频| 国产精品免费看片| 欧美蜜桃一区二区三区| 国产一区二区视频在线| 18成人在线视频| 欧美一区二区三区性视频| 韩国在线一区二区| 亚洲男人的天堂在线aⅴ视频| 欧美三级视频在线| 国产资源在线一区| 亚洲精品高清在线| 精品国产乱码久久久久久蜜臀| 国产精品一区二区在线播放 | 精品少妇一区二区三区视频免付费 | 中文字幕中文字幕一区| 欧美三级日韩三级国产三级| 国产麻豆一精品一av一免费| 一区二区三区色| 亚洲精品一区二区三区在线观看 | 国产一区二区电影| 亚洲激情中文1区| 久久久久国产精品麻豆ai换脸| 91丨porny丨国产入口| 视频在线在亚洲| 《视频一区视频二区| 91精品国产91综合久久蜜臀| 成人高清免费在线播放| 毛片不卡一区二区| 亚洲一区在线看| 中文字幕一区av| 久久看人人爽人人| 欧美一区二区私人影院日本| 色综合久久66| 波多野结衣视频一区| 美女视频网站黄色亚洲| 亚洲黄色录像片| 亚洲视频在线一区观看| 精品国产乱码久久久久久夜甘婷婷| 在线观看日韩一区| 99久久久国产精品| 成人激情午夜影院| 国产乱码字幕精品高清av| 免费观看30秒视频久久| 亚洲国产色一区| 亚洲男人天堂一区| 中文字幕亚洲一区二区va在线| 久久久精品tv| 国产日产欧美一区二区三区| 精品电影一区二区三区| 日韩一区二区三区四区| 欧美日韩在线播| 欧美自拍偷拍午夜视频| 色综合天天综合狠狠| 成人午夜在线免费| 国产成人精品网址| 国产成人av一区二区三区在线| 精品综合久久久久久8888| 免费人成精品欧美精品| 日日夜夜免费精品视频| 日韩黄色在线观看| 人人爽香蕉精品| 蜜桃av噜噜一区二区三区小说| 美女网站视频久久| 国产一区二区三区蝌蚪| 国产一区高清在线| 国产精品一品二品| 成人白浆超碰人人人人| 成人av网站免费观看| 99国产精品国产精品久久| 色综合网色综合| 欧美日韩国产精品自在自线| 91麻豆精品国产91久久久使用方法| 欧美日韩精品专区| 日韩三级高清在线| 久久久久国产精品麻豆| 亚洲国产精品成人综合| 自拍偷拍欧美精品| 亚洲一区二区三区四区的| 五月综合激情日本mⅴ| 免费日本视频一区| 韩国视频一区二区| av午夜精品一区二区三区| 在线视频观看一区| 日韩一二三区视频| 国产视频亚洲色图| 亚洲精品成人精品456| 日本午夜一区二区| 国产成人免费视频一区| 在线观看日韩精品| 欧美一区二区三区免费在线看 | av一区二区三区黑人| 欧美亚洲高清一区| 日韩视频一区二区在线观看| 中文无字幕一区二区三区| 亚洲精品高清在线| 久久99精品国产麻豆婷婷| www.66久久| 911精品国产一区二区在线| 亚洲成人激情社区| 国产精品伊人色| 日本国产一区二区| 欧美精品一区二| 夜夜爽夜夜爽精品视频| 激情欧美一区二区| 欧美日韩在线播放一区| 国产校园另类小说区| 亚洲国产精品一区二区久久| 精品制服美女丁香| 欧美午夜在线一二页| 久久久久亚洲蜜桃| 亚洲国产精品自拍| 99久久久久久99| 久久久噜噜噜久噜久久综合| 亚洲成人综合视频| 不卡的av中国片| 久久久亚洲精品石原莉奈| 天堂一区二区在线免费观看| 成人免费高清视频| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲欧美国产77777| 国产精品影视在线| 欧美一区二区三区免费| 亚洲综合成人网| 波多野结衣一区二区三区| 精品国产自在久精品国产| 亚洲一区免费视频| 99精品视频在线免费观看| 欧美mv日韩mv亚洲| 奇米精品一区二区三区在线观看| 色噜噜狠狠一区二区三区果冻| 国产农村妇女毛片精品久久麻豆 | 国产在线播放一区| 欧美剧情电影在线观看完整版免费励志电影 | 欧美亚男人的天堂| 国产精品久久看| 国产成人av资源| 久久天天做天天爱综合色| 日产国产高清一区二区三区| 在线看一区二区| 亚洲视频免费在线| 99久久综合精品| 国产精品乱人伦中文| 国产成人在线免费观看| 欧美精品一区二区三区蜜桃视频| 日韩精品视频网| 91精品国产一区二区三区蜜臀| 午夜电影网亚洲视频| 91精品福利视频| 亚洲一区视频在线观看视频| 在线精品视频免费观看| 亚洲激情欧美激情| 色婷婷av久久久久久久| 亚洲自拍偷拍欧美| 欧洲精品一区二区三区在线观看| 亚洲色图视频网| 欧洲激情一区二区| 天天操天天干天天综合网| 欧美日韩激情在线| 日韩av一级片| 久久蜜臀中文字幕| 成人免费不卡视频| 一区二区三区中文字幕精品精品| 欧美午夜精品一区二区蜜桃| 首页国产丝袜综合| 精品少妇一区二区三区在线视频| 国产在线一区二区| 国产精品久久三| 欧美唯美清纯偷拍| 美国三级日本三级久久99| 久久久久久久久久看片| 成人av在线影院| 一区二区三区波多野结衣在线观看| 欧美日韩一区在线观看| 理论电影国产精品| 国产欧美日产一区| 日本韩国一区二区三区视频| 天堂影院一区二区| 国产三级欧美三级日产三级99| 99精品视频在线免费观看| 亚洲成人av一区二区| 日韩欧美国产电影| 91在线一区二区三区| 视频在线观看一区|