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

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

?? linearregression.java

?? Weka
?? 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. *//* *    LinearRegression.java *    Copyright (C) 1999 University of Waikato, Hamilton, New Zealand * */package weka.classifiers.functions;import weka.classifiers.Classifier;import weka.core.Capabilities;import weka.core.Instance;import weka.core.Instances;import weka.core.Matrix;import weka.core.Option;import weka.core.OptionHandler;import weka.core.SelectedTag;import weka.core.Tag;import weka.core.Utils;import weka.core.WeightedInstancesHandler;import weka.core.Capabilities.Capability;import weka.filters.Filter;import weka.filters.supervised.attribute.NominalToBinary;import weka.filters.unsupervised.attribute.ReplaceMissingValues;import java.util.Enumeration;import java.util.Vector;/** <!-- globalinfo-start --> * Class for using linear regression for prediction. Uses the Akaike criterion for model selection, and is able to deal with weighted instances. * <p/> <!-- globalinfo-end --> * <!-- options-start --> * Valid options are: <p/> *  * <pre> -D *  Produce debugging output. *  (default no debugging output)</pre> *  * <pre> -S &lt;number of selection method&gt; *  Set the attribute selection method to use. 1 = None, 2 = Greedy. *  (default 0 = M5' method)</pre> *  * <pre> -C *  Do not try to eliminate colinear attributes. * </pre> *  * <pre> -R &lt;double&gt; *  Set ridge parameter (default 1.0e-8). * </pre> *  <!-- options-end --> * * @author Eibe Frank (eibe@cs.waikato.ac.nz) * @author Len Trigg (trigg@cs.waikato.ac.nz) * @version $Revision: 1.23 $ */public class LinearRegression extends Classifier implements OptionHandler,  WeightedInstancesHandler {    /** for serialization */  static final long serialVersionUID = -3364580862046573747L;  /** Array for storing coefficients of linear regression. */  private double[] m_Coefficients;  /** Which attributes are relevant? */  private boolean[] m_SelectedAttributes;  /** Variable for storing transformed training data. */  private Instances m_TransformedData;  /** The filter for removing missing values. */  private ReplaceMissingValues m_MissingFilter;  /** The filter storing the transformation from nominal to       binary attributes. */  private NominalToBinary m_TransformFilter;  /** The standard deviations of the class attribute */  private double m_ClassStdDev;  /** The mean of the class attribute */  private double m_ClassMean;  /** The index of the class attribute */  private int m_ClassIndex;  /** The attributes means */  private double[] m_Means;  /** The attribute standard deviations */  private double[] m_StdDevs;  /** True if debug output will be printed */  private boolean b_Debug;  /** The current attribute selection method */  private int m_AttributeSelection;  /** Attribute selection method: M5 method */  public static final int SELECTION_M5 = 0;  /** Attribute selection method: No attribute selection */  public static final int SELECTION_NONE = 1;  /** Attribute selection method: Greedy method */  public static final int SELECTION_GREEDY = 2;  /** Attribute selection methods */  public static final Tag [] TAGS_SELECTION = {    new Tag(SELECTION_NONE, "No attribute selection"),    new Tag(SELECTION_M5, "M5 method"),    new Tag(SELECTION_GREEDY, "Greedy method")  };  /** Try to eliminate correlated attributes? */  private boolean m_EliminateColinearAttributes = true;  /** Turn off all checks and conversions? */  private boolean m_checksTurnedOff = false;  /** The ridge parameter */  private double m_Ridge = 1.0e-8;  /**   * Turns off checks for missing values, etc. Use with caution.   * Also turns off scaling.   */  public void turnChecksOff() {    m_checksTurnedOff = true;  }  /**   * Turns on checks for missing values, etc. Also turns   * on scaling.   */  public void turnChecksOn() {    m_checksTurnedOff = false;  }  /**   * Returns a string describing this classifier   * @return a description of the classifier suitable for   * displaying in the explorer/experimenter gui   */  public String globalInfo() {    return "Class for using linear regression for prediction. Uses the Akaike "      +"criterion for model selection, and is able to deal with weighted "      +"instances.";  }  /**   * 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.NUMERIC_CLASS);    result.enable(Capability.DATE_CLASS);    result.enable(Capability.MISSING_CLASS_VALUES);        return result;  }  /**   * Builds a regression model for the given data.   *   * @param data the training data to be used for generating the   * linear regression function   * @throws Exception if the classifier could not be built successfully   */  public void buildClassifier(Instances data) throws Exception {      if (!m_checksTurnedOff) {      // can classifier handle the data?      getCapabilities().testWithFail(data);      // remove instances with missing class      data = new Instances(data);      data.deleteWithMissingClass();    }    // Preprocess instances    if (!m_checksTurnedOff) {      m_TransformFilter = new NominalToBinary();      m_TransformFilter.setInputFormat(data);      data = Filter.useFilter(data, m_TransformFilter);      m_MissingFilter = new ReplaceMissingValues();      m_MissingFilter.setInputFormat(data);      data = Filter.useFilter(data, m_MissingFilter);      data.deleteWithMissingClass();    } else {      m_TransformFilter = null;      m_MissingFilter = null;    }    m_ClassIndex = data.classIndex();    m_TransformedData = data;    // Turn all attributes on for a start    m_SelectedAttributes = new boolean[data.numAttributes()];    for (int i = 0; i < data.numAttributes(); i++) {      if (i != m_ClassIndex) {	m_SelectedAttributes[i] = true;      }    }    m_Coefficients = null;    // Compute means and standard deviations    m_Means = new double[data.numAttributes()];    m_StdDevs = new double[data.numAttributes()];    for (int j = 0; j < data.numAttributes(); j++) {      if (j != data.classIndex()) {	m_Means[j] = data.meanOrMode(j);	m_StdDevs[j] = Math.sqrt(data.variance(j));	if (m_StdDevs[j] == 0) {	  m_SelectedAttributes[j] = false;	}       }    }    m_ClassStdDev = Math.sqrt(data.variance(m_TransformedData.classIndex()));    m_ClassMean = data.meanOrMode(m_TransformedData.classIndex());    // Perform the regression    findBestModel();    // Save memory    m_TransformedData = new Instances(data, 0);  }  /**   * Classifies the given instance using the linear regression function.   *   * @param instance the test instance   * @return the classification   * @throws Exception if classification can't be done successfully   */  public double classifyInstance(Instance instance) throws Exception {    // Transform the input instance    Instance transformedInstance = instance;    if (!m_checksTurnedOff) {      m_TransformFilter.input(transformedInstance);      m_TransformFilter.batchFinished();      transformedInstance = m_TransformFilter.output();      m_MissingFilter.input(transformedInstance);      m_MissingFilter.batchFinished();      transformedInstance = m_MissingFilter.output();    }    // Calculate the dependent variable from the regression model    return regressionPrediction(transformedInstance,				m_SelectedAttributes,				m_Coefficients);  }  /**   * Outputs the linear regression model as a string.   *    * @return the model as string   */  public String toString() {    if (m_TransformedData == null) {      return "Linear Regression: No model built yet.";    }    try {      StringBuffer text = new StringBuffer();      int column = 0;      boolean first = true;            text.append("\nLinear Regression Model\n\n");            text.append(m_TransformedData.classAttribute().name()+" =\n\n");      for (int i = 0; i < m_TransformedData.numAttributes(); i++) {	if ((i != m_ClassIndex) 	    && (m_SelectedAttributes[i])) {	  if (!first) 	    text.append(" +\n");	  else	    first = false;	  text.append(Utils.doubleToString(m_Coefficients[column], 12, 4)		      + " * ");	  text.append(m_TransformedData.attribute(i).name());	  column++;	}      }      text.append(" +\n" + 		  Utils.doubleToString(m_Coefficients[column], 12, 4));      return text.toString();    } catch (Exception e) {      return "Can't print Linear Regression!";    }  }  /**   * Returns an enumeration describing the available options.   *   * @return an enumeration of all the available options.   */  public Enumeration listOptions() {        Vector newVector = new Vector(4);    newVector.addElement(new Option("\tProduce debugging output.\n"				    + "\t(default no debugging output)",				    "D", 0, "-D"));    newVector.addElement(new Option("\tSet the attribute selection method"				    + " to use. 1 = None, 2 = Greedy.\n"				    + "\t(default 0 = M5' method)",				    "S", 1, "-S <number of selection method>"));    newVector.addElement(new Option("\tDo not try to eliminate colinear"				    + " attributes.\n",				    "C", 0, "-C"));    newVector.addElement(new Option("\tSet ridge parameter (default 1.0e-8).\n",				    "R", 1, "-R <double>"));    return newVector.elements();  }  /**   * Parses a given list of options. <p/>   *   <!-- options-start -->   * Valid options are: <p/>   *    * <pre> -D   *  Produce debugging output.   *  (default no debugging output)</pre>   *    * <pre> -S &lt;number of selection method&gt;   *  Set the attribute selection method to use. 1 = None, 2 = Greedy.   *  (default 0 = M5' method)</pre>   *    * <pre> -C   *  Do not try to eliminate colinear attributes.   * </pre>   *    * <pre> -R &lt;double&gt;   *  Set ridge parameter (default 1.0e-8).   * </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 selectionString = Utils.getOption('S', options);    if (selectionString.length() != 0) {      setAttributeSelectionMethod(new SelectedTag(Integer						  .parseInt(selectionString),						  TAGS_SELECTION));    } else {      setAttributeSelectionMethod(new SelectedTag(SELECTION_M5,						  TAGS_SELECTION));    }    String ridgeString = Utils.getOption('R', options);    if (ridgeString.length() != 0) {      setRidge(new Double(ridgeString).doubleValue());    } else {      setRidge(1.0e-8);    }    setDebug(Utils.getFlag('D', options));    setEliminateColinearAttributes(!Utils.getFlag('C', options));  }  /**   * Returns the coefficients for this linear model.   *    * @return the coefficients for this linear model   */  public double[] coefficients() {    double[] coefficients = new double[m_SelectedAttributes.length + 1];    int counter = 0;    for (int i = 0; i < m_SelectedAttributes.length; i++) {      if ((m_SelectedAttributes[i]) && ((i != m_ClassIndex))) {	coefficients[i] = m_Coefficients[counter++];      }    }    coefficients[m_SelectedAttributes.length] = m_Coefficients[counter];    return coefficients;  }  /**   * Gets the current settings of the classifier.   *   * @return an array of strings suitable for passing to setOptions   */  public String [] getOptions() {    String [] options = new String [6];    int current = 0;    options[current++] = "-S";    options[current++] = "" + getAttributeSelectionMethod()      .getSelectedTag().getID();    if (getDebug()) {      options[current++] = "-D";    }    if (!getEliminateColinearAttributes()) {      options[current++] = "-C";    }    options[current++] = "-R";    options[current++] = "" + getRidge();    while (current < options.length) {      options[current++] = "";    }    return options;  }    /**   * Returns the tip text for this property   * @return tip text for this property suitable for   * displaying in the explorer/experimenter gui   */  public String ridgeTipText() {    return "The value of the Ridge parameter.";  }  /**   * Get the value of Ridge.   *   * @return Value of Ridge.   */  public double getRidge() {        return m_Ridge;  }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品欧美日韩| 精品日韩欧美一区二区| 99re成人在线| 成人国产精品视频| 不卡一二三区首页| 99re热视频精品| 在线观看中文字幕不卡| 欧美图片一区二区三区| 91高清视频在线| 6080日韩午夜伦伦午夜伦| 欧美日韩一二三| 久久天天做天天爱综合色| 国产欧美一区二区在线观看| 国产日韩成人精品| 一级做a爱片久久| 日韩精品免费专区| 国产成人免费网站| 色欧美乱欧美15图片| 欧美男同性恋视频网站| 久久精品夜色噜噜亚洲aⅴ| 国产精品国产三级国产a | 国产精品毛片高清在线完整版 | 国模娜娜一区二区三区| 一本色道a无线码一区v| 日韩欧美一级精品久久| 国产精品丝袜在线| 蜜臀99久久精品久久久久久软件| 国产suv精品一区二区6| 欧美日韩一区视频| 国产精品视频免费| 久久99热99| 欧美一级午夜免费电影| 国产精品久久久久久久久免费樱桃| 欧美大片一区二区三区| 欧美sm美女调教| 日本一区二区高清| 老司机精品视频一区二区三区| jlzzjlzz欧美大全| 2024国产精品| 久久精品国产精品青草| 欧美亚洲国产一区二区三区 | 亚洲综合视频在线| 黄网站免费久久| 精品国产一区二区三区忘忧草| 五月婷婷综合激情| 精品婷婷伊人一区三区三| 亚洲一线二线三线视频| 91婷婷韩国欧美一区二区| 日韩美女视频19| 在线观看网站黄不卡| 亚洲成年人影院| 日韩小视频在线观看专区| 午夜精品一区二区三区免费视频| 欧美亚洲一区三区| 亚洲线精品一区二区三区八戒| 日本精品裸体写真集在线观看| 亚洲精品videosex极品| 欧美日韩精品高清| 国产精品99久久久久久久女警 | 日韩影院精彩在线| 精品噜噜噜噜久久久久久久久试看| 免费成人你懂的| 欧美激情在线看| 北条麻妃国产九九精品视频| 一区二区三区在线观看欧美| 欧美顶级少妇做爰| 国产不卡高清在线观看视频| 亚洲一区在线观看免费| 国产亚洲一区二区三区在线观看| av电影一区二区| 视频一区视频二区中文| 欧美国产日韩一二三区| 欧美一级日韩免费不卡| 99久久国产免费看| 国产69精品久久久久777| 亚洲一区国产视频| 亚洲免费观看在线视频| 久久视频一区二区| 亚洲精品一区二区精华| 欧美日韩在线一区二区| eeuss鲁一区二区三区| 精品制服美女久久| 日本aⅴ亚洲精品中文乱码| 亚洲午夜免费电影| 日韩精品一区二区在线观看| 欧美精品一卡两卡| 欧美三级在线播放| 欧美日韩久久一区二区| 欧美视频在线一区| 在线亚洲一区观看| 欧美伊人久久久久久午夜久久久久| 成人一级黄色片| 不卡一卡二卡三乱码免费网站 | 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美专区日韩专区| 色av成人天堂桃色av| 色av综合在线| 欧美久久久久久蜜桃| 日韩一区二区三区免费看| 精品国产电影一区二区| 国产农村妇女毛片精品久久麻豆 | 亚洲人成亚洲人成在线观看图片| 欧美极品美女视频| 一区二区国产视频| 久久国产精品无码网站| 成人少妇影院yyyy| 欧美日韩视频在线观看一区二区三区| 在线看不卡av| 国产性天天综合网| 一区二区三区四区高清精品免费观看| 亚洲精品国产高清久久伦理二区| 婷婷亚洲久悠悠色悠在线播放| 九色porny丨国产精品| 色视频一区二区| 日本一区二区视频在线观看| 亚洲国产欧美另类丝袜| 国内精品写真在线观看| 在线观看91av| 久久www免费人成看片高清| 亚洲国产美女搞黄色| 经典三级视频一区| 欧美日韩成人高清| 亚洲精品久久久蜜桃| 国产精品综合一区二区三区| 色综合久久久久网| 国产精品色哟哟| 精品一区二区精品| 欧美美女喷水视频| 亚洲国产精品久久人人爱蜜臀| 盗摄精品av一区二区三区| 日韩欧美亚洲另类制服综合在线 | 久久爱www久久做| 欧美精品在线一区二区| 一区二区在线看| 日本韩国精品在线| 亚洲最新视频在线播放| 91免费版pro下载短视频| 欧美激情资源网| eeuss影院一区二区三区| 国产精品无人区| 91色.com| 亚洲成av人片一区二区三区| 精品视频色一区| 日韩精品乱码免费| 久久九九影视网| a级高清视频欧美日韩| 亚洲日本在线a| 欧美精品黑人性xxxx| 午夜电影一区二区三区| 日韩区在线观看| 成人三级伦理片| 视频一区二区三区在线| 精品国产乱码久久久久久免费 | 久久久一区二区三区捆绑**| 不卡一二三区首页| 日本中文字幕一区二区有限公司| 欧美妇女性影城| 大尺度一区二区| 亚洲成av人**亚洲成av**| 久久精品夜色噜噜亚洲a∨| 91免费在线看| 国产精品亚洲午夜一区二区三区 | 国内外成人在线视频| 亚洲精品中文字幕在线观看| 精品不卡在线视频| 日本福利一区二区| 成人美女视频在线看| 另类中文字幕网| 亚洲国产综合色| 国产精品福利一区| 欧美精品一区二区三区蜜桃| 在线亚洲精品福利网址导航| 99在线精品观看| 国产91精品久久久久久久网曝门| 婷婷开心久久网| 亚洲第一福利视频在线| 亚洲福利国产精品| 一区二区三区国产| 亚洲视频在线一区二区| 国产精品女主播av| 国产精品久久99| 国产精品美女久久久久av爽李琼 | 天天色天天操综合| 亚洲精品视频一区| 亚洲一级在线观看| 亚洲国产精品久久久男人的天堂| 亚洲精品成人天堂一二三| 亚洲欧美激情在线| 性做久久久久久久免费看| 午夜精品aaa| 久久69国产一区二区蜜臀| 经典三级视频一区| 成人免费毛片嘿嘿连载视频| 97精品国产露脸对白| 欧美日韩免费在线视频| www日韩大片| 亚洲黄一区二区三区| 男女视频一区二区| 国产成人在线网站| 欧美性生活一区|