📄 itemset.h
字号:
// ItemSet.h: interface for the ItemSet class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ITEMSET_H__66C6CF9A_7C6E_4D7F_917C_141AB37E9E67__INCLUDED_)
#define AFX_ITEMSET_H__66C6CF9A_7C6E_4D7F_917C_141AB37E9E67__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Dist.h"
#include "Taxonomy.h"
class ItemSet
{
private:
int nitems; // number of items
Taxonomy *tax; // taxonomy (optional)
float *cum_prob; // cumulative probability
float *tax_prob; // cumulative probability of choosing a child
UniformDist rand;
void normalize(float prob[], int low, int high);
public:
ItemSet(int nitems, Taxonomy *tax = NULL);
~ItemSet();
void display(ofstream &fp);
int get_item(void); // returns a random item (weighted)
int specialize(int itm); // if no taxonomy, returns itm
float weight(int itm); // returns prob. of choosing item
};
#endif // !defined(AFX_ITEMSET_H__66C6CF9A_7C6E_4D7F_917C_141AB37E9E67__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -