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

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

?? decisiontree.java

?? ID3 分類決策數java代碼 需要ID3java代碼公用包
?? 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一区二区三区免费野_久草精品视频
欧美一区二视频| 91精品办公室少妇高潮对白| 91热门视频在线观看| 欧美日本一区二区在线观看| 国产亚洲欧美日韩在线一区| 亚洲午夜精品网| www.亚洲色图.com| 久久奇米777| 暴力调教一区二区三区| 亚洲人123区| 日韩激情一区二区| 97精品超碰一区二区三区| 精品久久久久久最新网址| 亚洲午夜精品在线| 91福利社在线观看| 亚洲欧美偷拍另类a∨色屁股| 国产一区二区三区在线观看免费| 欧美区视频在线观看| 亚洲综合一二三区| 亚洲国产sm捆绑调教视频| 成人综合婷婷国产精品久久蜜臀| 日韩午夜电影av| 图片区小说区区亚洲影院| 一本到高清视频免费精品| 欧美激情在线一区二区三区| 国产一区二区三区日韩| 精品成人一区二区三区| 精一区二区三区| 欧美电影免费观看完整版| 久久国产乱子精品免费女| 日韩欧美在线观看一区二区三区| 亚洲成人7777| 7777精品伊人久久久大香线蕉的| 亚洲v精品v日韩v欧美v专区| 欧美午夜在线一二页| 午夜欧美电影在线观看| 欧美一区日韩一区| 国产综合久久久久久鬼色| 久久网这里都是精品| 成人免费看的视频| 亚洲理论在线观看| 欧美天天综合网| 免费一区二区视频| 国产亚洲成年网址在线观看| youjizz国产精品| 亚洲综合免费观看高清完整版| 欧美美女网站色| 欧美aaaaa成人免费观看视频| 精品国内二区三区| 成人av网站免费观看| 一区二区在线观看免费视频播放| 欧美日韩国产成人在线免费| 裸体在线国模精品偷拍| 色综合色综合色综合色综合色综合| 亚洲国产精品久久人人爱蜜臀| 欧美网站大全在线观看| 日韩国产欧美视频| 精品久久久久99| av在线不卡电影| 日韩精品一二三| 久久久久免费观看| 色婷婷综合在线| 精品一区二区成人精品| 亚洲天堂av一区| 欧美美女一区二区三区| 丁香婷婷综合色啪| 午夜激情综合网| 欧美国产97人人爽人人喊| 欧美最新大片在线看 | 不卡视频一二三| 亚洲成人你懂的| 欧美激情一区二区三区蜜桃视频| 91免费在线看| 国产福利一区二区三区在线视频| 精品中文av资源站在线观看| 亚洲制服丝袜一区| 91精品啪在线观看国产60岁| 国产精品66部| 亚洲成av人片一区二区梦乃| 国产无一区二区| 91精品一区二区三区久久久久久| 粉嫩嫩av羞羞动漫久久久| 奇米888四色在线精品| 亚洲免费观看高清完整版在线观看熊| 欧美一卡2卡三卡4卡5免费| 99国产精品久久久久久久久久久| 视频一区二区国产| 亚洲精品伦理在线| 中文字幕国产一区| 精品国产一区二区亚洲人成毛片 | 国产精品亚洲一区二区三区妖精 | 国产99久久久国产精品免费看| 午夜欧美在线一二页| 久久久久久久久一| 欧美日本国产一区| 91麻豆国产在线观看| 国产精品91一区二区| 久久99精品国产| 婷婷成人激情在线网| 一区二区免费视频| 亚洲日本乱码在线观看| 国产精品每日更新| 欧美激情一区不卡| 国产欧美日韩在线视频| 精品日韩成人av| 日韩一区二区三区在线| 欧美一卡二卡在线| 欧美一区二区三区在线观看| 3d动漫精品啪啪| 日韩一级完整毛片| 欧美电影精品一区二区| 精品欧美黑人一区二区三区| 日韩一区二区麻豆国产| 亚洲精品在线电影| 久久综合中文字幕| 久久久精品综合| 久久成人免费网站| 一区二区三区国产精品| 亚洲男女毛片无遮挡| 中文字幕一区二区三区四区| 欧美国产精品久久| 亚洲欧美激情在线| 亚洲最新视频在线观看| 亚洲午夜国产一区99re久久| 亚洲国产日韩a在线播放性色| 亚洲电影中文字幕在线观看| 天天色 色综合| 久久不见久久见中文字幕免费| 精品一区二区三区在线播放视频| 国产精品自在在线| 色婷婷亚洲综合| 7777精品伊人久久久大香线蕉完整版 | 色8久久人人97超碰香蕉987| 欧美三电影在线| 欧美成人a视频| 中文一区二区在线观看| 亚洲美女少妇撒尿| 亚洲444eee在线观看| 老司机精品视频在线| 国产suv一区二区三区88区| 色婷婷综合五月| 91成人国产精品| 91.xcao| 久久久精品影视| 国产精品免费网站在线观看| 《视频一区视频二区| 视频在线在亚洲| 国产成人精品影视| 欧美日韩在线播放一区| 久久久久国产成人精品亚洲午夜| 18成人在线观看| 蜜臀精品一区二区三区在线观看 | 国产精品麻豆网站| 丝袜诱惑制服诱惑色一区在线观看| 精品亚洲免费视频| 波多野洁衣一区| 日韩欧美国产高清| 亚洲男女一区二区三区| 国产美女精品人人做人人爽 | av亚洲精华国产精华| 欧美一区二视频| www.日韩大片| 精品日本一线二线三线不卡| 亚洲美女电影在线| 国产99久久久国产精品免费看| 欧美军同video69gay| 中文字幕一区在线| 麻豆精品在线看| 日韩女同互慰一区二区| 一区二区三国产精华液| 东方aⅴ免费观看久久av| 欧美成人综合网站| 亚洲成a天堂v人片| 色婷婷综合激情| 国产精品高潮呻吟| 国产一区999| 日韩一级二级三级| 亚洲r级在线视频| 色一区在线观看| 亚洲欧美在线观看| 国产+成+人+亚洲欧洲自线| 欧美变态tickle挠乳网站| 五月婷婷综合激情| 色吊一区二区三区| 亚洲天堂精品视频| 97久久人人超碰| 中文字幕一区二区三| 波多野结衣亚洲| 久久美女艺术照精彩视频福利播放| 天堂成人免费av电影一区| 欧美性生活一区| 亚洲成a人v欧美综合天堂| 欧美亚洲国产一区在线观看网站 | 色哟哟在线观看一区二区三区| 欧美激情一区二区三区| 成人黄页毛片网站| 中文字幕 久热精品 视频在线| 国产成人av电影| 1024精品合集| 成人午夜看片网址|