亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
岛国一区二区三区| 欧美一级夜夜爽| 欧美男女性生活在线直播观看| 日韩亚洲欧美高清| 亚洲精品国产一区二区精华液| 免费高清视频精品| 欧美综合久久久| 中日韩免费视频中文字幕| 五月天亚洲精品| 91精彩视频在线观看| 久久久精品国产免费观看同学| 天堂资源在线中文精品| 成人app在线观看| 久久理论电影网| 蜜臀久久久99精品久久久久久| 色素色在线综合| 中文字幕精品—区二区四季| 久久国产综合精品| 91麻豆精品国产91久久久 | 在线精品视频免费播放| 欧美国产综合色视频| 国内不卡的二区三区中文字幕| 欧美精品 国产精品| 亚洲成人av中文| 成人免费看的视频| 国产人成一区二区三区影院| 狠狠色丁香久久婷婷综| 日韩欧美亚洲一区二区| 日韩av一区二区三区| 欧美日韩美女一区二区| 亚洲一区二区三区小说| 欧美在线观看18| 亚洲国产一区二区在线播放| 欧洲精品中文字幕| 一级特黄大欧美久久久| 欧美图片一区二区三区| 亚洲自拍偷拍麻豆| 欧美亚洲尤物久久| 日本中文一区二区三区| 日韩亚洲欧美一区二区三区| 精品中文字幕一区二区小辣椒| 日韩精品一区二区三区在线 | 欧美日韩三级一区二区| 亚洲午夜久久久| 欧美日本一道本| 日韩高清电影一区| 欧美一区二区久久| 国内精品在线播放| 亚洲国产激情av| 91亚洲精华国产精华精华液| 一区二区三区小说| 欧美一级片在线看| 国产精品自拍三区| 怡红院av一区二区三区| 欧美一区二区网站| 国产精品91一区二区| 樱桃国产成人精品视频| 日韩一卡二卡三卡国产欧美| 国产福利一区二区三区| 亚洲色图视频免费播放| 欧美男女性生活在线直播观看| 久久av资源网| 中文字幕一区二区三区色视频| 欧美综合欧美视频| 激情深爱一区二区| 一区二区视频在线看| 欧美一区二区日韩一区二区| 不卡的看片网站| 日日摸夜夜添夜夜添国产精品| 久久―日本道色综合久久| 色老头久久综合| 国产自产2019最新不卡| 亚洲欧美二区三区| 2024国产精品| 欧美日韩综合在线免费观看| 国产精品一区三区| 亚洲国产中文字幕| 国产精品视频一二三| 3d动漫精品啪啪一区二区竹菊| 成人国产电影网| 久久精品av麻豆的观看方式| 亚洲美女屁股眼交3| 久久久久久久久99精品| 欧美三级中文字幕| 97精品国产97久久久久久久久久久久| 日韩主播视频在线| 亚洲黄色性网站| 国产精品欧美极品| 精品日本一线二线三线不卡| 欧美天天综合网| 不卡的av在线播放| 国产精品99久久久久| 麻豆精品视频在线观看免费| 香蕉久久夜色精品国产使用方法| 国产精品久久免费看| 欧美xxx久久| 678五月天丁香亚洲综合网| 91伊人久久大香线蕉| 成人免费视频免费观看| 国产一区二区h| 精品一区二区三区久久久| 亚洲成人手机在线| 一区二区三区欧美日韩| 中文字幕中文在线不卡住| 久久亚洲一区二区三区明星换脸| 日韩三级视频中文字幕| 67194成人在线观看| 欧美精品v日韩精品v韩国精品v| 欧美性受极品xxxx喷水| 欧洲人成人精品| 欧美在线观看视频一区二区| 在线观看亚洲精品| 91免费观看国产| 91麻豆精品一区二区三区| heyzo一本久久综合| 不卡视频一二三四| 97久久精品人人做人人爽| 91色乱码一区二区三区| 色av成人天堂桃色av| 91国在线观看| 欧美日韩一级视频| 欧美日韩免费视频| 日韩欧美综合一区| 欧美精品一区二区三区很污很色的 | 在线免费观看日韩欧美| 91国产丝袜在线播放| 欧美日韩一区二区三区四区 | 久久久久久久综合狠狠综合| 久久久久久免费毛片精品| 久久久久久麻豆| 成人欧美一区二区三区1314| 中文字幕日韩一区| 洋洋成人永久网站入口| 亚洲1区2区3区4区| 久久99深爱久久99精品| 国产大陆a不卡| 色综合中文字幕| 制服.丝袜.亚洲.中文.综合| 精品va天堂亚洲国产| 日韩毛片高清在线播放| 亚洲第一综合色| 美女视频网站黄色亚洲| 懂色av噜噜一区二区三区av| 色老汉av一区二区三区| 欧美一级理论性理论a| 久久精品视频免费| 亚洲精品乱码久久久久久久久 | 亚洲专区一二三| 久久99热这里只有精品| 99riav久久精品riav| 91.xcao| 国产视频一区不卡| 亚洲va欧美va人人爽午夜| 国产在线视视频有精品| 在线免费精品视频| 久久精品网站免费观看| 亚洲一区二区五区| 国产一区二区三区视频在线播放| 一道本成人在线| 久久久精品影视| 天天色天天操综合| 91香蕉视频污| 久久综合中文字幕| 亚洲午夜久久久久久久久电影网 | 欧美久久久久久久久久| 亚洲国产成人午夜在线一区| 亚洲成人av免费| 91日韩精品一区| 亚洲精品一区二区三区福利| 婷婷成人综合网| 色94色欧美sute亚洲13| 国产欧美日韩在线看| 视频一区国产视频| 色欲综合视频天天天| 国产欧美精品一区| 日本中文字幕不卡| 欧美日韩你懂的| 亚洲一区二区精品3399| eeuss鲁片一区二区三区在线观看| 精品成人免费观看| 人人超碰91尤物精品国产| 欧美综合视频在线观看| 中文字幕在线视频一区| 国产精品综合二区| 久久久久久麻豆| 精品一区二区三区蜜桃| 欧美一级高清大全免费观看| 性做久久久久久| 欧美日韩黄色影视| 午夜精品久久久久久| 制服丝袜中文字幕一区| 婷婷综合另类小说色区| 欧美午夜精品一区| 亚洲成人一区二区在线观看| 欧洲国内综合视频| 亚洲一区二区偷拍精品| 欧美亚洲禁片免费| 图片区小说区区亚洲影院| 欧美日韩久久一区| 天天综合天天做天天综合|