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

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

?? nnconditionalestimator.java

?? 數據挖掘estimators算法
?? 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. *//* *    NNConditionalEstimator.java *    Copyright (C) 1999 Len Trigg * */package weka.estimators;import java.util.*;import weka.core.*;/**  * Conditional probability estimator for a numeric domain conditional upon * a numeric domain (using Mahalanobis distance). * * @author Len Trigg (trigg@cs.waikato.ac.nz) * @version $Revision: 1.4 $ */public class NNConditionalEstimator implements ConditionalEstimator {  /** Vector containing all of the values seen */  private Vector m_Values = new Vector();  /** Vector containing all of the conditioning values seen */  private Vector m_CondValues = new Vector();  /** Vector containing the associated weights */  private Vector m_Weights = new Vector();  /** The sum of the weights so far */  private double m_SumOfWeights;  /** Current Conditional mean */  private double m_CondMean;  /** Current Values mean */  private double m_ValueMean;  /** Current covariance matrix */  private Matrix m_Covariance;  /** Whether we can optimise the kernel summation */  private boolean m_AllWeightsOne = true;  /** 2 * PI */  private static double TWO_PI = 2 * Math.PI;    // ===============  // Private methods  // ===============  /**   * Execute a binary search to locate the nearest data value   *   * @param key the data value to locate   * @param secondaryKey the data value to locate   * @return the index of the nearest data value   */  private int findNearestPair(double key, double secondaryKey) {        int low = 0;     int high = m_CondValues.size();    int middle = 0;    while (low < high) {      middle = (low + high) / 2;      double current = ((Double)m_CondValues.elementAt(middle)).doubleValue();      if (current == key) {	double secondary = ((Double)m_Values.elementAt(middle)).doubleValue();	if (secondary == secondaryKey) {	  return middle;	}	if (secondary > secondaryKey) {	  high = middle;	} else if (secondary < secondaryKey) {	  low = middle + 1;	}      }      if (current > key) {	high = middle;      } else if (current < key) {	low = middle + 1;      }    }    return low;  }  /** Calculate covariance and value means */  private void calculateCovariance() {        double sumValues = 0, sumConds = 0;    for(int i = 0; i < m_Values.size(); i++) {      sumValues += ((Double)m_Values.elementAt(i)).doubleValue()	* ((Double)m_Weights.elementAt(i)).doubleValue();      sumConds += ((Double)m_CondValues.elementAt(i)).doubleValue()	* ((Double)m_Weights.elementAt(i)).doubleValue();    }    m_ValueMean = sumValues / m_SumOfWeights;    m_CondMean = sumConds / m_SumOfWeights;    double c00 = 0, c01 = 0, c10 = 0, c11 = 0;    for(int i = 0; i < m_Values.size(); i++) {      double x = ((Double)m_Values.elementAt(i)).doubleValue();      double y = ((Double)m_CondValues.elementAt(i)).doubleValue();      double weight = ((Double)m_Weights.elementAt(i)).doubleValue();      c00 += (x - m_ValueMean) * (x - m_ValueMean) * weight;      c01 += (x - m_ValueMean) * (y - m_CondMean) * weight;      c11 += (y - m_CondMean) * (y - m_CondMean) * weight;    }    c00 /= (m_SumOfWeights - 1.0);    c01 /= (m_SumOfWeights - 1.0);    c10 = c01;    c11 /= (m_SumOfWeights - 1.0);    m_Covariance = new Matrix(2, 2);    m_Covariance.setElement(0, 0, c00);    m_Covariance.setElement(0, 1, c01);    m_Covariance.setElement(1, 0, c10);    m_Covariance.setElement(1, 1, c11);  }  /**   * Returns value for normal kernel   *   * @param x the argument to the kernel function   * @param variance the variance   * @return the value for a normal kernel   */  private double normalKernel(double x, double variance) {        return Math.exp(-x * x / (2 * variance)) / Math.sqrt(variance * TWO_PI);  }    /**   * Add a new data value to the current estimator.   *   * @param data the new data value    * @param given the new value that data is conditional upon    * @param weight the weight assigned to the data value    */  public void addValue(double data, double given, double weight) {        int insertIndex = findNearestPair(given, data);    if ((m_Values.size() <= insertIndex)	|| (((Double)m_CondValues.elementAt(insertIndex)).doubleValue()	    != given)	|| (((Double)m_Values.elementAt(insertIndex)).doubleValue()	    != data)) {      m_CondValues.insertElementAt(new Double(given), insertIndex);      m_Values.insertElementAt(new Double(data), insertIndex);      m_Weights.insertElementAt(new Double(weight), insertIndex);      if (weight != 1) {	m_AllWeightsOne = false;      }    } else {      double newWeight = ((Double)m_Weights.elementAt(insertIndex))	.doubleValue();      newWeight += weight;      m_Weights.setElementAt(new Double(newWeight), insertIndex);      m_AllWeightsOne = false;          }    m_SumOfWeights += weight;    // Invalidate any previously calculated covariance matrix    m_Covariance = null;  }  /**   * Get a probability estimator for a value   *   * @param data the value to estimate the probability of   * @param given the new value that data is conditional upon    * @return the estimator for the supplied value given the condition   */  public Estimator getEstimator(double given) {        if (m_Covariance == null) {      calculateCovariance();    }    Estimator result = new MahalanobisEstimator(m_Covariance,						given - m_CondMean,						m_ValueMean);    return result;  }  /**   * Get a probability estimate for a value   *   * @param data the value to estimate the probability of   * @param given the new value that data is conditional upon    * @return the estimated probability of the supplied value   */  public double getProbability(double data, double given) {        return getEstimator(given).getProbability(data);  }  /** Display a representation of this estimator */  public String toString() {        if (m_Covariance == null) {      calculateCovariance();    }    String result = "NN Conditional Estimator. "      + m_CondValues.size()       + " data points.  Mean = " + Utils.doubleToString(m_ValueMean, 4, 2)      + "  Conditional mean = " + Utils.doubleToString(m_CondMean, 4, 2);    result += "  Covariance Matrix: \n" + m_Covariance;    return result;  }  /**   * Main method for testing this class.   *   * @param argv should contain a sequence of numeric values   */  public static void main(String [] argv) {        try {      int seed = 42;      if (argv.length > 0) {	seed = Integer.parseInt(argv[0]);      }      NNConditionalEstimator newEst = new NNConditionalEstimator();      // Create 100 random points and add them      Random r = new Random(seed);            int numPoints = 50;      if (argv.length > 2) {	numPoints = Integer.parseInt(argv[2]);      }      for(int i = 0; i < numPoints; i++) {	int x = Math.abs(r.nextInt() % 100);	int y = Math.abs(r.nextInt() % 100);	System.out.println("# " + x + "  " + y);	newEst.addValue(x, y, 1);      }      //    System.out.println(newEst);      int cond;      if (argv.length > 1) {	cond = Integer.parseInt(argv[1]);      }      else cond = Math.abs(r.nextInt() % 100);      System.out.println("## Conditional = " + cond);      Estimator result = newEst.getEstimator(cond);      for(int i = 0; i <= 100; i+= 5) {	System.out.println(" " + i + "  " + result.getProbability(i));      }    } catch (Exception e) {      System.out.println(e.getMessage());    }  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产一区二区在线观看| 五月天亚洲精品| 亚洲va欧美va人人爽| 国产精品456| 51精品视频一区二区三区| 中文字幕精品综合| 蜜臀久久久久久久| 91黄色在线观看| 日本一区二区成人在线| 麻豆成人久久精品二区三区红 | 91电影在线观看| 久久新电视剧免费观看| 日韩成人一级大片| 日本道在线观看一区二区| 日本一区免费视频| 精品在线一区二区三区| 欧美日韩不卡在线| 亚洲第一狼人社区| 91网页版在线| 亚洲同性同志一二三专区| 国产精品夜夜嗨| 日韩精品一区二| 久久精品久久精品| 欧美一区二区三区爱爱| 奇米影视在线99精品| 欧美精品视频www在线观看| 亚洲精品乱码久久久久久| 懂色av一区二区夜夜嗨| 久久人人97超碰com| 美女网站视频久久| 日韩精品一区二区三区视频在线观看| 日韩av网站免费在线| 7777女厕盗摄久久久| 日韩精品一二区| 欧美一级在线免费| 理论电影国产精品| 精品久久久影院| 精品一区二区免费在线观看| 精品欧美乱码久久久久久| 激情综合亚洲精品| 国产三级三级三级精品8ⅰ区| 黄网站免费久久| 久久精品男人天堂av| va亚洲va日韩不卡在线观看| 中文字幕在线不卡| 一本色道久久综合狠狠躁的推荐 | av成人免费在线| 一区二区在线观看av| 欧美视频一区二区| 午夜精品爽啪视频| 日韩欧美的一区| 国产精品一区一区三区| 中文字幕亚洲不卡| 欧美性三三影院| 蜜桃av一区二区在线观看| 国产亚洲一区字幕| 欧美主播一区二区三区| 日韩一区精品字幕| 国产欧美一区二区精品久导航| 波多野结衣中文字幕一区二区三区 | 国产农村妇女精品| 91传媒视频在线播放| 日本aⅴ亚洲精品中文乱码| 2020国产成人综合网| 91浏览器打开| 麻豆国产精品777777在线| 亚洲国产精品激情在线观看 | 大白屁股一区二区视频| 亚洲小说欧美激情另类| 欧美精品一区二区高清在线观看 | 一色桃子久久精品亚洲| 欧美狂野另类xxxxoooo| 成人理论电影网| 三级一区在线视频先锋| 中文字幕乱码亚洲精品一区| 宅男噜噜噜66一区二区66| 丁香五精品蜜臀久久久久99网站| 亚洲第一主播视频| 国产精品视频线看| 欧美一二三四区在线| 91亚洲精品久久久蜜桃网站| 精品亚洲国产成人av制服丝袜| 一区免费观看视频| 久久久亚洲午夜电影| 欧美老年两性高潮| 91老司机福利 在线| 国产成人av一区二区| 日本三级韩国三级欧美三级| 一区二区在线免费观看| 国产欧美一二三区| 日韩欧美精品在线| 欧美日韩大陆一区二区| 一本到不卡免费一区二区| 国内不卡的二区三区中文字幕| 亚洲国产精品久久久男人的天堂 | 久久久精品黄色| 日韩一区二区麻豆国产| 在线看一区二区| 成人激情动漫在线观看| 国内精品视频一区二区三区八戒| 亚洲综合在线观看视频| 17c精品麻豆一区二区免费| 国产三级欧美三级日产三级99| 777奇米四色成人影色区| 欧美自拍偷拍午夜视频| 在线一区二区三区四区| 99热在这里有精品免费| 成人av网址在线| 国产成人精品综合在线观看| 久久国产精品第一页| 麻豆成人免费电影| 麻豆国产一区二区| 狠狠色狠狠色综合系列| 激情图片小说一区| 久久激五月天综合精品| 免费不卡在线观看| 精品一二线国产| 国产精品一区二区无线| 国产成人精品一区二区三区四区| 国产一区二区在线看| 国产在线视视频有精品| 国产真实乱对白精彩久久| 国产在线精品一区二区夜色| 国产99久久久久久免费看农村| 国产精品一二二区| 成人av在线观| 欧美亚一区二区| 欧美精品一级二级三级| 精品蜜桃在线看| 欧美激情综合五月色丁香小说| 国产偷国产偷精品高清尤物| 国产精品日产欧美久久久久| 一区二区在线观看视频| 日韩av中文字幕一区二区三区 | 色综合久久综合网| 欧美午夜一区二区三区免费大片| 欧美日韩久久久一区| 精品日韩欧美一区二区| 国产精品日韩精品欧美在线| 亚洲一区二区在线免费观看视频| 午夜精品视频在线观看| 国产久卡久卡久卡久卡视频精品| 岛国av在线一区| 欧美在线一二三| 精品久久久久久综合日本欧美| 欧美激情中文字幕| 亚洲福利视频一区二区| 韩国中文字幕2020精品| aaa亚洲精品| 欧美乱妇20p| 欧美国产精品劲爆| 午夜成人在线视频| 国产精品中文有码| 欧美日韩精品高清| 国产精品色噜噜| 蜜臀av性久久久久av蜜臀妖精 | 欧美日韩不卡一区二区| 久久久亚洲精品一区二区三区| 一区二区三区日韩欧美| 精品一区二区三区在线观看 | 一级女性全黄久久生活片免费| 人人爽香蕉精品| 91一区二区三区在线播放| 精品国产伦一区二区三区观看方式 | 精品国精品自拍自在线| 一区二区欧美精品| 成人永久aaa| 精品电影一区二区三区| 亚洲第一福利一区| 色综合久久中文综合久久牛| 26uuu亚洲婷婷狠狠天堂| 亚洲高清免费一级二级三级| 成人教育av在线| 亚洲精品在线一区二区| 亚洲韩国精品一区| 欧美一级在线免费| 亚洲欧美区自拍先锋| 国产精品一级片在线观看| 91精品在线一区二区| 亚洲综合男人的天堂| av动漫一区二区| 国产欧美一区二区三区沐欲| 蜜桃久久精品一区二区| 欧美日韩黄色一区二区| 国产精品不卡一区| 福利一区在线观看| 久久亚洲欧美国产精品乐播| 免费的成人av| 制服丝袜亚洲网站| 亚洲成在人线免费| 欧美影院一区二区| 一区二区三国产精华液| 色综合av在线| 一区二区三区在线视频免费观看| 成人精品亚洲人成在线| 国产精品网曝门| 成人亚洲一区二区一| 欧美激情一区在线| av男人天堂一区| 日韩毛片在线免费观看|