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

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

?? counter.java

?? Standord Classifier實現了一個基于Java的最大熵分類器。用于模式識別
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package edu.stanford.nlp.util;import java.util.*;import java.io.Serializable;/**  * Specialized Map for storing numeric counts for objects. Works like a normal * Map but with extra methods for easily getting/setting/incrementing counts * for objects and computing various functions with the counts. Any attempt to * put a non-Double value into this Counter will result in an  * IllegalArgumentException being thrown. Note however that the Map constructor * and <tt>putAll</tt> method can be used to copy another Counter's contents  * over (see also <tt>addAll(Counter)</tt>). This class also provides access * to Comparators that can be used to sort the keys or entries of this Counter * by the counts, in either ascending or descending order. * @author Dan Klein * @author Joseph Smarr (jsmarr@stanford.edu) */public class Counter extends HashMap implements Serializable {    /** Default comparator for breaking ties in argmin and argmax. */    private static final Comparator naturalComparator=new NaturalComparator();    private static final long serialVersionUID = 3;        private double total; // current total count of all entries        /** Constructs a new (empty) Counter. */    public Counter() { super(); }        /**     * Constructs a new Counter with the contents of the given Map.     * The values in <tt>m</tt> must all be Doubles or an      * IllegalArgumentException will be thrown when they are added.     */    public Counter(Map m) { this(); putAll(m); }        // --- Standard access/modification methods --- //        /**      * Returns the current total count for all objects in this Counter. The     * total is maintained as counts are adjusted so it can be returned quickly     * without having to sum all the counts on demand.     */    public double totalCount() { return(total); }          /**      * Returns the total count for all objects in this Counter that pass the      * given Filter. Passing in a filter that always returns true is equivalent      * to calling {@link #total()}, though the latter is faster since the total     * is maintained internally as counts are adjusted.     */    public double totalCount(Filter filter)    {        double total=0.0;        for(Iterator iter=seenSet().iterator();iter.hasNext();)        {            Object key=iter.next();            if(filter.accept(key)) total+=getCount(key);        }        return(total);    }        /** Returns the mean of all the counts (totalCount/size). */    public double averageCount() { return(totalCount()/size()); }           /**     * Returns the current count for the given key, which is 0 if it hasn't been     * seen before. This is a convinient version of <tt>get</tt> that casts     * and extracts the primitive value.     */    public double getCount(Object key)    {        Number count=(Number)get(key);        if(count==null) return(0); // haven't seen this object before -> 0 count        return(count.doubleValue());    }        /**     * Returns the current count for the given key as a fraction of the total     * count in the counter. This is equivalent to assuming that all the counts     * sum to one, but it doesn't actually change the raw counts.     */    public double getNormalizedCount(Object key)    {        return(getCount(key)/total());    }        /**     * Sets the current count for the given key. This will wipe out any existing     * count for that key.      * <p>     * To add to a count instead of replacing it, use      * {@link #incrementCount(Object,double)}.     */    public void setCount(Object key,double count)    {        put(key,new Double(count));    }        /**     * Sets the current count for each of the given keys. This will wipe out     * any existing counts for these keys.     * <p>     * To add to the counts of a collection of objects instead of replacing them,     * use {@link #incrementCounts(Collection,double)}.     */    public void setCounts(Collection keys,double count)    {        for(Iterator iter=keys.iterator();iter.hasNext();)            setCount(iter.next(),count);    }        /**     * Adds the given count to the current count for the given key. If the key     * hasn't been seen before, it is assumed to have count 0, and thus this      * method will set its count to the given amount. Negative increments are     * equivalent to calling <tt>decrementCount</tt>.     * <p>     * To more conviently increment the count by 1.0, use      * {@link #incrementCount(Object)}.     * <p>     * To set a count to a specifc value instead of incrementing it, use      * {@link #setCount(Object,double)}.     */    public void incrementCount(Object key,double count)    {        put(key,new Double(count+getCount(key)));    }        /**     * Adds 1.0 to the count for the given key. If the key hasn't been seen      * before, it is assumed to have count 0, and thus this method will set     * its count to 1.0.      * <p>     * To increment the count by a value other than 1.0, use      * {@link #incrementCount(Object,double)}.     * <p>     * To set a count to a specifc value instead of incrementing it, use      * {@link #setCount(Object,double)}.     */    public void incrementCount(Object key) { incrementCount(key,1.0); }           /**     * Adds the given count to the current counts for each of the given keys.     * If any of the keys haven't been seen before, they are assumed to have     * count 0, and thus this method will set their counts to the given     * amount. Negative increments are equivalent to calling <tt>decrementCounts</tt>.     * <p>     * To more conviniently increment the counts of a collection of objects by     * 1.0, use {@link #incrementCounts(Collection)}.     * <p>     * To set the counts of a collection of objects to a specific value instead     * of incrementing them, use {@link #setCounts(Collection,double)}.     */    public void incrementCounts(Collection keys,double count)    {        for(Iterator iter=keys.iterator();iter.hasNext();)            incrementCount(iter.next(),count);    }        /**     * Adds 1.0 to the counts for each of the given keys. If any of the keys      * haven't been seen before, they are assumed to have count 0, and thus      * this method will set their counts to 1.0.     * <p>     * To increment the counts of a collection of object by a value other      * than 1.0, use {@link #incrementCounts(Collection,double)}.     * <p>     * To set the counts of a collection of objects  to a specifc value instead     * of incrementing them, use  {@link #setCounts(Collection,double)}.     */    public void incrementCounts(Collection keys) { incrementCounts(keys,1.0); }        /**     * Subtracts the given count from the current count for the given key.      * If the key hasn't been seen before, it is assumed to have count 0, and      * thus this  method will set its count to the negative of the given amount.      * Negative increments are equivalent to calling <tt>incrementCount</tt>.     * <p>     * To more conviently decrement the count by 1.0, use      * {@link #decrementCount(Object)}.     * <p>     * To set a count to a specifc value instead of decrementing it, use      * {@link #setCount(Object,double)}.     */    public void decrementCount(Object key,double count)    {        incrementCount(key,-count);    }        /**     * Subtracts 1.0 from the count for the given key. If the key hasn't been      * seen  before, it is assumed to have count 0, and thus this method will      * set its count to -1.0.      * <p>     * To decrement the count by a value other than 1.0, use      * {@link #decrementCount(Object,double)}.     * <p>     * To set a count to a specifc value instead of decrementing it, use      * {@link #setCount(Object,double)}.     */    public void decrementCount(Object key) { decrementCount(key,1.0); }                   /**     * Subtracts the given count from the current counts for each of the given keys.     * If any of the keys haven't been seen before, they are assumed to have     * count 0, and thus this method will set their counts to the negative of the given     * amount. Negative increments are equivalent to calling <tt>incrementCounts</tt>.     * <p>     * To more conviniently decrement the counts of a collection of objects by     * 1.0, use {@link #decrementCounts(Collection)}.     * <p>     * To set the counts of a collection of objects to a specific value instead     * of decrementing them, use {@link #setCounts(Collection,double)}.     */    public void decrementCounts(Collection keys,double count)    {        incrementCounts(keys,-count);    }        /**     * Subtracts 1.0 from the counts of each of the given keys. If any of the keys      * haven't been seen before, they are assumed to have count 0, and thus      * this method will set their counts to -1.0.     * <p>     * To decrement the counts of a collection of object by a value other      * than 1.0, use {@link #decrementCounts(Collection,double)}.     * <p>     * To set the counts of a collection of objects  to a specifc value instead     * of decrementing them, use  {@link #setCounts(Collection,double)}.     */    public void decrementCounts(Collection keys) { decrementCounts(keys,1.0); }    /**     * Adds the counts in the given Counter to the counts in this Counter.     * <p>     * To copy the values from another Counter rather than adding them, use     * {@link #putAll(Map)} or {@link #Counter(Map)}.     */    public void addAll(Counter counter)    {        for(Iterator iter=counter.keySet().iterator();iter.hasNext();)        {            Object key=iter.next();            incrementCount(key,counter.getCount(key));        }    }        /**     * Subtracts the counts in the given Counter from the counts in this Counter.     * <p>     * To copy the values from another Counter rather than subtracting them, use     * {@link #putAll(Map)} or {@link #Counter(Map)}.     */    public void subtractAll(Counter counter)    {        for(Iterator iter=counter.keySet().iterator();iter.hasNext();)        {            Object key=iter.next();            decrementCount(key,counter.getCount(key));        }    }        // --- Collection methods (to constrain values and keep total) --- //        /**     * Adds a count for the given key if value is a Number. Throws an     * IllegalArgumentException otherwise. All of HashMap's various put     * functions route through this method, so it's the single choke point     * to ensure that only Object-->Double entries are contained in this map.     * If the value is a non-Double Number, its doubleValue is extracted and     * inserted in a new Double, so the values should always be of type Double,     * but this way adding an Integer doesn't break it.     * For normal use, use <tt>incrementCount</tt> instead.     */    public Object put(Object key,Object value) throws IllegalArgumentException    {           if(value!=null && value instanceof Number)        {                 double count=((Number)value).doubleValue();            total+=count; // add new count                        Double oldCount=(Double)super.put(key,new Double(count));             if(oldCount!=null) total-=oldCount.doubleValue(); // subtract old count (it's being replaced)                        return(oldCount); // this is what put() normally returns        }        else throw(new IllegalArgumentException("value must be a Number"));    }    /**      * Removes the given key from this Counter. Its count will now be 0 and it     * will no longer be considered previously seen.     */    public Object remove(Object key)    {        total-=getCount(key); // subtract removed count from total (may be 0)        return(super.remove(key));    }        /** Removes all the given keys from this Counter. */    public void removeAll(Collection c)    {        for(Iterator iter=c.iterator();iter.hasNext();)            remove(iter.next());    }        /**  Removes all counts from this Counter. */    public void clear()    {        super.clear();        total=0;    }           // --- Extra calculation methods --- //            /**      * Divides all the counts by the total so they collectively sum to 1.0.      * This effectively turns this Counter into a probability distribution.     * The behavior will be weird if there are any negative counts.     * Note that calling {@link #getNormalizedCount} returns the same thing     * as {@link #getCount} after calling <tt>normalize</tt> but it doesn't     * change the raw counts.     */    public void normalize()    {        double total=total(); // cache value since it will change as we normalize        for(Iterator iter=keySet().iterator();iter.hasNext();)        {            Object key=iter.next();            setCount(key,getCount(key)/total);        }    }        /**

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩在线观看一区二区 | www国产精品av| 欧美午夜精品久久久| 91网页版在线| 91亚洲男人天堂| 91丝袜国产在线播放| 91免费观看国产| 色呦呦国产精品| 欧美午夜精品久久久久久超碰| 欧美色图第一页| 欧美肥胖老妇做爰| 日韩欧美一区二区免费| 欧美不卡激情三级在线观看| 国产午夜精品一区二区三区视频| 国产日产欧美一区二区三区| 欧美高清在线一区| 日韩理论在线观看| 亚洲丰满少妇videoshd| 免费看欧美美女黄的网站| 国产一区二区在线影院| 99re这里只有精品视频首页| 91福利在线播放| 7777精品伊人久久久大香线蕉经典版下载 | 国产三级欧美三级日产三级99| 久久蜜桃一区二区| 亚洲三级小视频| 日韩精品福利网| 国产伦精品一区二区三区免费迷| 不卡高清视频专区| 欧美猛男超大videosgay| 久久亚洲影视婷婷| 亚洲欧美国产毛片在线| 日本不卡1234视频| 丁香啪啪综合成人亚洲小说| 欧美亚洲综合色| 欧美xxxxxxxx| 亚洲免费av观看| 极品少妇xxxx精品少妇| 91在线播放网址| 91精品国产综合久久久久久久久久| 国产欧美精品一区二区三区四区 | 精品处破学生在线二十三| 欧美国产日产图区| 免费在线观看日韩欧美| a亚洲天堂av| 69堂成人精品免费视频| 中文字幕在线不卡视频| 久色婷婷小香蕉久久| 欧美中文一区二区三区| 久久久久久久久免费| 亚洲午夜电影在线| av不卡在线播放| 久久久久国产成人精品亚洲午夜| 爽好多水快深点欧美视频| 成人免费视频网站在线观看| 3atv在线一区二区三区| 亚洲精品中文字幕乱码三区| 国产盗摄女厕一区二区三区| 在线综合视频播放| 亚洲一区二区高清| 99视频有精品| 国产精品乱人伦中文| 国产精品一区二区你懂的| 日韩视频在线你懂得| 天天爽夜夜爽夜夜爽精品视频| 99re在线精品| 亚洲女与黑人做爰| 91社区在线播放| 国产精品欧美一区喷水| 国产成人在线看| 国产亚洲欧美一区在线观看| 国产一区二区在线视频| 久久日韩精品一区二区五区| 久久精品国产一区二区三| 91精品久久久久久蜜臀| 蜜乳av一区二区| 欧美大片日本大片免费观看| 久久精品国产第一区二区三区 | 国产在线精品国自产拍免费| 日韩欧美一区在线观看| 男男gaygay亚洲| 91麻豆精品国产91久久久久| 石原莉奈一区二区三区在线观看| 69堂国产成人免费视频| 免播放器亚洲一区| 久久久久久亚洲综合影院红桃 | 亚洲免费av网站| 色噜噜狠狠一区二区三区果冻| 亚洲一区二区精品3399| 欧美日韩国产综合草草| 日本vs亚洲vs韩国一区三区| 在线不卡欧美精品一区二区三区| 蜜桃视频第一区免费观看| 欧美精三区欧美精三区| 久久精品999| 久久久久九九视频| 91免费精品国自产拍在线不卡| 久久精品夜夜夜夜久久| 91蝌蚪国产九色| 天天av天天翘天天综合网色鬼国产| 日韩一级二级三级| 成人av网站免费观看| 亚洲精选在线视频| 日韩免费性生活视频播放| 成人av在线播放网站| 亚洲综合无码一区二区| 日韩一区二区免费在线观看| 成人一区二区三区| 亚洲成人av一区二区三区| 7777精品伊人久久久大香线蕉超级流畅 | 免费看日韩a级影片| 国产日韩欧美高清在线| 91成人看片片| 狠狠色丁香久久婷婷综| 亚洲综合一区二区精品导航| 久久午夜国产精品| 欧美三级电影在线观看| 国产在线一区观看| 亚洲第一狼人社区| 国产精品美女久久久久久2018| 欧美三区免费完整视频在线观看| 国产一区二区不卡| 日韩成人精品在线| 亚洲黄色性网站| 国产午夜亚洲精品午夜鲁丝片| 欧美色手机在线观看| 不卡在线观看av| 久久丁香综合五月国产三级网站| 一区二区不卡在线视频 午夜欧美不卡在| 欧美mv和日韩mv的网站| 欧美视频一区二区在线观看| 成人av小说网| 国产自产v一区二区三区c| 亚洲福利视频导航| 玉米视频成人免费看| 亚洲国产精品av| 久久久蜜臀国产一区二区| 日韩一区二区三区在线观看| 色哟哟国产精品| 99久久婷婷国产综合精品电影| 国产尤物一区二区在线| 免费成人美女在线观看| 午夜精品一区二区三区电影天堂| 椎名由奈av一区二区三区| 久久蜜桃av一区精品变态类天堂 | 国产精品全国免费观看高清| 日韩精品一区二区三区swag| 欧美日韩国产精品成人| 91色综合久久久久婷婷| 国产福利一区二区三区在线视频| 免费欧美日韩国产三级电影| 日本人妖一区二区| 男人的j进女人的j一区| 日韩激情视频网站| 蜜乳av一区二区三区| 精品在线一区二区三区| 狠狠色狠狠色合久久伊人| 久久国内精品视频| 另类调教123区| 黄色资源网久久资源365| 精品一区二区三区免费毛片爱| 狠狠色丁香婷婷综合| 国产成人免费在线观看不卡| 国产盗摄女厕一区二区三区| 99久久综合狠狠综合久久| 99精品久久99久久久久| 91久久奴性调教| 在线播放视频一区| 精品国产一区二区三区四区四 | 99re热这里只有精品免费视频| 99re热视频这里只精品| 在线观看成人小视频| 3atv一区二区三区| 久久久国际精品| 国产精品天干天干在线综合| 一区二区三区中文在线观看| 午夜av一区二区| 国产一区啦啦啦在线观看| av爱爱亚洲一区| 宅男噜噜噜66一区二区66| 国产亚洲欧美色| 亚洲精品老司机| 精品一区二区日韩| 91免费国产在线| 欧美v亚洲v综合ⅴ国产v| 亚洲欧洲韩国日本视频 | 欧美一区二区大片| 国产亚洲美州欧州综合国 | 在线播放国产精品二区一二区四区| 日韩欧美一区在线观看| 中文字幕在线播放不卡一区| 日韩精品欧美成人高清一区二区| 懂色av一区二区三区蜜臀| 欧美午夜精品久久久| 国产偷v国产偷v亚洲高清 | 精品免费视频一区二区| 亚洲同性gay激情无套| 美女脱光内衣内裤视频久久网站 | 日韩va欧美va亚洲va久久| 粉嫩久久99精品久久久久久夜|