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

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

?? decisiontree.java

?? 此編碼是一個數據挖掘的決策樹各種算法。以作為入門提示
?? 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一区二区三区免费野_久草精品视频
高潮精品一区videoshd| 色综合久久久久久久久| 亚洲国产一区二区视频| 久久久九九九九| 在线观看欧美精品| 国产成人精品网址| 美女被吸乳得到大胸91| 一区二区三区欧美久久| 亚洲国产精品高清| 日韩午夜激情av| 欧美唯美清纯偷拍| 99久久婷婷国产综合精品| 久久国产精品区| 日日欢夜夜爽一区| 亚洲精品视频在线看| 亚洲国产成人自拍| ww久久中文字幕| 91精品国产品国语在线不卡| 一本到不卡免费一区二区| 国产米奇在线777精品观看| 日韩av网站免费在线| 亚洲午夜电影在线| 一区2区3区在线看| 亚洲你懂的在线视频| 亚洲欧洲日韩女同| 欧美国产日韩一二三区| 久久久99久久| 精品国产一区二区国模嫣然| 日韩欧美美女一区二区三区| 欧美人牲a欧美精品| 欧美日韩一级视频| 欧美日韩大陆一区二区| 欧美日韩在线免费视频| 欧美综合色免费| 日本乱人伦aⅴ精品| 色中色一区二区| 91免费视频网| 91福利精品视频| 欧美在线观看18| 91久久精品网| 精品视频一区二区不卡| 9191国产精品| 欧美一卡二卡三卡| 日韩三级在线观看| 精品国产乱码久久久久久浪潮| 日韩欧美亚洲国产另类| 精品久久久久久久久久久久包黑料| 制服丝袜中文字幕亚洲| 欧美一级免费大片| 精品久久久久久无| 久久久国产精品麻豆 | 精品国产免费人成在线观看| 精品欧美黑人一区二区三区| 久久女同精品一区二区| 国产婷婷精品av在线| 亚洲青青青在线视频| 亚洲精品久久7777| 午夜精品爽啪视频| 日本人妖一区二区| 国产精品影音先锋| 91丝袜国产在线播放| 欧美午夜宅男影院| 91精品国产综合久久久久| 欧美成人精精品一区二区频| 久久亚洲春色中文字幕久久久| 欧美激情中文不卡| 亚洲专区一二三| 91麻豆产精品久久久久久| 欧美美女视频在线观看| 日韩免费高清电影| 中文字幕在线观看一区| 天堂成人免费av电影一区| 国产一区二区剧情av在线| 91性感美女视频| 制服丝袜国产精品| 中文字幕第一区| 午夜精品视频在线观看| 国产精品一卡二| 欧美性色aⅴ视频一区日韩精品| 日韩免费高清视频| 亚洲免费观看高清完整版在线观看| 午夜精品一区在线观看| 国产1区2区3区精品美女| 91免费小视频| 亚洲精品在线观| 一区二区三区蜜桃网| 蜜臀av亚洲一区中文字幕| 91网站在线播放| 久久久影院官网| 天堂va蜜桃一区二区三区| 成人高清视频免费观看| 5566中文字幕一区二区电影| 亚洲国产高清不卡| 蜜桃视频第一区免费观看| 97se亚洲国产综合在线| 日韩精品中文字幕一区二区三区| 亚洲女同一区二区| 国产成人免费高清| 欧美日韩精品专区| 中文字幕在线一区二区三区| 免费高清在线视频一区·| 91行情网站电视在线观看高清版| 亚洲精品一区二区三区99| 婷婷中文字幕综合| 一本色道综合亚洲| 国产三级精品视频| 美女视频黄免费的久久| 91久久精品一区二区| 国产精品美女久久久久av爽李琼| 日本在线播放一区二区三区| 91麻豆swag| 国产精品久久福利| 国产成人免费视频精品含羞草妖精| 91精品国产品国语在线不卡| 亚洲成人av一区二区| 色综合天天综合色综合av| 国产欧美精品日韩区二区麻豆天美| 蜜臀91精品一区二区三区| 欧美日韩高清影院| 亚洲大片精品永久免费| 在线影院国内精品| 亚洲精品中文字幕乱码三区| 成人av在线电影| 中文字幕av资源一区| 国产精品123| 欧美经典一区二区| 国产精品自拍一区| 久久在线观看免费| 久久成人综合网| 日韩欧美一区在线观看| 蜜桃一区二区三区在线| 日韩欧美在线1卡| 六月丁香综合在线视频| 欧美大白屁股肥臀xxxxxx| 美女国产一区二区| 337p粉嫩大胆噜噜噜噜噜91av| 久久 天天综合| 精品成a人在线观看| 国产综合色精品一区二区三区| 欧美第一区第二区| 极品少妇一区二区| 久久久精品国产99久久精品芒果| 国产一本一道久久香蕉| 中文字幕精品一区| av不卡一区二区三区| 一区二区高清在线| 欧美日韩国产在线播放网站| 日韩av在线发布| 精品福利视频一区二区三区| 国产91露脸合集magnet | 精品国产亚洲在线| 国产一区二区女| 国产精品视频免费看| 色天天综合久久久久综合片| 亚洲午夜精品网| 欧美sm极限捆绑bd| 国产成人在线色| 亚洲激情av在线| 欧美一级在线观看| 国产98色在线|日韩| 亚洲狠狠丁香婷婷综合久久久| 7777精品伊人久久久大香线蕉经典版下载 | 日韩avvvv在线播放| 精品久久一二三区| va亚洲va日韩不卡在线观看| 亚洲一区二区三区四区五区黄| 6080亚洲精品一区二区| 国产真实乱偷精品视频免| 国产精品美女久久久久久2018| 色婷婷亚洲精品| 久久狠狠亚洲综合| 中文字幕在线不卡| 欧美精三区欧美精三区| 国产一区二区三区国产| 一区二区三区日韩欧美精品| 日韩午夜中文字幕| av亚洲产国偷v产偷v自拍| 五月天激情综合| 国产午夜精品久久久久久免费视| 91网站最新网址| 国内精品嫩模私拍在线| 亚洲男女一区二区三区| 欧美xxxx老人做受| 97久久久精品综合88久久| 免费久久99精品国产| 亚洲女人****多毛耸耸8| 久久综合九色综合97婷婷女人| 91欧美一区二区| 国产乱码精品一区二区三区忘忧草 | 91精品在线免费| 成人免费视频网站在线观看| 丝瓜av网站精品一区二区 | 日韩欧美在线综合网| a4yy欧美一区二区三区| 麻豆免费精品视频| 一区二区三区高清| 欧美激情一区二区三区四区| 欧美一级欧美三级在线观看 | 日本福利一区二区| 国产精品一卡二卡|