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

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

?? decisionstump.java

?? JAVA的一個程序
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* *    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. *//* *    DecisionStump.java *    Copyright (C) 1999 Eibe Frank * */package weka.classifiers.trees;import weka.classifiers.Classifier;import weka.classifiers.Evaluation;import weka.classifiers.Sourcable;import weka.core.Attribute;import weka.core.Capabilities;import weka.core.ContingencyTables;import weka.core.Instance;import weka.core.Instances;import weka.core.Utils;import weka.core.WeightedInstancesHandler;import weka.core.Capabilities.Capability;/** <!-- globalinfo-start --> * Class for building and using a decision stump. Usually used in conjunction with a boosting algorithm. Does regression (based on mean-squared error) or classification (based on entropy). Missing is treated as a separate value. * <p/> <!-- globalinfo-end --> * * Typical usage: <p> * <code>java weka.classifiers.trees.LogitBoost -I 100 -W weka.classifiers.trees.DecisionStump  * -t training_data </code><p> *  <!-- options-start --> * Valid options are: <p/> *  * <pre> -D *  If set, classifier is run in debug mode and *  may output additional info to the console</pre> *  <!-- options-end --> *  * @author Eibe Frank (eibe@cs.waikato.ac.nz) * @version $Revision: 1.20 $ */public class DecisionStump   extends Classifier   implements WeightedInstancesHandler, Sourcable {  /** for serialization */  static final long serialVersionUID = 1618384535950391L;    /** The attribute used for classification. */  private int m_AttIndex;  /** The split point (index respectively). */  private double m_SplitPoint;  /** The distribution of class values or the means in each subset. */  private double[][] m_Distribution;  /** The instances used for training. */  private Instances m_Instances;  /**   * Returns a string describing classifier   * @return a description suitable for   * displaying in the explorer/experimenter gui   */  public String globalInfo() {    return  "Class for building and using a decision stump. Usually used in "      + "conjunction with a boosting algorithm. Does regression (based on "      + "mean-squared error) or classification (based on entropy). Missing "      + "is treated as a separate value.";  }  /**   * Returns default capabilities of the classifier.   *   * @return      the capabilities of this classifier   */  public Capabilities getCapabilities() {    Capabilities result = super.getCapabilities();    // attributes    result.enable(Capability.NOMINAL_ATTRIBUTES);    result.enable(Capability.NUMERIC_ATTRIBUTES);    result.enable(Capability.DATE_ATTRIBUTES);    result.enable(Capability.MISSING_VALUES);    // class    result.enable(Capability.NOMINAL_CLASS);    result.enable(Capability.NUMERIC_CLASS);    result.enable(Capability.DATE_CLASS);    result.enable(Capability.MISSING_CLASS_VALUES);        return result;  }  /**   * Generates the classifier.   *   * @param instances set of instances serving as training data    * @throws Exception if the classifier has not been generated successfully   */  public void buildClassifier(Instances instances) throws Exception {        double bestVal = Double.MAX_VALUE, currVal;    double bestPoint = -Double.MAX_VALUE;    int bestAtt = -1, numClasses;    // can classifier handle the data?    getCapabilities().testWithFail(instances);    // remove instances with missing class    instances = new Instances(instances);    instances.deleteWithMissingClass();        double[][] bestDist = new double[3][instances.numClasses()];    m_Instances = new Instances(instances);    if (m_Instances.classAttribute().isNominal()) {      numClasses = m_Instances.numClasses();    } else {      numClasses = 1;    }    // For each attribute    boolean first = true;    for (int i = 0; i < m_Instances.numAttributes(); i++) {      if (i != m_Instances.classIndex()) {	// Reserve space for distribution.	m_Distribution = new double[3][numClasses];	// Compute value of criterion for best split on attribute	if (m_Instances.attribute(i).isNominal()) {	  currVal = findSplitNominal(i);	} else {	  currVal = findSplitNumeric(i);	}	if ((first) || (currVal < bestVal)) {	  bestVal = currVal;	  bestAtt = i;	  bestPoint = m_SplitPoint;	  for (int j = 0; j < 3; j++) {	    System.arraycopy(m_Distribution[j], 0, bestDist[j], 0, 			     numClasses);	  }	}		// First attribute has been investigated	first = false;      }    }        // Set attribute, split point and distribution.    m_AttIndex = bestAtt;    m_SplitPoint = bestPoint;    m_Distribution = bestDist;    if (m_Instances.classAttribute().isNominal()) {      for (int i = 0; i < m_Distribution.length; i++) {	double sumCounts = Utils.sum(m_Distribution[i]);	if (sumCounts == 0) { // This means there were only missing attribute values	  System.arraycopy(m_Distribution[2], 0, m_Distribution[i], 0, 			   m_Distribution[2].length);	  Utils.normalize(m_Distribution[i]);	} else {	  Utils.normalize(m_Distribution[i], sumCounts); 	}      }    }        // Save memory    m_Instances = new Instances(m_Instances, 0);  }  /**   * Calculates the class membership probabilities for the given test instance.   *   * @param instance the instance to be classified   * @return predicted class probability distribution   * @throws Exception if distribution can't be computed   */  public double[] distributionForInstance(Instance instance) throws Exception {    return m_Distribution[whichSubset(instance)];  }  /**   * Returns the decision tree as Java source code.   *   * @param className the classname of the generated code   * @return the tree as Java source code   * @throws Exception if something goes wrong   */  public String toSource(String className) throws Exception {    StringBuffer text = new StringBuffer("class ");    Attribute c = m_Instances.classAttribute();    text.append(className)      .append(" {\n"	      +"  public static double classify(Object [] i) {\n");    text.append("    /* " + m_Instances.attribute(m_AttIndex).name() + " */\n");    text.append("    if (i[").append(m_AttIndex);    text.append("] == null) { return ");    text.append(sourceClass(c, m_Distribution[2])).append(";");    if (m_Instances.attribute(m_AttIndex).isNominal()) {      text.append(" } else if (((String)i[").append(m_AttIndex);      text.append("]).equals(\"");      text.append(m_Instances.attribute(m_AttIndex).value((int)m_SplitPoint));      text.append("\")");    } else {      text.append(" } else if (((Double)i[").append(m_AttIndex);      text.append("]).doubleValue() <= ").append(m_SplitPoint);    }    text.append(") { return ");    text.append(sourceClass(c, m_Distribution[0])).append(";");    text.append(" } else { return ");    text.append(sourceClass(c, m_Distribution[1])).append(";");    text.append(" }\n  }\n}\n");    return text.toString();  }  /**   * Returns the value as string out of the given distribution   *    * @param c the attribute to get the value for   * @param dist the distribution to extract the value   * @return the value   */  private String sourceClass(Attribute c, double []dist) {    if (c.isNominal()) {      return Integer.toString(Utils.maxIndex(dist));    } else {      return Double.toString(dist[0]);    }  }  /**   * Returns a description of the classifier.   *   * @return a description of the classifier as a string.   */  public String toString(){    if (m_Instances == null) {      return "Decision Stump: No model built yet.";    }    try {      StringBuffer text = new StringBuffer();            text.append("Decision Stump\n\n");      text.append("Classifications\n\n");      Attribute att = m_Instances.attribute(m_AttIndex);      if (att.isNominal()) {	text.append(att.name() + " = " + att.value((int)m_SplitPoint) + 		    " : ");	text.append(printClass(m_Distribution[0]));	text.append(att.name() + " != " + att.value((int)m_SplitPoint) + 		    " : ");	text.append(printClass(m_Distribution[1]));      } else {	text.append(att.name() + " <= " + m_SplitPoint + " : ");	text.append(printClass(m_Distribution[0]));	text.append(att.name() + " > " + m_SplitPoint + " : ");	text.append(printClass(m_Distribution[1]));      }      text.append(att.name() + " is missing : ");      text.append(printClass(m_Distribution[2]));      if (m_Instances.classAttribute().isNominal()) {	text.append("\nClass distributions\n\n");	if (att.isNominal()) {	  text.append(att.name() + " = " + att.value((int)m_SplitPoint) + 		      "\n");	  text.append(printDist(m_Distribution[0]));	  text.append(att.name() + " != " + att.value((int)m_SplitPoint) + 		      "\n");	  text.append(printDist(m_Distribution[1]));	} else {	  text.append(att.name() + " <= " + m_SplitPoint + "\n");	  text.append(printDist(m_Distribution[0]));	  text.append(att.name() + " > " + m_SplitPoint + "\n");	  text.append(printDist(m_Distribution[1]));	}	text.append(att.name() + " is missing\n");	text.append(printDist(m_Distribution[2]));      }      return text.toString();    } catch (Exception e) {      return "Can't print decision stump classifier!";    }  }  /**    * Prints a class distribution.   *   * @param dist the class distribution to print   * @return the distribution as a string   * @throws Exception if distribution can't be printed   */  private String printDist(double[] dist) throws Exception {    StringBuffer text = new StringBuffer();        if (m_Instances.classAttribute().isNominal()) {      for (int i = 0; i < m_Instances.numClasses(); i++) {	text.append(m_Instances.classAttribute().value(i) + "\t");      }      text.append("\n");      for (int i = 0; i < m_Instances.numClasses(); i++) {	text.append(dist[i] + "\t");      }      text.append("\n");    }        return text.toString();  }  /**    * Prints a classification.   *   * @param dist the class distribution   * @return the classificationn as a string   * @throws Exception if the classification can't be printed   */  private String printClass(double[] dist) throws Exception {    StringBuffer text = new StringBuffer();        if (m_Instances.classAttribute().isNominal()) {      text.append(m_Instances.classAttribute().value(Utils.maxIndex(dist)));    } else {      text.append(dist[0]);    }        return text.toString() + "\n";  }  /**   * Finds best split for nominal attribute and returns value.   *   * @param index attribute index   * @return value of criterion for the best split   * @throws Exception if something goes wrong   */  private double findSplitNominal(int index) throws Exception {    if (m_Instances.classAttribute().isNominal()) {      return findSplitNominalNominal(index);    } else {      return findSplitNominalNumeric(index);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久午夜电影| 一区二区三区中文字幕电影 | 国产91精品免费| 欧美成人欧美edvon| 日韩av高清在线观看| 欧美日韩一区高清| 亚洲高清免费在线| 成人午夜av电影| 欧美国产97人人爽人人喊| 粉嫩av一区二区三区粉嫩| 国产亚洲一区二区在线观看| 亚洲欧美激情插| 色婷婷av一区二区| 亚洲午夜免费电影| 亚洲成人免费av| 欧美日韩免费电影| 亚洲免费观看高清完整| 日本韩国一区二区三区视频| 中文字幕欧美国产| 99久久精品国产麻豆演员表| 欧美国产日本韩| 91丨porny丨在线| 亚洲黄色av一区| 欧美丰满美乳xxx高潮www| 日本成人超碰在线观看| 久久综合九色综合97婷婷女人| 精品一区二区在线观看| 欧美国产精品中文字幕| 日韩欧美一区二区免费| 中文字幕+乱码+中文字幕一区| 高清不卡一二三区| 中文字幕日本不卡| 欧美日韩成人综合| 狠狠色丁香婷婷综合| 久久精品免视看| 色偷偷久久一区二区三区| 婷婷中文字幕综合| 日本一区二区三区电影| 欧美伊人精品成人久久综合97 | 欧美日韩在线三级| 自拍av一区二区三区| 欧美在线不卡一区| 国内不卡的二区三区中文字幕| 国产嫩草影院久久久久| 欧美日韩在线观看一区二区| 美国十次综合导航| 综合中文字幕亚洲| 日韩一级片在线观看| 成人免费av在线| 亚洲超碰精品一区二区| 久久久无码精品亚洲日韩按摩| 色婷婷av一区二区三区大白胸| 久久99最新地址| 一区二区三区欧美日| 国产清纯白嫩初高生在线观看91| av中文字幕在线不卡| 精品一区二区三区免费| 一区二区三区欧美在线观看| 久久综合一区二区| 欧美日本一道本在线视频| 国产成人午夜视频| 蜜桃视频一区二区三区在线观看 | 亚洲欧美偷拍卡通变态| 国产欧美一区二区三区网站| 精品女同一区二区| 欧美成va人片在线观看| 欧美军同video69gay| 91精品福利视频| 成人aa视频在线观看| 国产成人福利片| 国产精品综合在线视频| 久久99精品国产.久久久久久| 午夜欧美电影在线观看| 午夜精品福利一区二区三区av| 亚洲激情av在线| 一区二区三区国产| 亚洲成人综合在线| 亚洲h在线观看| 亚洲地区一二三色| 婷婷成人激情在线网| 婷婷国产在线综合| 蜜桃久久av一区| 美女任你摸久久 | 国产精品色哟哟网站| 久久亚洲精品国产精品紫薇| 久久综合九色综合97婷婷女人| 26uuu色噜噜精品一区| 久久久久国产成人精品亚洲午夜| 久久精品一二三| 欧美激情一区二区三区蜜桃视频| 国产精品区一区二区三| 综合网在线视频| 亚洲一级二级在线| 秋霞国产午夜精品免费视频| 久久精品国产999大香线蕉| 国产一区视频导航| www.日韩精品| 在线免费观看日本欧美| 欧美日韩一区国产| 精品欧美乱码久久久久久 | 91精品欧美久久久久久动漫| 欧美电影免费观看高清完整版在线| 日韩久久精品一区| 中日韩av电影| 一区二区三区电影在线播| 美女视频一区在线观看| 国产凹凸在线观看一区二区| 色猫猫国产区一区二在线视频| 欧美不卡激情三级在线观看| 国产亚洲精品精华液| 亚洲欧美另类在线| 蜜臀av性久久久久av蜜臀妖精| 国产露脸91国语对白| 色欲综合视频天天天| 日韩一区二区三| 国产精品麻豆网站| 日韩高清在线电影| 成人午夜看片网址| 欧美久久久一区| 国产片一区二区| 日韩国产欧美视频| 成人app网站| 欧美乱熟臀69xxxxxx| 中文字幕不卡的av| 日韩中文字幕不卡| 99久久99久久精品国产片果冻| 欧美丝袜自拍制服另类| 久久久青草青青国产亚洲免观| 一区二区在线观看免费视频播放| 免费观看在线综合色| 一本大道久久a久久精二百| 精品国产a毛片| 亚洲午夜视频在线| 成人晚上爱看视频| 欧美一级久久久| 一区二区三区中文字幕| 国产成人av一区二区三区在线| 91 com成人网| 亚洲另类中文字| 不卡在线观看av| 久久免费精品国产久精品久久久久 | 亚洲自拍偷拍图区| 成人自拍视频在线观看| 精品久久一区二区三区| 亚洲一区在线观看视频| 成人av午夜影院| 日韩精品最新网址| 亚洲午夜久久久久久久久电影网 | 91精品办公室少妇高潮对白| 国产亚洲精品福利| 久久精品国产亚洲一区二区三区| 欧美在线影院一区二区| 亚洲欧洲精品一区二区三区| 精品一区二区三区久久| 欧美精品在线一区二区三区| 亚洲小说欧美激情另类| 91久久奴性调教| 一区二区三区四区激情| 99精品视频在线观看免费| 中文字幕不卡的av| 国产成人精品亚洲777人妖| 久久精品欧美日韩精品| 国内精品嫩模私拍在线| 日韩女同互慰一区二区| 麻豆精品国产91久久久久久| 91精品国产一区二区三区蜜臀| 亚洲一二三四在线| 欧美美女喷水视频| 天天综合色天天综合色h| 欧美区在线观看| 青椒成人免费视频| 91精品午夜视频| 美国欧美日韩国产在线播放| 日韩三级免费观看| 国产一区视频网站| 国产视频一区在线播放| 成人午夜视频免费看| 中文字幕日韩一区| 99久久精品免费| 一区二区三区中文字幕| 欧美日韩亚洲不卡| 日本欧美久久久久免费播放网| 日韩欧美成人一区二区| 国产一区在线看| 国产精品乱码一区二区三区软件 | 一区二区三区在线观看国产 | 大桥未久av一区二区三区中文| 亚洲欧洲99久久| 777色狠狠一区二区三区| 黑人巨大精品欧美黑白配亚洲| 久久久99久久| 色综合久久99| 欧美aa在线视频| 中文字幕欧美日韩一区| 91高清视频在线| 日韩一区精品字幕| 精品99久久久久久| 色婷婷av久久久久久久| 奇米777欧美一区二区| 欧美二区乱c少妇|