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

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

?? randomforest.java

?? Weka
?? JAVA
字號:
/* *    This program is free software; you can redistribute it and/or modify *    it under the terms of the GNU General Public License as published by *    the Free Software Foundation; either version 2 of the License, or *    (at your option) any later version. * *    This program is distributed in the hope that it will be useful, *    but WITHOUT ANY WARRANTY; without even the implied warranty of *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *    GNU General Public License for more details. * *    You should have received a copy of the GNU General Public License *    along with this program; if not, write to the Free Software *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//* *    RandomForest.java *    Copyright (C) 2001 University of Waikato, Hamilton, New Zealand * */package weka.classifiers.trees;import weka.classifiers.Classifier;import weka.classifiers.meta.Bagging;import weka.core.AdditionalMeasureProducer;import weka.core.Capabilities;import weka.core.Instance;import weka.core.Instances;import weka.core.Option;import weka.core.OptionHandler;import weka.core.Randomizable;import weka.core.TechnicalInformation;import weka.core.TechnicalInformationHandler;import weka.core.Utils;import weka.core.WeightedInstancesHandler;import weka.core.TechnicalInformation.Field;import weka.core.TechnicalInformation.Type;import java.util.Enumeration;import java.util.Vector;/** <!-- globalinfo-start --> * Class for constructing a forest of random trees.<br/> * <br/> * For more information see: <br/> * <br/> * Leo Breiman (2001). Random Forests. Machine Learning. 45(1):5-32. * <p/> <!-- globalinfo-end --> * <!-- technical-bibtex-start --> * BibTeX: * <pre> * &#64;article{Breiman2001, *    author = {Leo Breiman}, *    journal = {Machine Learning}, *    number = {1}, *    pages = {5-32}, *    title = {Random Forests}, *    volume = {45}, *    year = {2001} * } * </pre> * <p/> <!-- technical-bibtex-end --> * <!-- options-start --> * Valid options are: <p/> *  * <pre> -I &lt;number of trees&gt; *  Number of trees to build.</pre> *  * <pre> -K &lt;number of features&gt; *  Number of features to consider (&lt;1=int(logM+1)).</pre> *  * <pre> -S *  Seed for random number generator. *  (default 1)</pre> *  * <pre> -depth &lt;num&gt; *  The maximum depth of the trees, 0 for unlimited. *  (default 0)</pre> *  * <pre> -D *  If set, classifier is run in debug mode and *  may output additional info to the console</pre> *  <!-- options-end --> * * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz) * @version $Revision: 1.12 $ */public class RandomForest   extends Classifier   implements OptionHandler, Randomizable, WeightedInstancesHandler,              AdditionalMeasureProducer, TechnicalInformationHandler {  /** for serialization */  static final long serialVersionUID = 4216839470751428698L;    /** Number of trees in forest. */  protected int m_numTrees = 10;  /** Number of features to consider in random feature selection.      If less than 1 will use int(logM+1) ) */  protected int m_numFeatures = 0;  /** The random seed. */  protected int m_randomSeed = 1;    /** Final number of features that were considered in last build. */  protected int m_KValue = 0;  /** The bagger. */  protected Bagging m_bagger = null;    /** The maximum depth of the trees (0 = unlimited) */  protected int m_MaxDepth = 0;  /**   * Returns a string describing classifier   * @return a description suitable for   * displaying in the explorer/experimenter gui   */  public String globalInfo() {    return          "Class for constructing a forest of random trees.\n\n"      + "For more information see: \n\n"      + getTechnicalInformation().toString();  }  /**   * Returns an instance of a TechnicalInformation object, containing    * detailed information about the technical background of this class,   * e.g., paper reference or book this class is based on.   *    * @return the technical information about this class   */  public TechnicalInformation getTechnicalInformation() {    TechnicalInformation 	result;        result = new TechnicalInformation(Type.ARTICLE);    result.setValue(Field.AUTHOR, "Leo Breiman");    result.setValue(Field.YEAR, "2001");    result.setValue(Field.TITLE, "Random Forests");    result.setValue(Field.JOURNAL, "Machine Learning");    result.setValue(Field.VOLUME, "45");    result.setValue(Field.NUMBER, "1");    result.setValue(Field.PAGES, "5-32");        return result;  }    /**   * Returns the tip text for this property   * @return tip text for this property suitable for   * displaying in the explorer/experimenter gui   */  public String numTreesTipText() {    return "The number of trees to be generated.";  }  /**   * Get the value of numTrees.   *   * @return Value of numTrees.   */  public int getNumTrees() {        return m_numTrees;  }    /**   * Set the value of numTrees.   *   * @param newNumTrees Value to assign to numTrees.   */  public void setNumTrees(int newNumTrees) {        m_numTrees = newNumTrees;  }    /**   * Returns the tip text for this property   * @return tip text for this property suitable for   * displaying in the explorer/experimenter gui   */  public String numFeaturesTipText() {    return "The number of attributes to be used in random selection (see RandomTree).";  }  /**   * Get the number of features used in random selection.   *   * @return Value of numFeatures.   */  public int getNumFeatures() {        return m_numFeatures;  }    /**   * Set the number of features to use in random selection.   *   * @param newNumFeatures Value to assign to numFeatures.   */  public void setNumFeatures(int newNumFeatures) {        m_numFeatures = newNumFeatures;  }    /**   * Returns the tip text for this property   * @return tip text for this property suitable for   * displaying in the explorer/experimenter gui   */  public String seedTipText() {    return "The random number seed to be used.";  }  /**   * Set the seed for random number generation.   *   * @param seed the seed    */  public void setSeed(int seed) {    m_randomSeed = seed;  }    /**   * Gets the seed for the random number generations   *   * @return the seed for the random number generation   */  public int getSeed() {    return m_randomSeed;  }    /**   * Returns the tip text for this property   *    * @return 		tip text for this property suitable for   * 			displaying in the explorer/experimenter gui   */  public String maxDepthTipText() {    return "The maximum depth of the trees, 0 for unlimited.";  }  /**   * Get the maximum depth of trh tree, 0 for unlimited.   *   * @return 		the maximum depth.   */  public int getMaxDepth() {    return m_MaxDepth;  }    /**   * Set the maximum depth of the tree, 0 for unlimited.   *   * @param value 	the maximum depth.   */  public void setMaxDepth(int value) {    m_MaxDepth = value;  }  /**   * Gets the out of bag error that was calculated as the classifier was built.   *   * @return the out of bag error   */  public double measureOutOfBagError() {        if (m_bagger != null) {      return m_bagger.measureOutOfBagError();    } else return Double.NaN;  }    /**   * Returns an enumeration of the additional measure names.   *   * @return an enumeration of the measure names   */  public Enumeration enumerateMeasures() {        Vector newVector = new Vector(1);    newVector.addElement("measureOutOfBagError");    return newVector.elements();  }    /**   * Returns the value of the named measure.   *   * @param additionalMeasureName the name of the measure to query for its value   * @return the value of the named measure   * @throws IllegalArgumentException if the named measure is not supported   */  public double getMeasure(String additionalMeasureName) {        if (additionalMeasureName.equalsIgnoreCase("measureOutOfBagError")) {      return measureOutOfBagError();    }    else {throw new IllegalArgumentException(additionalMeasureName 					     + " not supported (RandomForest)");    }  }  /**   * Returns an enumeration describing the available options.   *   * @return an enumeration of all the available options   */  public Enumeration listOptions() {        Vector newVector = new Vector();    newVector.addElement(new Option(	"\tNumber of trees to build.",	"I", 1, "-I <number of trees>"));        newVector.addElement(new Option(	"\tNumber of features to consider (<1=int(logM+1)).",	"K", 1, "-K <number of features>"));        newVector.addElement(new Option(	"\tSeed for random number generator.\n"	+ "\t(default 1)",	"S", 1, "-S"));    newVector.addElement(new Option(	"\tThe maximum depth of the trees, 0 for unlimited.\n"	+ "\t(default 0)",	"depth", 1, "-depth <num>"));    Enumeration enu = super.listOptions();    while (enu.hasMoreElements()) {      newVector.addElement(enu.nextElement());    }    return newVector.elements();  }  /**   * Gets the current settings of the forest.   *   * @return an array of strings suitable for passing to setOptions()   */  public String[] getOptions() {    Vector        result;    String[]      options;    int           i;        result = new Vector();        result.add("-I");    result.add("" + getNumTrees());        result.add("-K");    result.add("" + getNumFeatures());        result.add("-S");    result.add("" + getSeed());        if (getMaxDepth() > 0) {      result.add("-depth");      result.add("" + getMaxDepth());    }        options = super.getOptions();    for (i = 0; i < options.length; i++)      result.add(options[i]);        return (String[]) result.toArray(new String[result.size()]);  }  /**   * Parses a given list of options. <p/>   *    <!-- options-start -->   * Valid options are: <p/>   *    * <pre> -I &lt;number of trees&gt;   *  Number of trees to build.</pre>   *    * <pre> -K &lt;number of features&gt;   *  Number of features to consider (&lt;1=int(logM+1)).</pre>   *    * <pre> -S   *  Seed for random number generator.   *  (default 1)</pre>   *    * <pre> -depth &lt;num&gt;   *  The maximum depth of the trees, 0 for unlimited.   *  (default 0)</pre>   *    * <pre> -D   *  If set, classifier is run in debug mode and   *  may output additional info to the console</pre>   *    <!-- options-end -->   *    * @param options the list of options as an array of strings   * @throws Exception if an option is not supported   */  public void setOptions(String[] options) throws Exception{    String	tmpStr;        tmpStr = Utils.getOption('I', options);    if (tmpStr.length() != 0) {      m_numTrees = Integer.parseInt(tmpStr);    } else {      m_numTrees = 10;    }        tmpStr = Utils.getOption('K', options);    if (tmpStr.length() != 0) {      m_numFeatures = Integer.parseInt(tmpStr);    } else {      m_numFeatures = 0;    }        tmpStr = Utils.getOption('S', options);    if (tmpStr.length() != 0) {      setSeed(Integer.parseInt(tmpStr));    } else {      setSeed(1);    }        tmpStr = Utils.getOption("depth", options);    if (tmpStr.length() != 0) {      setMaxDepth(Integer.parseInt(tmpStr));    } else {      setMaxDepth(0);    }        super.setOptions(options);        Utils.checkForRemainingOptions(options);  }    /**   * Returns default capabilities of the classifier.   *   * @return      the capabilities of this classifier   */  public Capabilities getCapabilities() {    return new RandomTree().getCapabilities();  }  /**   * Builds a classifier for a set of instances.   *   * @param data the instances to train the classifier with   * @throws Exception if something goes wrong   */  public void buildClassifier(Instances data) throws Exception {    // can classifier handle the data?    getCapabilities().testWithFail(data);    // remove instances with missing class    data = new Instances(data);    data.deleteWithMissingClass();        m_bagger = new Bagging();    RandomTree rTree = new RandomTree();    // set up the random tree options    m_KValue = m_numFeatures;    if (m_KValue < 1) m_KValue = (int) Utils.log2(data.numAttributes())+1;    rTree.setKValue(m_KValue);    rTree.setMaxDepth(getMaxDepth());    // set up the bagger and build the forest    m_bagger.setClassifier(rTree);    m_bagger.setSeed(m_randomSeed);    m_bagger.setNumIterations(m_numTrees);    m_bagger.setCalcOutOfBag(true);    m_bagger.buildClassifier(data);  }  /**   * Returns the class probability distribution for an instance.   *   * @param instance the instance to be classified   * @return the distribution the forest generates for the instance   * @throws Exception if computation fails   */  public double[] distributionForInstance(Instance instance) throws Exception {    return m_bagger.distributionForInstance(instance);  }  /**   * Outputs a description of this classifier.   *   * @return a string containing a description of the classifier   */  public String toString() {    if (m_bagger == null)       return "Random forest not built yet";    else       return "Random forest of " + m_numTrees	   + " trees, each constructed while considering "	   + m_KValue + " random feature" + (m_KValue==1 ? "" : "s") + ".\n"	   + "Out of bag error: "	   + Utils.doubleToString(m_bagger.measureOutOfBagError(), 4) + "\n"	   + (getMaxDepth() > 0 ? ("Max. depth of trees: " + getMaxDepth() + "\n") : (""))	   + "\n";  }  /**   * Main method for this class.   *   * @param argv the options   */  public static void main(String[] argv) {    runClassifier(new RandomForest(), argv);  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费在线观看入口| 香蕉加勒比综合久久| 不卡视频一二三| 久久99最新地址| 日韩av在线播放中文字幕| 成人免费小视频| 久久99久久精品欧美| 美女一区二区视频| 久久99国产精品免费| 色综合天天综合色综合av| 99re成人精品视频| 色综合一个色综合| 国产精品午夜在线| 国产精品高清亚洲| 亚洲精品国产无套在线观| 亚洲人妖av一区二区| 欧美一区三区四区| 久久视频一区二区| www.色精品| 久久国产精品99久久久久久老狼| 国产精品成人午夜| 亚洲一区二区在线免费观看视频 | 亚洲一区中文日韩| 一区二区不卡在线视频 午夜欧美不卡在| 亚洲最新视频在线播放| 天天综合天天做天天综合| 777久久久精品| 亚洲午夜电影在线观看| 依依成人综合视频| 91国偷自产一区二区开放时间| 99久精品国产| 亚洲精品视频在线观看网站| 国产麻豆日韩欧美久久| 色悠悠久久综合| 国产无人区一区二区三区| 石原莉奈一区二区三区在线观看| 久久狠狠亚洲综合| 91亚洲永久精品| 欧美日韩一级二级| 精品久久久久久最新网址| 精品国产91乱码一区二区三区| 精品国产sm最大网站| 美女视频网站久久| 制服丝袜日韩国产| 亚洲午夜精品网| 97se亚洲国产综合自在线不卡 | 欧美在线观看18| 日韩一二三区不卡| 亚洲欧洲日韩在线| 99精品视频中文字幕| 中文字幕一区日韩精品欧美| 成人午夜在线播放| 日韩一区国产二区欧美三区| 麻豆久久久久久| 久久久久国产精品免费免费搜索| 五月激情丁香一区二区三区| 在线不卡一区二区| 亚洲柠檬福利资源导航| 欧美日韩五月天| 成人黄动漫网站免费app| 亚洲在线视频一区| 国产亚洲精品7777| 色综合天天综合狠狠| 国产一区二区三区四区五区入口| 亚洲综合色丁香婷婷六月图片| 6080国产精品一区二区| 成人黄色小视频| 国产精品影视网| 中文在线免费一区三区高中清不卡| 麻豆视频观看网址久久| 男人的天堂亚洲一区| 国产成人欧美日韩在线电影| 久久日一线二线三线suv| 91麻豆精品国产自产在线| 一本色道亚洲精品aⅴ| 成人av网站免费| 欧美在线视频不卡| 欧美日韩日日摸| 欧美精品一卡两卡| 欧美不卡一二三| 色婷婷综合久久久中文字幕| 91视频观看视频| 在线观看视频一区| 欧美一a一片一级一片| 天天影视网天天综合色在线播放| 国产性做久久久久久| 国产精品日日摸夜夜摸av| 国产日韩视频一区二区三区| 在线免费视频一区二区| 91色porny| 91精品国产综合久久精品app| 欧美午夜影院一区| www一区二区| 国产亚洲精品7777| 性做久久久久久久免费看| 精品一区二区三区香蕉蜜桃| 岛国精品在线播放| 欧美精品一卡两卡| 国产精品日产欧美久久久久| 日韩在线观看一区二区| 成人中文字幕在线| 欧美做爰猛烈大尺度电影无法无天| 日韩欧美在线网站| 亚洲国产成人av| 99re8在线精品视频免费播放| 欧美男男青年gay1069videost| 国产麻豆精品一区二区| 色婷婷久久久亚洲一区二区三区| 日韩精品中文字幕一区二区三区| 8v天堂国产在线一区二区| 国产色爱av资源综合区| 亚洲va在线va天堂| 成人一区在线观看| av高清不卡在线| 亚洲欧洲一区二区三区| 国产成人aaa| 99re热这里只有精品免费视频| 久久亚洲捆绑美女| 日本中文字幕一区| 日韩欧美视频一区| 国产一区二区伦理片| 久久久久久久综合日本| 国产99久久久精品| 自拍偷拍国产精品| 日韩欧美资源站| 一本久久综合亚洲鲁鲁五月天 | 国产99久久久精品| 亚洲国产精品成人综合| 在线视频你懂得一区| 另类综合日韩欧美亚洲| 亚洲精品国久久99热| 精品少妇一区二区三区日产乱码| 奇米综合一区二区三区精品视频| 亚洲日本在线a| 国产精品天天摸av网| 欧美一卡二卡三卡四卡| 欧美偷拍一区二区| 99精品视频在线观看免费| 久久国产剧场电影| 免费在线观看不卡| 国产精品99久久不卡二区| 精品国精品自拍自在线| 国产91高潮流白浆在线麻豆 | 美国三级日本三级久久99| 国产欧美一区视频| 欧美亚洲图片小说| 丰满白嫩尤物一区二区| 亚洲综合成人在线视频| 99久久婷婷国产精品综合| 极品少妇一区二区三区精品视频| 亚洲欧美另类久久久精品2019 | 国产在线播放一区二区三区| 日韩一区日韩二区| 国产人久久人人人人爽| 91精品国产综合久久精品| 91成人免费在线| 色噜噜狠狠色综合欧洲selulu| 国产成人午夜电影网| 久久99国产精品成人| 奇米色一区二区| 久久精品久久久精品美女| 亚洲一本大道在线| 午夜精品久久久| 轻轻草成人在线| 日产国产欧美视频一区精品| 日日夜夜精品视频免费| 日韩精品一卡二卡三卡四卡无卡| 一区二区高清在线| 天天色综合成人网| 国内精品免费在线观看| 精品国产乱码久久久久久蜜臀 | 伊人色综合久久天天| 一区二区三区四区不卡在线| 亚洲午夜激情av| 国精品**一区二区三区在线蜜桃 | 国产精品麻豆视频| 亚洲超碰精品一区二区| 秋霞午夜av一区二区三区| 国产大陆a不卡| 51精品视频一区二区三区| 久久精品夜夜夜夜久久| 亚洲精品中文在线| 国产伦精一区二区三区| 91福利精品视频| 久久久久久久网| 亚洲成a人v欧美综合天堂| 亚洲无人区一区| 成人在线一区二区三区| 欧美大胆一级视频| 亚洲蜜桃精久久久久久久| 久久精品久久综合| 日韩一区二区麻豆国产| 一区二区三区中文字幕精品精品| 国产精品一区一区三区| 91国内精品野花午夜精品 | 亚洲一区二区三区四区五区中文| 日韩电影免费一区| 欧美婷婷六月丁香综合色| 亚洲视频中文字幕| 91免费视频大全|