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

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

?? normalmixture.java

?? 一個小型的數據挖掘器應用軟件,綜合數據挖掘的各種功能
?? 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 Yong Wang * */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.3 $ */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一区二区三区免费野_久草精品视频
图片区小说区区亚洲影院| 亚洲最大成人综合| 欧美一区二区三区爱爱| 欧美无砖砖区免费| 欧美军同video69gay| 7777精品伊人久久久大香线蕉最新版| 欧美日韩在线一区二区| 欧美性欧美巨大黑白大战| 欧美日韩一区二区在线视频| 91黄色免费观看| 欧美午夜一区二区三区| 欧美顶级少妇做爰| 欧美成人video| 国产三区在线成人av| 国产精品―色哟哟| 亚洲视频在线观看三级| 亚洲成a人v欧美综合天堂| 日本大胆欧美人术艺术动态| 久久精品国产在热久久| 成人激情小说网站| 在线免费观看一区| 日韩欧美成人一区二区| 国产女人aaa级久久久级| 日韩伦理av电影| 日韩国产精品大片| 成人亚洲一区二区一| 在线一区二区三区做爰视频网站| 欧美精品久久一区二区三区| 国产色91在线| 亚洲国产成人av好男人在线观看| 蜜桃av一区二区在线观看| 懂色av一区二区三区免费看| 在线看国产一区| 久久久综合九色合综国产精品| 18成人在线观看| 日本系列欧美系列| www.成人在线| 日韩欧美中文字幕制服| 亚洲日本欧美天堂| 久久国内精品视频| 欧美视频完全免费看| 国产偷v国产偷v亚洲高清| 五月天激情综合网| 成人午夜看片网址| 欧美另类一区二区三区| 中文字幕佐山爱一区二区免费| 看电视剧不卡顿的网站| 欧美一a一片一级一片| 久久久久久99精品| 日韩国产在线观看| 91国产成人在线| 亚洲国产精品av| 九九热在线视频观看这里只有精品| 色婷婷av一区二区三区之一色屋| 久久久久久影视| 老司机午夜精品| 制服丝袜亚洲色图| 一区二区三区四区蜜桃| 成人免费不卡视频| 久久综合五月天婷婷伊人| 青青草成人在线观看| 欧美色精品天天在线观看视频| 国产精品视频麻豆| 国产高清精品在线| 久久精品在线免费观看| 久久精品国产在热久久| 欧美一区二区三区免费观看视频| 亚洲国产乱码最新视频 | 国产乱子轮精品视频| 欧美日韩久久久久久| 亚洲国产色一区| 99久久婷婷国产综合精品| 欧美激情一区不卡| 东方aⅴ免费观看久久av| 国产午夜三级一区二区三| 九色综合狠狠综合久久| 久久影院午夜论| 国产精品91xxx| 中文字幕在线免费不卡| 99精品国产一区二区三区不卡| 国产精品久久夜| 91在线视频播放| 一区二区三区日韩欧美| 欧美日韩国产天堂| 麻豆精品在线播放| 久久久久97国产精华液好用吗| 国产精华液一区二区三区| 中日韩av电影| 欧美性猛交xxxx乱大交退制版| 日韩高清中文字幕一区| 精品国产91亚洲一区二区三区婷婷| 极品少妇xxxx精品少妇偷拍 | 国产精品乱码久久久久久| 成人久久18免费网站麻豆 | 久久激情五月激情| 精品粉嫩超白一线天av| 成人网页在线观看| 一区二区三区小说| 精品国产一区二区精华| 波多野结衣中文字幕一区二区三区| 亚洲精品乱码久久久久久黑人| 欧美天堂亚洲电影院在线播放| 久久99久久99小草精品免视看| 国产日韩欧美精品一区| 欧美三级电影一区| 国产一区二区三区电影在线观看| 最新国产成人在线观看| 欧美一区二区视频观看视频| 国产在线不卡一区| 一区二区三区 在线观看视频| 日韩欧美国产一区二区三区| av午夜一区麻豆| 久久99热99| 亚洲自拍与偷拍| 国产三级精品视频| 欧美日韩高清一区| 国产69精品久久777的优势| 亚洲制服欧美中文字幕中文字幕| www久久久久| 欧美在线看片a免费观看| 国产一区二区三区国产| 亚洲成va人在线观看| 国产精品国产三级国产| 日韩一区和二区| 在线观看91视频| 成人手机电影网| 久久99热狠狠色一区二区| 亚洲一区自拍偷拍| 中文字幕欧美一| 国产色91在线| 精品美女一区二区| 欧美日韩精品一区视频| 99久久夜色精品国产网站| 精品亚洲aⅴ乱码一区二区三区| 亚洲影院久久精品| 国产精品久久久久影院| 久久精品视频一区二区| 欧美电影免费观看完整版| 91精品蜜臀在线一区尤物| 欧美三级中文字| 91久久精品一区二区二区| 成人黄色一级视频| 国产成人亚洲综合a∨猫咪| 极品少妇xxxx精品少妇| 蜜臀av亚洲一区中文字幕| 爽好久久久欧美精品| 亚洲国产日韩a在线播放性色| 亚洲欧美激情一区二区| 成人欧美一区二区三区黑人麻豆| 欧美韩国日本一区| 中文字幕av资源一区| 国产亚洲欧洲997久久综合 | 成人福利视频在线| 粉嫩aⅴ一区二区三区四区五区| 国产精品一二三区| 成人激情免费电影网址| 97精品久久久久中文字幕| 91欧美一区二区| 欧美性欧美巨大黑白大战| 欧美一a一片一级一片| 欧美电影一区二区| 日韩欧美精品三级| 久久久久久99久久久精品网站| 久久精品亚洲国产奇米99| 国产精品国产成人国产三级| 亚洲欧美激情小说另类| 午夜一区二区三区在线观看| 欧美aaaaa成人免费观看视频| 精品一区二区在线观看| 国产成人免费在线观看| 99久久国产综合精品麻豆| 欧美三级三级三级| 日韩欧美电影一区| 国产精品丝袜一区| 亚洲在线观看免费| 日本三级亚洲精品| 国产suv精品一区二区三区| 91免费看`日韩一区二区| 欧美日韩亚洲不卡| 久久综合精品国产一区二区三区| 欧美—级在线免费片| 亚洲综合一区二区三区| 裸体一区二区三区| 不卡av在线网| 日韩精品中午字幕| 亚洲欧洲制服丝袜| 蜜桃视频在线一区| 99这里只有精品| 精品国产一区二区三区久久久蜜月| 国产精品久久久久一区二区三区 | 日韩精品中文字幕一区二区三区| 国产日韩欧美麻豆| 午夜精品一区二区三区免费视频 | 亚洲精品视频免费看| 美女精品一区二区| 91玉足脚交白嫩脚丫在线播放| 91麻豆精品国产91久久久久久久久| 欧美激情在线观看视频免费| 日韩电影在线免费观看| www.99精品|