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

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

?? normalmixture.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.  *//* *    NormalMixture.java *    Copyright (C) 2002 University of Waikato, Hamilton, New Zealand * */package weka.classifiers.functions.pace;import java.util.Random;import weka.core.matrix.DoubleVector;import weka.core.matrix.Maths;/** * Class for manipulating normal mixture distributions. <p> * * For more information see: <p/> *  <!-- technical-plaintext-start --> * Wang, Y (2000). A new approach to fitting linear models in high dimensional spaces. Hamilton, New Zealand.<br/> * <br/> * Wang, Y., Witten, I. H.: Modeling for optimal probability prediction. In: Proceedings of the Nineteenth International Conference in Machine Learning, Sydney, Australia, 650-657, 2002. <!-- technical-plaintext-end --> *  <!-- technical-bibtex-start --> * BibTeX: * <pre> * &#64;phdthesis{Wang2000, *    address = {Hamilton, New Zealand}, *    author = {Wang, Y}, *    school = {Department of Computer Science, University of Waikato}, *    title = {A new approach to fitting linear models in high dimensional spaces}, *    year = {2000} * } *  * &#64;inproceedings{Wang2002, *    address = {Sydney, Australia}, *    author = {Wang, Y. and Witten, I. H.}, *    booktitle = {Proceedings of the Nineteenth International Conference in Machine Learning}, *    pages = {650-657}, *    title = {Modeling for optimal probability prediction}, *    year = {2002} * } * </pre> * <p/> <!-- technical-bibtex-end --> * * @author Yong Wang (yongwang@cs.waikato.ac.nz) * @version $Revision: 1.4 $ */public class  NormalMixture   extends MixtureDistribution {    /** the separating threshold */  protected double separatingThreshold = 0.05;  /** the triming thresholding */  protected double trimingThreshold = 0.7;  protected double fittingIntervalLength = 3;  /**    * Contructs an empty NormalMixture   */  public NormalMixture() {}  /**    * Gets the separating threshold value. This value is used by the method    * separatable   *    * @return the separating threshold    */  public double getSeparatingThreshold(){    return separatingThreshold;  }  /**    *  Sets the separating threshold value    *     *  @param t the threshold value    */  public void setSeparatingThreshold( double t ){    separatingThreshold = t;  }  /**    * Gets the triming thresholding value. This value is usef by the method    * trim.   *    * @return the triming thresholding    */  public double getTrimingThreshold(){     return trimingThreshold;   }  /**    * Sets the triming thresholding value.   *    * @param t the triming thresholding    */  public void setTrimingThreshold( double t ){    trimingThreshold = t;  }  /**    *  Return true if a value can be considered for mixture estimatino   *  separately from the data indexed between i0 and i1    *     *  @param data the data supposedly generated from the mixture    *  @param i0 the index of the first element in the group   *  @param i1 the index of the last element in the group   *  @param x the value   *  @return true if the value can be considered   */  public boolean separable( DoubleVector data, int i0, int i1, double x ) {    double p = 0;    for( int i = i0; i <= i1; i++ ) {      p += Maths.pnorm( - Math.abs(x - data.get(i)) );    }    if( p < separatingThreshold ) return true;    else return false;  }  /**    *  Contructs the set of support points for mixture estimation.   *     *  @param data the data supposedly generated from the mixture    *  @param ne the number of extra data that are suppposedly discarded   *  earlier and not passed into here   *  @return the set of support points   */  public DoubleVector  supportPoints( DoubleVector data, int ne ) {    if( data.size() < 2 )      throw new IllegalArgumentException("data size < 2");	    return data.copy();  }      /**    *  Contructs the set of fitting intervals for mixture estimation.   *     *  @param data the data supposedly generated from the mixture    *  @return the set of fitting intervals   */  public PaceMatrix  fittingIntervals( DoubleVector data ) {    DoubleVector left = data.cat( data.minus( fittingIntervalLength ) );    DoubleVector right = data.plus( fittingIntervalLength ).cat( data );	    PaceMatrix a = new PaceMatrix(left.size(), 2);	    a.setMatrix(0, left.size()-1, 0, left);    a.setMatrix(0, right.size()-1, 1, right);	    return a;  }      /**    *  Contructs the probability matrix for mixture estimation, given a set   *  of support points and a set of intervals.   *     *  @param s  the set of support points   *  @param intervals the intervals   *  @return the probability matrix   */  public PaceMatrix  probabilityMatrix( DoubleVector s, 					PaceMatrix intervals ) {        int ns = s.size();    int nr = intervals.getRowDimension();    PaceMatrix p = new PaceMatrix(nr, ns);	    for( int i = 0; i < nr; i++ ) {      for( int j = 0; j < ns; j++ ) {	p.set( i, j,	       Maths.pnorm( intervals.get(i, 1), s.get(j), 1 ) - 	       Maths.pnorm( intervals.get(i, 0), s.get(j), 1 ) );      }    }	    return p;  }      /**    * Returns the empirical Bayes estimate of a single value.   *    * @param x the value   * @return the empirical Bayes estimate   */  public double  empiricalBayesEstimate ( double x ) {     if( Math.abs(x) > 10 ) return x; // pratical consideration; modify later    DoubleVector d =     Maths.dnormLog( x, mixingDistribution.getPointValues(), 1 );        d.minusEquals( d.max() );    d = d.map("java.lang.Math", "exp");    d.timesEquals( mixingDistribution.getFunctionValues() );    return mixingDistribution.getPointValues().innerProduct( d ) / d.sum();  }  /**    * Returns the empirical Bayes estimate of a vector.   *    * @param x the vector   * @return the empirical Bayes estimate   */  public DoubleVector empiricalBayesEstimate( DoubleVector x ) {    DoubleVector pred = new DoubleVector( x.size() );    for(int i = 0; i < x.size(); i++ )       pred.set(i, empiricalBayesEstimate(x.get(i)) );    trim( pred );    return pred;  }  /**    * Returns the optimal nested model estimate of a vector.   *    * @param x the vector   * @return the optimal nested model estimate    */  public DoubleVector  nestedEstimate( DoubleVector x ) {        DoubleVector chf = new DoubleVector( x.size() );    for(int i = 0; i < x.size(); i++ ) chf.set( i, hf( x.get(i) ) );    chf.cumulateInPlace();    int index = chf.indexOfMax();    DoubleVector copy = x.copy();    if( index < x.size()-1 ) copy.set( index + 1, x.size()-1, 0 );    trim( copy );    return copy;  }    /**    * Returns the estimate of optimal subset selection.   *    * @param x the vector   * @return the estimate of optimal subset selection   */  public DoubleVector  subsetEstimate( DoubleVector x ) {    DoubleVector h = h( x );    DoubleVector copy = x.copy();    for( int i = 0; i < x.size(); i++ )      if( h.get(i) <= 0 ) copy.set(i, 0);    trim( copy );    return copy;  }    /**    * Trims the small values of the estaimte   *    * @param x the estimate vector   */  public void trim( DoubleVector x ) {    for(int i = 0; i < x.size(); i++ ) {      if( Math.abs(x.get(i)) <= trimingThreshold ) x.set(i, 0);    }  }    /**   *  Computes the value of h(x) / f(x) given the mixture. The   *  implementation avoided overflow.   *     *  @param x the value   *  @return the value of h(x) / f(x)   */  public double hf( double x ) {    DoubleVector points = mixingDistribution.getPointValues();    DoubleVector values = mixingDistribution.getFunctionValues();     DoubleVector d = Maths.dnormLog( x, points, 1 );    d.minusEquals( d.max() );    d = (DoubleVector) d.map("java.lang.Math", "exp");    d.timesEquals( values );      return ((DoubleVector) points.times(2*x).minusEquals(x*x))    .innerProduct( d ) / d.sum();  }      /**   *  Computes the value of h(x) given the mixture.    *     *  @param x the value   *  @return the value of h(x)   */  public double h( double x ) {    DoubleVector points = mixingDistribution.getPointValues();    DoubleVector values = mixingDistribution.getFunctionValues();     DoubleVector d = (DoubleVector) Maths.dnorm( x, points, 1 ).timesEquals( values );      return ((DoubleVector) points.times(2*x).minusEquals(x*x))    .innerProduct( d );  }      /**   *  Computes the value of h(x) given the mixture, where x is a vector.   *     *  @param x the vector   *  @return the value of h(x)   */  public DoubleVector h( DoubleVector x ) {    DoubleVector h = new DoubleVector( x.size() );    for( int i = 0; i < x.size(); i++ )       h.set( i, h( x.get(i) ) );    return h;  }      /**   *  Computes the value of f(x) given the mixture.   *     *  @param x the value   *  @return the value of f(x)   */  public double f( double x ) {    DoubleVector points = mixingDistribution.getPointValues();    DoubleVector values = mixingDistribution.getFunctionValues();     return Maths.dchisq( x, points ).timesEquals( values ).sum();  }      /**   *  Computes the value of f(x) given the mixture, where x is a vector.   *     *  @param x the vector   *  @return the value of f(x)   */  public DoubleVector f( DoubleVector x ) {    DoubleVector f = new DoubleVector( x.size() );    for( int i = 0; i < x.size(); i++ )       f.set( i, h( f.get(i) ) );    return f;  }      /**    * Converts to a string   *    * @return a string representation   */  public String  toString() {    return mixingDistribution.toString();  }      /**    * Method to test this class    *    * @param args the commandline arguments - ignored   */  public static void  main(String args[]) {    int n1 = 50;    int n2 = 50;    double mu1 = 0;    double mu2 = 5;     DoubleVector a = Maths.rnorm( n1, mu1, 1, new Random() );    a = a.cat( Maths.rnorm( n2, mu2, 1, new Random() ) );    DoubleVector means = (new DoubleVector( n1, mu1 )).cat(new DoubleVector(n2, mu2));    System.out.println("==========================================================");    System.out.println("This is to test the estimation of the mixing\n" +	    "distribution of the mixture of unit variance normal\n" + 	    "distributions. The example mixture used is of the form: \n\n" + 	    "   0.5 * N(mu1, 1) + 0.5 * N(mu2, 1)\n" );    System.out.println("It also tests three estimators: the subset\n" +	    "selector, the nested model selector, and the empirical Bayes\n" +	    "estimator. Quadratic losses of the estimators are given, \n" +	    "and are taken as the measure of their performance.");    System.out.println("==========================================================");    System.out.println( "mu1 = " + mu1 + " mu2 = " + mu2 +"\n" );    System.out.println( a.size() + " observations are: \n\n" + a );    System.out.println( "\nQuadratic loss of the raw data (i.e., the MLE) = " + 	     a.sum2( means ) );    System.out.println("==========================================================");    // find the mixing distribution    NormalMixture d = new NormalMixture();    d.fit( a, NNMMethod );     System.out.println( "The estimated mixing distribution is:\n" + d );	    DoubleVector pred = d.nestedEstimate( a.rev() ).rev();    System.out.println( "\nThe Nested Estimate = \n" + pred );    System.out.println( "Quadratic loss = " + pred.sum2( means ) );    pred = d.subsetEstimate( a );    System.out.println( "\nThe Subset Estimate = \n" + pred );    System.out.println( "Quadratic loss = " + pred.sum2( means ) );    pred = d.empiricalBayesEstimate( a );    System.out.println( "\nThe Empirical Bayes Estimate = \n" + pred );    System.out.println( "Quadratic loss = " + pred.sum2( means ) );	  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美色综合网站| 9人人澡人人爽人人精品| 亚洲福利国产精品| 欧美国产亚洲另类动漫| 久久精品日韩一区二区三区| 日韩欧美综合一区| 精品久久久三级丝袜| 精品国产乱码久久久久久1区2区| 日韩精品自拍偷拍| 91精品国产乱| 337p粉嫩大胆噜噜噜噜噜91av| 日韩午夜av电影| 欧美变态tickle挠乳网站| 日韩欧美国产不卡| 国产日韩精品视频一区| 亚洲国产cao| 极品少妇xxxx精品少妇| 成人激情免费网站| 国产成人免费高清| 欧美三级视频在线观看| 日韩视频中午一区| 亚洲视频小说图片| 国产一区久久久| 一本在线高清不卡dvd| 色综合久久中文字幕综合网| www.在线欧美| 亚洲成av人影院在线观看网| 日韩影视精彩在线| 国产一区二区在线影院| www.日韩av| 欧美三级中文字幕| 久久婷婷久久一区二区三区| 久久久不卡网国产精品二区| 亚洲激情在线激情| 免费在线欧美视频| 成人av网站在线| 91麻豆精品国产91久久久 | 亚洲成av人**亚洲成av**| 视频一区视频二区在线观看| 国产精品18久久久| 色婷婷香蕉在线一区二区| 欧美一区二区视频在线观看2020| 欧美精品一区二区三区蜜桃视频| 最新欧美精品一区二区三区| 欧美aaa在线| av一本久道久久综合久久鬼色| 欧洲国产伦久久久久久久| 欧美一级午夜免费电影| 亚洲图片激情小说| 蜜桃一区二区三区四区| 色婷婷狠狠综合| 久久综合给合久久狠狠狠97色69| 中文字幕中文字幕一区二区| 日韩 欧美一区二区三区| 91在线一区二区三区| 欧美日韩在线综合| 国产精品日日摸夜夜摸av| 欧美日韩高清一区二区三区| 日韩色在线观看| 亚洲三级在线看| 国产精选一区二区三区| 91精品国产综合久久久久久漫画 | 精品日韩欧美一区二区| 欧美韩国日本一区| 成人在线综合网| 成人高清视频免费观看| 亚洲在线观看免费视频| 精品美女一区二区三区| 欧美亚洲自拍偷拍| 奇米精品一区二区三区在线观看一| 精品国产欧美一区二区| 色系网站成人免费| 国产在线精品不卡| 免费人成精品欧美精品| 91精品在线观看入口| 国产精品国产精品国产专区不蜜| 韩国毛片一区二区三区| 色一情一伦一子一伦一区| 亚洲人吸女人奶水| 国产综合久久久久久鬼色 | 国产在线乱码一区二区三区| 欧美乱熟臀69xxxxxx| 一区二区久久久| 成人看片黄a免费看在线| 日本一二三不卡| 成人动漫在线一区| 亚洲欧美区自拍先锋| 色综合天天天天做夜夜夜夜做| 中文字幕在线观看不卡| 99精品一区二区三区| 亚洲欧美一区二区久久| 91久久一区二区| 午夜精品aaa| 欧美哺乳videos| 国产黄色精品网站| 久久精品日韩一区二区三区| 成人h动漫精品| 亚洲精选免费视频| 91精品国产高清一区二区三区| 久久99精品久久久久久动态图 | 中文字幕一区二区三区不卡| 成人国产在线观看| 亚洲卡通动漫在线| 日韩一级欧美一级| 精品一区二区三区香蕉蜜桃 | 日本强好片久久久久久aaa| 欧美一区二区福利在线| 国产sm精品调教视频网站| 亚洲精品国产精华液| 欧美精选午夜久久久乱码6080| 毛片不卡一区二区| 国产精品色呦呦| 在线电影一区二区三区| 成人一区二区三区视频在线观看 | 久久久精品综合| 色综合久久六月婷婷中文字幕| 午夜私人影院久久久久| 久久日一线二线三线suv| 一本到一区二区三区| 国产一区二区视频在线播放| 最新国产精品久久精品| 欧美xxxx在线观看| 日本高清成人免费播放| 国产在线不卡一区| 亚洲成人黄色影院| 国产欧美一区二区精品仙草咪| 欧美蜜桃一区二区三区| 成人免费不卡视频| 捆绑调教一区二区三区| 一区二区高清在线| 久久久精品国产免费观看同学| 欧美午夜精品一区二区三区| 成人国产精品免费观看动漫| 婷婷亚洲久悠悠色悠在线播放| 国产精品免费丝袜| 欧美一区二区视频网站| 色88888久久久久久影院按摩| 国产一区二区精品久久91| 日韩精品亚洲一区二区三区免费| 亚洲免费资源在线播放| 国产欧美日韩视频在线观看| 精品免费99久久| 青草av.久久免费一区| 日韩视频免费直播| 国产一区欧美二区| 五月综合激情日本mⅴ| 欧美精品乱码久久久久久按摩 | 亚洲色大成网站www久久九九| 久久综合成人精品亚洲另类欧美| 制服丝袜亚洲网站| 欧美日产国产精品| 色综合天天综合色综合av| 粉嫩在线一区二区三区视频| 韩国一区二区在线观看| 美日韩一区二区| 麻豆精品一区二区| 免费观看在线综合色| 日韩精品一卡二卡三卡四卡无卡| 亚洲成av人片在线观看| 亚洲午夜在线电影| 亚洲国产成人精品视频| 午夜欧美在线一二页| 午夜久久电影网| 免费国产亚洲视频| 国产一区二区导航在线播放| 国产在线一区二区综合免费视频| 激情偷乱视频一区二区三区| 国产成人免费视频精品含羞草妖精| 国产一区二区在线看| eeuss国产一区二区三区| 91影视在线播放| 欧美日韩中文另类| 日韩午夜在线影院| 久久精品一区蜜桃臀影院| 日韩毛片高清在线播放| 亚洲国产欧美日韩另类综合 | 精品日韩av一区二区| 日韩精品专区在线影院重磅| 日韩美女在线视频| 国产拍揄自揄精品视频麻豆| 国产精品看片你懂得| 亚洲一区二区综合| 奇米影视在线99精品| 国产成人在线视频播放| 一本色道久久综合精品竹菊| 在线观看国产91| 26uuu国产电影一区二区| 欧美激情中文字幕一区二区| 亚洲午夜激情网站| 黑人巨大精品欧美黑白配亚洲| 成人va在线观看| 欧美日韩国产成人在线91| 91精品国产色综合久久不卡蜜臀 | 99视频精品免费视频| 欧美区在线观看| 国产精品伦理一区二区| 爽好多水快深点欧美视频| www.亚洲色图| www久久精品| 亚洲国产精品久久一线不卡|