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

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

?? aprioriall.java

?? 一個數據挖掘軟件ALPHAMINERR的整個過程的JAVA版源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/**
 * Title:        XELOPES Data Mining Library
 * Description:  Java Data Mining API. Supported standarts: <a href="http://www.dmg.org">Predictive Model Markup Language (PMML 2.0) </a>;  <a href="http://www.omg.org/cwm">DataMining specification for Common Warehouse Metamodel (OMG)</a>.
 * Copyright:    Copyright (c) 2002 Prudential Systems Software GmbH
 * Company:      <a href="mailto:valentine.stepanenko@zsoft.ru">ZSoft, Spb, Russia</a>
 * @author Victor Borichev
 * @author Valentine Stepanenko (valentine.stepanenko@zsoft.ru)
 * @version 1.0
 */

package com.prudsys.pdm.Models.CustomerSeq.Algorithms;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

import com.prudsys.pdm.Core.Category;
import com.prudsys.pdm.Core.MiningException;
import com.prudsys.pdm.Core.Event.Status.CreationModelBeginMessage;
import com.prudsys.pdm.Core.Event.Status.ReadingBeginMessage;
import com.prudsys.pdm.Core.Event.Status.ReadingEndMessage;
import com.prudsys.pdm.Input.MiningVector;
import com.prudsys.pdm.Models.AssociationRules.ItemSet;
import com.prudsys.pdm.Models.CustomerSeq.CustomSequence;
import com.prudsys.pdm.Models.CustomerSeq.CustomerSequentialAlgorithm;
import com.prudsys.pdm.Models.Sequential.IntVec;
import com.prudsys.pdm.Models.Sequential.Algorithms.Seq.TransactionSet;
import com.prudsys.pdm.Utils.IntHashtable;
import com.prudsys.pdm.Utils.IntVector;

public class AprioriAll extends CustomerSequentialAlgorithm {

  Vector rules = new Vector();

  /** Customer transaction set */
  private CustomTransSet customerTransSet = null;

  /**
   * for litemsets phase of algorithm
   */
  /** Used for Lk on all steps of algorithm */
  private int L[][];
  /** Used for association table: Transaction ID -> large itemsets list */
  private int TIDTable[][];
  /** Used for customer ID of each transaction */
  private int CustomerID[];

  /** All Lk */
  private Vector allLargeItemsets;
  /** Supports for all Lk */
  private Vector allLargeItemsetsSupp;
  /** TID's */
  private Vector allTIDs;
  /** all litemsets */
  private ItemSet[] allLits;


  /** Minimum number of supporting transactions, only used if >0. */
  private int minimumSupportCount = 0;
  /** Minimum support count */
  private int m_minSuppInt;
  /** Minimum item site. */
  private int    m_minItemSize = 1;
  /** Maximum item size. */
  private int    m_maxItemSize = -1;

  /**
   * for sequential phases of algorithm
   */
  /** all large sequences */
  private Vector allLargeSequences;
  /** debug level */
  private int debug = 1;
  /** maximal length of row of tidtable */
  private int maxTidSize = 0;
  /** B1[i] = false if L1[i] doesn't make any child */
  private boolean[] B1;
  /** vector of all Bk for all Lk except for last*/
  private Vector allBk;
  /** all litemset from apriori phase as an arrays */
  private int[][] allLitsArr;
  /** all litemsets supports */
  private int[] allLitsSupp;
  /** d pruning phase */
  private boolean doPruning = true;


  public boolean getDoPruning() { return doPruning; }

  public void setDoPruning( boolean p ) { doPruning = p; }

  /**
   * Returns minimum number of transactions containing item pairs.
   * The relative minimum support value is defined by the minimumSupport
   * parameter.
   *
   * @return minimum support count
   */
  public int getMinimumSupportCount()
  {
    return minimumSupportCount;
  }

  /**
   * Sets minimum number of transactions containing item pairs.
   * The relative minimum support value is defined by the minimumSupport
   * parameter.
   *
   * @param minimumSupportCount new minimum support count
   */
  public void setMinimumSupportCount(int minimumSupportCount)
  {
    this.minimumSupportCount = minimumSupportCount;
  }

  /**
   * The method getMinSupport returns the minimum support.
   *
   * @return minimum support
   */
  public double getMinSupport() {

    return minimumSupport;
  }

  /**
   * The method getMinSupport sets the minimum support.
   *
   * @param minimum support to set
   */
  public void setMinSupport(double minSupp) {

    minimumSupport = minSupp;
  }

  public int getMinItemSize() {
    return m_minItemSize;
  }

  public void setMinItemSize(int minItemSize) {
    m_minItemSize = minItemSize;
  }

  public int getMaxItemSize() {
    return m_maxItemSize;
  }

  public void setMaxItemSize(int maxItemSize) {
    m_maxItemSize = maxItemSize;
  }


  /**
   * Checks mining algorithm for completeness by calling verify method
   * of superclass. Adiitionally, it checks whether minimumItemSize and
   * maximumItemSize are admissible.
   *
   * @throws IllegalArgumentException if some algorithm attributes are incorrect
   */
  public void verify() throws IllegalArgumentException
  {
    super.verify();
    if (m_minItemSize < 0)
      throw new IllegalArgumentException("minimumItemSize can't be negative");
    if (m_maxItemSize > -1 && m_minItemSize > m_maxItemSize)
      throw new IllegalArgumentException("minimumItemSize can't be larger than maximumItemSize");

    if (generateRules && doPruning)
      throw new IllegalArgumentException("can't generate rules with pruning");
  }

  //               << By Alexey Grinyuk >>

  /**
   * Implements the Algorithm AprioriTID.
   *
   * @param transSet transaction set
   * @return result as list of association rules
   * @author Alexey Grinyuk
   */
  private void apriori(CustomTransSet customTransSet) {
    int L1Supp[];

    m_minSuppInt = minimumSupportCount;
    if (m_minSuppInt <= 0)
      m_minSuppInt = (int)Math.ceil( minimumSupport * customTransSet.getSize() );
    System.out.println("---------minSuppCount: " + m_minSuppInt + "--------");

    // build L1 and TIDTable
    L1Supp = createL1(customTransSet);
    sortArrays(L, L1Supp);
    createTIDTable(customTransSet);

    System.out.println("|L1| = " + L.length);

    // add L1 to general result
    allLargeItemsets.add(L);
    allLargeItemsetsSupp.add(L1Supp);
    allTIDs.add(TIDTable);

    createAllLk();  // recursive function for build next Lk
    System.out.println("createAllLk finished");

  }


  /**
   * Create L1 and store it in L[]
   *
   * @param transSet transaction set
   * @return supports for L1
   * @author Alexey Grinyuk
   */
  private int[] createL1(CustomTransSet customTransSet)
  {
    int i, j, item, supp;
    int customer;
    IntHashtable hashtable = new IntHashtable();
    IntHashtable hashtableTest = new IntHashtable();
    Integer suppCount;
    Integer test;
    int newItem;
    boolean addFlag;
    TransactionSet transSet;

    ItemSet transactionItemSet;
    int itemCounter;
    int tmpL[][];
    int tmpLSupp[];
    int result[];

    for(customer=0; customer<customTransSet.getSize(); customer++) {
      transSet = customTransSet.getCustomerTransSet(customer);
      // for all transactions
      for(i=0; i<transSet.getSize(); i++) {
        transactionItemSet = (ItemSet)transSet.getTransactionAt(i);
        // for all items of transaction
        for(j=0; j<transactionItemSet.getSize(); j++) {

          newItem = transactionItemSet.getItemAt(j);

          test = hashtableTest.get(newItem);
          // if item not found in hashtableTest
          if(test == null) {
            hashtableTest.put(newItem, customer); // add item to hashtableTest
            addFlag = true;
          } else if( test.equals(new Integer(customer)) ) {
            addFlag = false;
          } else {
            addFlag = true;
            hashtableTest.put(newItem, customer);
          }

          if(addFlag) {
            suppCount = hashtable.get(newItem);

            // if item not found in hashtable
            if(suppCount == null) {
              // add item to hashtable
              hashtable.put(newItem, 1);
            } else {
              // increment support counter
              hashtable.put(newItem, suppCount.intValue() + 1);
            }
          }

        }
      }
    }

    itemCounter = hashtable.size();
    tmpL = new int[itemCounter][1]; // allocate memory for L
    tmpLSupp = new int[itemCounter]; // allocate memory for supports

    Enumeration em = hashtable.keys();
    i = 0;

    // find large itemsets (build L1)
    while(em.hasMoreElements()) {
      item = ((Integer)em.nextElement()).intValue();
      supp = ((Integer)hashtable.get( item )).intValue();
      if(supp >= m_minSuppInt) {
        tmpL[i][0] = item;
        tmpLSupp[i] = supp;
        i++;
      }
    }

    L = new int[i][1];
    result = new int[i];

    // rebuild arrayas
    for(j=0; j<i; j++) {
      L[j] = tmpL[i - j - 1];
      result[j] = tmpLSupp[i - j - 1];
    }

    // return supports for L1
    return result;
  }


  /**
   * Create association table: Transaction ID -> large itemsets list
   * Store rezult in TIDTable[][]
   *
   * @param transSet transaction set
   * @author Alexey Grinyuk
   */
  private void createTIDTable(CustomTransSet customTransSet) {
    int i, j, customer, transactionSize;
    int counter = 0;
    int transactionCounter = 0;
    int customerTransCounter;
    TransactionSet transSet;
    ItemSet transactionItemSet;

    for(i=0; i<customTransSet.getSize(); i++) {
      transSet = customTransSet.getCustomerTransSet(i);
      transactionCounter += transSet.transactionList.size();
    }

    TIDTable = new int[transactionCounter][];
    CustomerID = new int[transactionCounter];

    for(customer=0; customer<customTransSet.getSize(); customer++) {
      transSet = customTransSet.getCustomerTransSet(customer);
      customerTransCounter = transSet.transactionList.size();
      // for all transactions
      for(i=0; i<customerTransCounter; i++, counter++) {
        transactionItemSet = (ItemSet)transSet.transactionList.get(i);
        transactionSize = transactionItemSet.getSize();
        TIDTable[counter] = new int[transactionSize];
        for(j=0; j<transactionSize; j++) {
          // TIDTable[counter][j] = reference to item L1
          TIDTable[counter][j] = findInArray( L, transactionItemSet.getItemAt(j) );
        }
        CustomerID[counter] = customer;
      }
    }
  }


  /**
   * Sort L1 (int[][1])
   *
   * @param arrayL - L1
   * @param arraySupp - supports for L1
   */
  private void sortArrays(int arrayL[][], int arraySupp[]) {
    int i, j, k, tmpVal, tmpSupp;
    int arraySize = arrayL.length;

    for(i=0; i < arraySize-1; i++) {
      for(j=0; j < arraySize-1-i; j++) {

        if(arrayL[j][0] > arrayL[j + 1][0]) {
          tmpVal = arrayL[j + 1][0];
          tmpSupp = arraySupp[j + 1];
          arrayL[j + 1][0] = arrayL[j][0];
          arraySupp[j + 1] = arraySupp[j];
          arrayL[j][0] = tmpVal;
          arraySupp[j] = tmpSupp;
        }
      }
    }
  }


  /**
   * Find in array int[][1]

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看免费一区| 一区2区3区在线看| 色哟哟一区二区| 精品一区二区久久| 国产精品高潮呻吟久久| 成人亚洲一区二区一| 国产一区二区日韩精品| 成人免费va视频| 99精品久久免费看蜜臀剧情介绍| av网站免费线看精品| 欧美色综合影院| 国产精品女同一区二区三区| 亚洲一区二区三区小说| 国产高清精品网站| 欧美一区二视频| 韩国午夜理伦三级不卡影院| 国产一区二区三区四区五区美女| 成人激情视频网站| 91精品国产高清一区二区三区| 日本一区二区高清| 秋霞成人午夜伦在线观看| 在线观看91精品国产入口| 国产精品久久久一本精品| av一区二区久久| 91色乱码一区二区三区| 欧美国产日产图区| jizzjizzjizz欧美| 欧美国产成人在线| 国产成人午夜精品影院观看视频 | 成人欧美一区二区三区黑人麻豆 | 日韩电影在线看| 日韩成人午夜电影| av成人老司机| 国产精品网站导航| 国产在线精品一区在线观看麻豆| 国产精品一二三区在线| 亚洲女人****多毛耸耸8| 欧美日韩一区高清| 97久久精品人人做人人爽50路| 成人免费在线视频| 久久精品网站免费观看| 欧美日韩免费电影| 99在线视频精品| 极品美女销魂一区二区三区 | 亚洲精品视频在线观看免费| 色婷婷av一区二区三区软件| 日韩二区三区在线观看| 理论电影国产精品| 樱花影视一区二区| 欧美视频在线一区二区三区 | 国产一区二区福利| 国产精品成人一区二区艾草 | 欧美性猛片aaaaaaa做受| 毛片不卡一区二区| 亚洲一区二区三区影院| 国产成人免费视频网站| 国产精品区一区二区三区| 国产亚洲精品精华液| 亚洲欧美日韩国产中文在线| 91成人网在线| 91天堂素人约啪| 成人99免费视频| av电影天堂一区二区在线观看| 精品一区二区免费| 国产精品亚洲成人| 日本乱人伦一区| 色成人在线视频| 在线成人免费观看| 精品国产一区久久| 国产精品欧美久久久久一区二区| 91美女在线视频| 久久久精品国产免大香伊| 日韩精品成人一区二区三区| heyzo一本久久综合| 欧美精品一区二区久久婷婷| 视频在线观看91| 欧美日韩美女一区二区| 亚洲精品乱码久久久久久黑人| 国产精品综合网| 久久久久久日产精品| 久久99在线观看| 国产精品一区二区在线观看网站| 成人自拍视频在线| 欧美成人午夜电影| 亚洲天堂免费在线观看视频| 看电视剧不卡顿的网站| 波多野结衣中文字幕一区二区三区 | 夜夜亚洲天天久久| 国产精品1区二区.| 麻豆精品一区二区综合av| 国产ts人妖一区二区| 中文字幕成人网| 色综合久久中文综合久久97 | 日韩午夜精品视频| 久久奇米777| 亚洲bt欧美bt精品| 色一情一乱一乱一91av| 久久午夜电影网| 日韩精品一卡二卡三卡四卡无卡| 国产成人午夜电影网| 久久蜜桃一区二区| 美女国产一区二区三区| 精品视频1区2区3区| 亚洲欧美综合在线精品| 成人免费视频一区| 中文字幕一区二区三区乱码在线| 毛片av中文字幕一区二区| 欧美电影影音先锋| 蜜臀av性久久久久av蜜臀妖精| 欧美日韩一区二区三区免费看| 伊人开心综合网| 91久久一区二区| 日本午夜一本久久久综合| 欧美视频一二三区| 久久国产剧场电影| 中国色在线观看另类| 99热精品一区二区| 五月激情六月综合| 精品国产伦一区二区三区观看体验 | 石原莉奈在线亚洲二区| 精品欧美黑人一区二区三区| 国产中文字幕一区| 亚洲在线成人精品| 日韩一级成人av| 91视视频在线直接观看在线看网页在线看 | 亚洲永久免费视频| 久久久欧美精品sm网站| 色香蕉久久蜜桃| 成人av网站在线观看| 日韩高清一区在线| 亚洲激情第一区| 久久精品欧美日韩| 91麻豆精品国产| 色吊一区二区三区| www.av亚洲| 成人av资源网站| 国产精品一区免费在线观看| 日韩精品一区第一页| 一区二区在线电影| 亚洲免费av高清| 亚洲欧美经典视频| 国产精品久久久久天堂| 国产欧美视频在线观看| 欧美成人video| 26uuu精品一区二区在线观看| 在线成人小视频| 日韩欧美在线观看一区二区三区| 日本精品视频一区二区三区| 亚洲男同性视频| 日本人妖一区二区| 日本女优在线视频一区二区| 午夜久久福利影院| 亚洲第四色夜色| 亚洲精品一二三区| 美女脱光内衣内裤视频久久影院| 国产女主播一区| 国产欧美综合色| 欧美三级乱人伦电影| 波多野结衣视频一区| 精品一区二区三区不卡| 国产精品乡下勾搭老头1| 色呦呦国产精品| 欧美日韩国产精选| 欧美a级一区二区| 国产精品国产三级国产aⅴ无密码| 欧美精品久久99| 成人激情小说乱人伦| 丝袜亚洲另类欧美| 国产精品久久久久一区| 91精品国产综合久久香蕉的特点| 亚洲欧洲另类国产综合| 日本在线播放一区二区三区| 精品中文字幕一区二区小辣椒| 国产精品国产三级国产有无不卡 | 欧美国产精品一区二区三区| 欧美人狂配大交3d怪物一区| 欧美最猛性xxxxx直播| 99re热这里只有精品视频| 蜜桃91丨九色丨蝌蚪91桃色| 国产一区二区三区高清播放| 色诱视频网站一区| 中文字幕不卡三区| 国产精品一级在线| 在线区一区二视频| 欧美激情一区不卡| 粉嫩av一区二区三区在线播放| 欧美三级乱人伦电影| 欧美成人一级视频| 另类小说图片综合网| 精品99999| 色欧美日韩亚洲| 亚洲午夜久久久久中文字幕久| 在线影院国内精品| 成人免费小视频| 日韩一二三区不卡| 激情综合色综合久久综合| 国产农村妇女精品| 欧美在线free| 成人黄色777网| 午夜精品福利一区二区蜜股av|