⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 itemset.h

📁 数据挖掘中的经典算法Apriori实现
💻 H
字号:
//class for itemSet
#include <stdio.h>
#include "items.h"
typedef int Item;           //???????????????这里是什么意思?这样做便于将来方便修改小项的类型


/* to find the minimum and maximum integer from two parameters */
#define imax(a, b) (((a) > (b))?(a):(b))
#define imin(a, b) (((a) < (b))?(a):(b))


// Relationship between two itemSets
#define TOTALEQUAL 0
#define MAKEUP     1
#define TOTALDIFF  2
#define CROSS      3


class itemSet : public items
{

public:

    itemSet()
    {
        m_items = (Item *)NULL;   //????????????????????????
        count = 0;
        m_support = 0;
        m_weight = 0.0;
        m_keeporder = true;   //保持增序
    };

    ~itemSet()
    {
        delete m_items;
    };


    void add(Item theitem);
    void add(int index, Item theitem);
    
    void concat(itemSet *src);
    void clear();
    items *clone();
    int compare(items *item);
    Item get(int index);
    int indexOf(Item theitem, bool ascend = true);
    Item remove(int index);

    itemSet *left(int nCount);

    itemSet *sub(int bgn, int end);
    itemSet *substract(itemSet *aset);

  
    void dump();
    
    bool keeporder()            { return m_keeporder; };
    void keeporder(bool value)  { m_keeporder = value; };
    
    int size()                  { return count; };
    
    long support()              { return m_support; };
    void support(long value)    { m_support = value; };
    
    double weight()             { return m_weight; };
    void weight(double value)   { m_weight = value; }
	
private:

    Item *m_items;             //m_items 就是一个itemSet里面包含的一个项(为整型)
    int count;

    bool m_keeporder;
    
    long m_support;
    double m_weight;
	
};




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -