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

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

?? itemset.java

?? 數據挖掘associations算法
?? 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. *//* *    ItemSet.java *    Copyright (C) 1999 Eibe Frank * */package weka.associations;import java.io.*;import java.util.*;import weka.core.*;/** * Class for storing a set of items. Item sets are stored in a lexicographic * order, which is determined by the header information of the set of instances * used for generating the set of items. All methods in this class assume that * item sets are stored in lexicographic order. * * @author Eibe Frank (eibe@cs.waikato.ac.nz) * @version $Revision: 1.8 $ */public class ItemSet implements Serializable {  /** The items stored as an array of of ints. */  protected int[] m_items;  /** Counter for how many transactions contain this item set. */  protected int m_counter;  /** The total number of transactions */  protected int m_totalTransactions;  /**   * Constructor   * @param totalTrans the total number of transactions in the data   */  public ItemSet(int totalTrans) {    m_totalTransactions = totalTrans;  }  /**   * Outputs the confidence for a rule.   *   * @param premise the premise of the rule   * @param consequence the consequence of the rule   * @return the confidence on the training data   */  public static double confidenceForRule(ItemSet premise, 					 ItemSet consequence) {    return (double)consequence.m_counter/(double)premise.m_counter;  }  /**   * Outputs the lift for a rule. Lift is defined as:<br>   * confidence / prob(consequence)   *   * @param premise the premise of the rule   * @param consequence the consequence of the rule   * @param consequenceCount how many times the consequence occurs independent   * of the premise   * @return the lift on the training data   */  public double liftForRule(ItemSet premise, 			    ItemSet consequence,			    int consequenceCount) {    double confidence = confidenceForRule(premise, consequence);   return confidence / ((double)consequenceCount / 	  (double)m_totalTransactions);  }  /**   * Outputs the leverage for a rule. Leverage is defined as: <br>   * prob(premise & consequence) - (prob(premise) * prob(consequence))   *   * @param premise the premise of the rule   * @param consequence the consequence of the rule   * @param premiseCount how many times the premise occurs independent   * of the consequent   * @param consequenceCount how many times the consequence occurs independent   * of the premise   * @return the leverage on the training data   */  public double leverageForRule(ItemSet premise,				ItemSet consequence,				int premiseCount,				int consequenceCount) {    double coverageForItemSet = (double)consequence.m_counter /       (double)m_totalTransactions;    double expectedCoverageIfIndependent =       ((double)premiseCount / (double)m_totalTransactions) *       ((double)consequenceCount / (double)m_totalTransactions);    double lev = coverageForItemSet - expectedCoverageIfIndependent;    return lev;  }  /**   * Outputs the conviction for a rule. Conviction is defined as: <br>   * prob(premise) * prob(!consequence) / prob(premise & !consequence)   *   * @param premise the premise of the rule   * @param consequence the consequence of the rule   * @param premiseCount how many times the premise occurs independent   * of the consequent   * @param consequenceCount how many times the consequence occurs independent   * of the premise   * @return the conviction on the training data   */  public double convictionForRule(ItemSet premise,				   ItemSet consequence,				   int premiseCount,				   int consequenceCount) {    double num =       (double)premiseCount * (double)(m_totalTransactions - consequenceCount) *       (double)m_totalTransactions;    double denom =       ((premiseCount - consequence.m_counter)+1);        if (num < 0 || denom < 0) {      System.err.println("*** "+num+" "+denom);      System.err.println("premis count: "+premiseCount+" consequence count "+consequenceCount+" total trans "+m_totalTransactions);    }    return num / denom;  }  /**   * Checks if an instance contains an item set.   *   * @param instance the instance to be tested   * @return true if the given instance contains this item set   */  public final boolean containedBy(Instance instance) {        for (int i = 0; i < instance.numAttributes(); i++)       if (m_items[i] > -1) {	if (instance.isMissing(i))	  return false;	if (m_items[i] != (int)instance.value(i))	  return false;      }    return true;  }  /**   * Deletes all item sets that don't have minimum support.   *   * @param itemSets the set of item sets to be pruned   * @param minSupport the minimum number of transactions to be covered   * @return the reduced set of item sets   */  public static FastVector deleteItemSets(FastVector itemSets, 					  int minSupport,					  int maxSupport) {    FastVector newVector = new FastVector(itemSets.size());    for (int i = 0; i < itemSets.size(); i++) {      ItemSet current = (ItemSet)itemSets.elementAt(i);      if ((current.m_counter >= minSupport) 	  && (current.m_counter <= maxSupport))	newVector.addElement(current);    }    return newVector;  }  /**   * Tests if two item sets are equal.   *   * @param itemSet another item set   * @return true if this item set contains the same items as the given one   */  public final boolean equals(Object itemSet) {    if ((itemSet == null) || !(itemSet.getClass().equals(this.getClass()))) {      return false;    }    if (m_items.length != ((ItemSet)itemSet).m_items.length)      return false;    for (int i = 0; i < m_items.length; i++)      if (m_items[i] != ((ItemSet)itemSet).m_items[i])	return false;    return true;  }  /**   * Generates all rules for an item set.   *   * @param minConfidence the minimum confidence the rules have to have   * @param hashtables containing all(!) previously generated   * item sets   * @param numItemsInSet the size of the item set for which the rules   * are to be generated   * @return all the rules with minimum confidence for the given item set   */  public final FastVector[] generateRules(double minConfidence, 					  FastVector hashtables,					  int numItemsInSet) {    FastVector premises = new FastVector(),consequences = new FastVector(),      conf = new FastVector();    FastVector[] rules = new FastVector[3], moreResults;    ItemSet premise, consequence;    Hashtable hashtable = (Hashtable)hashtables.elementAt(numItemsInSet - 2);    // Generate all rules with one item in the consequence.    for (int i = 0; i < m_items.length; i++)       if (m_items[i] != -1) {	premise = new ItemSet(m_totalTransactions);	consequence = new ItemSet(m_totalTransactions);	premise.m_items = new int[m_items.length];	consequence.m_items = new int[m_items.length];	consequence.m_counter = m_counter;	for (int j = 0; j < m_items.length; j++) 	  consequence.m_items[j] = -1;	System.arraycopy(m_items, 0, premise.m_items, 0, m_items.length);	premise.m_items[i] = -1;	consequence.m_items[i] = m_items[i];	premise.m_counter = ((Integer)hashtable.get(premise)).intValue();	premises.addElement(premise);	consequences.addElement(consequence);	conf.addElement(new Double(confidenceForRule(premise, consequence)));      }    rules[0] = premises;    rules[1] = consequences;    rules[2] = conf;    pruneRules(rules, minConfidence);    // Generate all the other rules    moreResults = moreComplexRules(rules, numItemsInSet, 1, minConfidence,				   hashtables);    if (moreResults != null)       for (int i = 0; i < moreResults[0].size(); i++) {	rules[0].addElement(moreResults[0].elementAt(i));	rules[1].addElement(moreResults[1].elementAt(i));	rules[2].addElement(moreResults[2].elementAt(i));      }    return rules;  }  /**   * Generates all significant rules for an item set.   *   * @param minMetric the minimum metric (confidence, lift, leverage,    * improvement) the rules have to have   * @param metricType (confidence=0, lift, leverage, improvement)   * @param hashtables containing all(!) previously generated   * item sets   * @param numItemsInSet the size of the item set for which the rules   * are to be generated   * @param the significance level for testing the rules   * @return all the rules with minimum metric for the given item set   * @exception Exception if something goes wrong   */  public final FastVector[] generateRulesBruteForce(double minMetric,						    int metricType,						FastVector hashtables,						int numItemsInSet,						int numTransactions,						double significanceLevel)   throws Exception {    FastVector premises = new FastVector(),consequences = new FastVector(),      conf = new FastVector(), lift = new FastVector(), lev = new FastVector(),      conv = new FastVector();     FastVector[] rules = new FastVector[6];    ItemSet premise, consequence;    Hashtable hashtableForPremise, hashtableForConsequence;    int numItemsInPremise, help, max, consequenceUnconditionedCounter;    double[][] contingencyTable = new double[2][2];    double metric, chiSquared;    // Generate all possible rules for this item set and test their    // significance.    max = (int)Math.pow(2, numItemsInSet);    for (int j = 1; j < max; j++) {      numItemsInPremise = 0;      help = j;      while (help > 0) {	if (help % 2 == 1)	  numItemsInPremise++;	help /= 2;      }      if (numItemsInPremise < numItemsInSet) {	hashtableForPremise = 	  (Hashtable)hashtables.elementAt(numItemsInPremise-1);	hashtableForConsequence = 	  (Hashtable)hashtables.elementAt(numItemsInSet-numItemsInPremise-1);	premise = new ItemSet(m_totalTransactions);	consequence = new ItemSet(m_totalTransactions);	premise.m_items = new int[m_items.length];	consequence.m_items = new int[m_items.length];	consequence.m_counter = m_counter;	help = j;	for (int i = 0; i < m_items.length; i++) 	  if (m_items[i] != -1) {	    if (help % 2 == 1) {          	      premise.m_items[i] = m_items[i];	      consequence.m_items[i] = -1;	    } else {	      premise.m_items[i] = -1;	      consequence.m_items[i] = m_items[i];	    }	    help /= 2;	  } else {	    premise.m_items[i] = -1;	    consequence.m_items[i] = -1;	  }	premise.m_counter = ((Integer)hashtableForPremise.get(premise)).intValue();	consequenceUnconditionedCounter =	  ((Integer)hashtableForConsequence.get(consequence)).intValue();	if (metricType == 0) {	  contingencyTable[0][0] = (double)(consequence.m_counter);	  contingencyTable[0][1] = (double)(premise.m_counter - consequence.m_counter);	  contingencyTable[1][0] = (double)(consequenceUnconditionedCounter -					    consequence.m_counter);	  contingencyTable[1][1] = (double)(numTransactions - premise.m_counter -					    consequenceUnconditionedCounter +					    consequence.m_counter);	  chiSquared = ContingencyTables.chiSquared(contingencyTable, false);		  metric = confidenceForRule(premise, consequence);		  if ((!(metric < minMetric)) &&	      (!(chiSquared > significanceLevel))) {	    premises.addElement(premise);	    consequences.addElement(consequence);	    conf.addElement(new Double(metric));	    lift.addElement(new Double(liftForRule(premise, consequence, 				       consequenceUnconditionedCounter)));	    lev.addElement(new Double(leverageForRule(premise, consequence,				     premise.m_counter,				     consequenceUnconditionedCounter)));	    conv.addElement(new Double(convictionForRule(premise, consequence,				       premise.m_counter,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩成人一区二区| 中文字幕制服丝袜成人av| 粉嫩aⅴ一区二区三区四区| 日本一区二区三区国色天香| 欧美亚洲自拍偷拍| 国产精品一区二区三区99| 亚洲一二三级电影| 国产精品网站导航| 欧美r级在线观看| 在线观看精品一区| 国产aⅴ精品一区二区三区色成熟| 亚洲日本丝袜连裤袜办公室| 久久这里只有精品视频网| 欧美三级欧美一级| 色综合一区二区三区| 国产综合久久久久影院| 黑人精品欧美一区二区蜜桃| 亚洲丝袜精品丝袜在线| 久久夜色精品国产欧美乱极品| 欧美日韩一区小说| 91在线播放网址| 成人晚上爱看视频| 国产一区二区三区四区在线观看| 五月开心婷婷久久| 亚洲国产精品精华液网站| 国产精品国产精品国产专区不蜜 | gogo大胆日本视频一区| 精品一区二区三区久久| 日韩成人一级片| 午夜欧美大尺度福利影院在线看| 亚洲人成电影网站色mp4| 成人午夜看片网址| 亚洲免费视频中文字幕| 久久夜色精品国产欧美乱极品| 国产aⅴ综合色| 午夜欧美在线一二页| 久久久国产精品麻豆| 99久久精品国产麻豆演员表| 奇米精品一区二区三区四区| 国产精品无人区| 亚洲蜜桃精久久久久久久| 国产一区二区三区四区在线观看| 亚洲国产美女搞黄色| 国产在线精品一区在线观看麻豆| 亚洲一区二区三区爽爽爽爽爽| 国产精品少妇自拍| 国产精品成人一区二区三区夜夜夜| 国产午夜精品福利| 国产精品视频在线看| ...av二区三区久久精品| 中文字幕亚洲欧美在线不卡| 亚洲欧洲av在线| 亚洲乱码国产乱码精品精可以看| 中文字幕综合网| 一区二区三区在线免费视频| 亚洲午夜一区二区三区| 日本女优在线视频一区二区| 久久精品噜噜噜成人av农村| 国产曰批免费观看久久久| 国产成人在线网站| 99re成人精品视频| 欧美日韩一本到| 欧美一卡二卡三卡| 久久九九影视网| 国产精品萝li| 亚洲成人免费av| 黄网站免费久久| 成人综合在线网站| 在线观看欧美日本| 日韩视频免费观看高清完整版在线观看| 日韩欧美在线1卡| 国产亚洲一区字幕| 亚洲欧美aⅴ...| 日韩激情av在线| 国产91精品一区二区麻豆亚洲| 91麻豆精品一区二区三区| 欧美日韩高清一区| 久久精品男人天堂av| 亚洲码国产岛国毛片在线| 五月综合激情日本mⅴ| 韩国欧美国产1区| 色哟哟国产精品| 精品国产一区二区精华| 亚洲欧洲精品一区二区三区| 婷婷中文字幕综合| 成人性色生活片免费看爆迷你毛片| 色丁香久综合在线久综合在线观看| 久久www免费人成看片高清| 99re8在线精品视频免费播放| 国产欧美精品区一区二区三区| 久久九九99视频| 一区二区三区中文在线观看| 日韩黄色小视频| 99re热视频这里只精品| 久久婷婷综合激情| 日本亚洲天堂网| 日本精品一区二区三区高清 | 国产不卡视频在线播放| 精品一区二区三区欧美| 色又黄又爽网站www久久| 精品国产一区a| 亚洲第一福利一区| 本田岬高潮一区二区三区| 91精品国产欧美日韩| 成人免费在线视频观看| 精品在线观看视频| 欧美精品久久久久久久久老牛影院 | 亚洲免费观看视频| 国产美女视频一区| 欧美日韩一区二区三区在线 | 9色porny自拍视频一区二区| 日韩一级黄色片| 亚洲国产成人精品视频| 99久久婷婷国产综合精品电影| 欧美大度的电影原声| 亚洲超碰精品一区二区| www.亚洲精品| 久久久三级国产网站| 看片的网站亚洲| 正在播放一区二区| 亚洲成人先锋电影| 在线精品视频免费播放| 亚洲视频香蕉人妖| 成人av综合在线| 国产欧美一区二区精品仙草咪| 美女精品自拍一二三四| 91精品国产综合久久久久| 亚洲一区二区三区在线看| 99精品欧美一区二区蜜桃免费| 欧美经典一区二区| 国产精品一区二区三区99| 久久综合九色综合久久久精品综合 | 2023国产精华国产精品| 日本美女一区二区| 欧美一区二区三区视频在线观看| 亚洲一区中文在线| 欧美亚日韩国产aⅴ精品中极品| 亚洲欧美视频在线观看视频| 91浏览器入口在线观看| 亚洲日本中文字幕区| 99re66热这里只有精品3直播 | 老司机精品视频线观看86| 日韩欧美一级二级| 精油按摩中文字幕久久| 日韩精品一区二区三区在线| 久久99精品一区二区三区三区| 精品日本一线二线三线不卡| 激情六月婷婷综合| 日韩精品高清不卡| 一区二区三区欧美日韩| 日本一区二区免费在线| 日av在线不卡| 亚洲免费在线视频| 久久久久国产精品人| 欧美日韩一区久久| 成人动漫视频在线| 三级欧美在线一区| 亚洲一区中文日韩| 国产精品久久久久aaaa樱花| 91精品国产91综合久久蜜臀| 成人av动漫在线| 色播五月激情综合网| 欧美日韩和欧美的一区二区| 亚洲国产精品一区二区久久恐怖片| 在线视频综合导航| 日韩av在线免费观看不卡| 91精品国产麻豆国产自产在线 | 在线成人av网站| 成人丝袜18视频在线观看| 麻豆91免费观看| 日本成人超碰在线观看| 日韩不卡手机在线v区| 一区二区三区在线播放| 国产精品毛片久久久久久久| 69精品人人人人| 欧美一区二区啪啪| 91精品国产综合久久香蕉麻豆 | 国产午夜亚洲精品午夜鲁丝片| 欧美色成人综合| 欧美一区二区三区婷婷月色| 在线精品亚洲一区二区不卡| 26uuu色噜噜精品一区二区| 国产日韩欧美综合在线| 国产日韩精品一区二区三区 | 精品久久久久久无| 精品国产亚洲一区二区三区在线观看| 91麻豆精品国产91久久久久久| 亚洲精品免费在线播放| 欧美丰满嫩嫩电影| 国产一区啦啦啦在线观看| 亚洲人成精品久久久久| 欧美区一区二区三区| 成人午夜在线视频| 日本一区中文字幕| 亚洲精品综合在线| 久久精品亚洲乱码伦伦中文| 欧美日韩久久不卡| 99久久精品国产网站| 久久99这里只有精品| 亚洲最大成人网4388xx|