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

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

?? decisiontree.java

?? 自己編的ID3算法很小但效果很好
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
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.

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区久久| 91蜜桃婷婷狠狠久久综合9色| 国产99精品视频| 亚洲精品成人在线| 久久精品av麻豆的观看方式| 精品视频免费看| 亚洲日本在线a| 成人不卡免费av| 自拍偷拍亚洲欧美日韩| 亚洲国产精品精华液2区45| 蜜臀久久久久久久| 91精品国产欧美日韩| 偷拍与自拍一区| 欧美一级理论片| 精品国产髙清在线看国产毛片| 日本不卡在线视频| 欧美一级国产精品| 国产精品自拍av| 综合在线观看色| 精品视频一区二区不卡| 天天影视网天天综合色在线播放| 欧美精品第1页| 国产一区在线精品| 亚洲三级视频在线观看| 欧美又粗又大又爽| 极品尤物av久久免费看| 国产精品无码永久免费888| 91免费视频大全| 午夜精品123| 中文字幕精品在线不卡| 欧美日韩一区小说| 国产精品18久久久久久久久久久久| 国产精品理伦片| 欧美性色aⅴ视频一区日韩精品| 亚洲成av人片在线观看无码| 亚洲精品一区二区三区福利| 91片在线免费观看| 国产亚洲一区字幕| 7878成人国产在线观看| 高清在线不卡av| 麻豆久久一区二区| 亚洲制服丝袜一区| 亚洲欧美影音先锋| 精品福利在线导航| 337p亚洲精品色噜噜| 91麻豆产精品久久久久久| 韩国欧美国产一区| 丝袜亚洲精品中文字幕一区| 中文字幕免费不卡在线| 久久综合九色综合97婷婷女人| 欧美午夜电影网| 日本精品免费观看高清观看| 国产一二精品视频| 国产精品1024| 亚洲午夜激情网站| 一级女性全黄久久生活片免费| 国产精品蜜臀av| 国产精品全国免费观看高清 | 久久午夜电影网| 精品国产麻豆免费人成网站| 日韩欧美电影一区| 日韩免费看的电影| 欧美电影免费观看高清完整版在线 | 亚洲精品国久久99热| 亚洲精品成人天堂一二三| 亚洲女人****多毛耸耸8| 亚洲综合在线五月| 美女一区二区视频| 亚洲男人电影天堂| 婷婷国产在线综合| 久久99久久99| 99久久er热在这里只有精品66| 色系网站成人免费| 欧美大白屁股肥臀xxxxxx| 国产网站一区二区三区| 国产精品久久久久精k8| 午夜欧美2019年伦理| 国产在线精品一区二区夜色 | 欧美精品第1页| 国产肉丝袜一区二区| 一区二区三区四区亚洲| 欧美日本乱大交xxxxx| 欧美美女激情18p| 色香蕉成人二区免费| 日韩视频在线你懂得| 国产欧美一区二区精品婷婷| www成人在线观看| 亚洲午夜久久久久久久久久久 | www.亚洲精品| 欧美一级淫片007| 日韩码欧中文字| 国内精品伊人久久久久av影院 | 亚洲午夜激情网站| 韩国女主播一区| 欧美丰满少妇xxxbbb| 日韩一区中文字幕| 精品在线播放免费| 7777女厕盗摄久久久| 国产一区二区在线观看视频| 91精品婷婷国产综合久久性色| 国产精品护士白丝一区av| 在线一区二区三区| 亚洲精品国产高清久久伦理二区| 国产麻豆精品视频| 欧美第一区第二区| 日韩写真欧美这视频| 美女诱惑一区二区| 欧美mv日韩mv亚洲| 国内精品国产成人| 久久欧美一区二区| 国产福利一区二区三区视频| 久久九九全国免费| 亚洲欧美日韩电影| 色94色欧美sute亚洲线路一久| 亚洲欧美精品午睡沙发| 99久久99久久综合| 亚洲bt欧美bt精品| 精品理论电影在线| 91丨porny丨户外露出| 7777精品伊人久久久大香线蕉完整版 | 在线免费av一区| 日本不卡一区二区三区高清视频| 69成人精品免费视频| 韩国成人在线视频| 亚洲图片欧美激情| 欧美精品 国产精品| 国模一区二区三区白浆| 丁香六月综合激情| 亚洲午夜激情网页| 国产欧美一区二区三区鸳鸯浴 | 麻豆精品在线视频| 综合欧美亚洲日本| 欧美一级二级在线观看| 麻豆精品一区二区| 亚洲综合图片区| 国产日韩欧美一区二区三区综合| 欧美日韩一区三区| 成人性生交大合| 久久精品国产第一区二区三区| 精品久久人人做人人爰| 欧美主播一区二区三区美女| 国产精品91一区二区| 日韩成人伦理电影在线观看| 亚洲美女电影在线| 亚洲欧洲无码一区二区三区| 欧美videos中文字幕| 日韩视频一区二区在线观看| 欧美三级中文字幕| 欧美无乱码久久久免费午夜一区| 粉嫩欧美一区二区三区高清影视| 日韩精品电影在线| 亚洲第一福利一区| 亚洲一区欧美一区| 亚洲综合久久久| 亚洲成人动漫av| 亚洲福利视频一区二区| 亚洲成年人网站在线观看| 亚洲狼人国产精品| 亚洲成av人影院| 香蕉成人啪国产精品视频综合网| 在线观看91精品国产麻豆| 一本到三区不卡视频| 视频一区视频二区中文| 99视频超级精品| 欧美日韩成人在线| 午夜欧美视频在线观看| 久久国产麻豆精品| 国产69精品久久久久毛片| 色婷婷国产精品| 2023国产精品视频| 一区二区三区国产豹纹内裤在线| 另类小说色综合网站| 成人精品在线视频观看| 91亚洲资源网| 欧美电视剧在线观看完整版| 亚洲品质自拍视频| 精品一区二区日韩| 亚洲线精品一区二区三区| 麻豆精品一区二区| 欧美日韩国产区一| 亚洲猫色日本管| 国产不卡在线播放| 日韩精品一区在线观看| 亚洲国产成人高清精品| 成人av影院在线| 国产拍揄自揄精品视频麻豆| 日韩精品亚洲一区二区三区免费| 成人黄色网址在线观看| 久久嫩草精品久久久精品一| 亚洲成人在线网站| 欧美影片第一页| 日韩综合小视频| 欧美一区二区三区思思人| 91豆麻精品91久久久久久| 91日韩一区二区三区| 久久久久青草大香线综合精品| 依依成人综合视频| 粉嫩欧美一区二区三区高清影视| 色系网站成人免费| 午夜精品久久久久影视|