Subjects. More...

#include <gsimulator.h>

Public Member Functions

 GSimulator (GSession *session)
 
GSessionGetSession (void) const
 
void ApplyParams (void)
 
template<class T >
T * FindParam (const R::RString &name)
 
void StartSimulation (bool create=true)
 
bool AddSubject (void)
 
void ShareDocuments (void)
 
void AddAssessments (void)
 
size_t AddProfiles (void)
 
void PerformDegradation (char what, int nb)
 
void BuildIdealCommunities (void)
 
void BuildIdealTopics (void)
 
void BuildIdealLeafTopics (void)
 
void BuildIdealClasses (void)
 
void BuildIdealDocsClasses (void)
 
 ~GSimulator (void)
 

Static Public Member Functions

static void CreateConfig (R::RConfig *config)
 

Private Member Functions

void InitSubject (GSubject *subject, bool selectdocs)
 
void SelectSubjects (void)
 
void CreateAssessments (void)
 
void ProfileAssess (GProfile *prof, GSubject *sub, size_t max, size_t maxDocsOK, size_t maxDocsKO, size_t maxDocsH)
 
template<class cGroup , class cObj , class cCalc >
void CopyIdealGroups (tObjType objtype, tObjType grouptype, cCalc *calc)
 
void BuildClass (GSubject *subject, GClass *parent)
 

Private Attributes

GSessionSession
 
bool ManualSubjects
 
double NbSubjects
 
bool RelSubjects
 
size_t MaxDepth
 
size_t NbMinDocsSubject
 
double NbDocsPerSubject
 
bool PercNbDocsPerSubject
 
bool MultipleSubjects
 
size_t NbProfMax
 
size_t NbProfMin
 
double PercSocial
 
double NbOK
 
bool RelOK
 
double NbKO
 
bool RelKO
 
double NbH
 
bool RelH
 
size_t NbDocsAssess
 
double PercErr
 
double SwitchPerc
 
bool CreateProfiles
 
GTopic ** TmpTopics
 
GDoc ** TmpDocs
 
size_t NbTmpDocs
 
R::RContainer< GFdbk, false,
false > 
NewDocs
 
R::RRandomSwitchRandom
 
size_t SwitchPos
 
R::RContainer< GProfile, false,
false > 
NewProfiles
 

Detailed Description

Subjects.

The GSimulator class provides a simulator that can be used for validation purposes.

Constructor & Destructor Documentation

GSimulator ( GSession session)

Constructor of the simulator.

Parameters
sessionSession.
~GSimulator ( void  )

Destruct the simulator.

Member Function Documentation

GSession* GetSession ( void  ) const
Returns
The session corresponding to the simulator.
static void CreateConfig ( R::RConfig config)
static

Create the configuration parameter related to the simulator.

Parameters
configConfiguration file.
void ApplyParams ( void  )

Assign the values of the parameters to the corresponding variables.

T* FindParam ( const R::RString name)

Find a given parameter (template version).

Template Parameters
TType of the parameter.
Parameters
nameName of the parameter.
Returns
Pointer or null if not found.
void StartSimulation ( bool  create = true)

Start a simulation. A given set of subjects is chosen, then the users are created and the assessments for all the users are randomly created. The results are saved if the corresponding parameter is set in the session.

Parameters
createMust topics be selected (and profiles created).
bool AddSubject ( void  )

Add a new not used topic.

Returns
true if a not used topic was found.
void ShareDocuments ( void  )

Simulate that documents are shared inside the different communities and that the first NbDocsAssess documents are assessed.

void AddAssessments ( void  )

Simulate that all existing profiles that already have assess some documents, assess randomly NbDocsAssess documents.

size_t AddProfiles ( void  )

Add a given set of new profiles for an existing subject randomly chosen.

Returns
Number of profiles created.
void PerformDegradation ( char  what,
int  nb 
)

Perform a degradation. The ideal clustering is used as the current one, and a list of objects to assign to another group is determined.

Parameters
whatDescribe what to do:
  1. Initialize the degradation (what=0).
  2. Make the ideal clustering the current one (what=1). Eventually, randomly selected topics are merged or split.
  3. Take a given percentage of objects and assign them to a "wrong" group (what=2).
nbNumber of clusters to merge (nb<0) or to split (nb>0) (only if what==1).

The J measure and the adjusted Rand index are then computed (except for what=0).

void InitSubject ( GSubject subject,
bool  selectdocs 
)
private

Initialize a given subject by creating some profiles and eventually selecting a set of documents.

Parameters
subjectSubject to select.
selectdocsMust documents be created ?
void SelectSubjects ( void  )
private

Choose the subjects that will be used.

void CreateAssessments ( void  )
private

Create a set of assessments for the profiles of the used subjects.

void ProfileAssess ( GProfile prof,
GSubject sub,
size_t  max,
size_t  maxDocsOK,
size_t  maxDocsKO,
size_t  maxDocsH 
)
private

Simulation of assessments for a profile on a given subject.

Parameters
profProfile that assesses the documents.
subSubject.
maxMaximal documents to assess.
maxDocsOKMaximal relevant documents to assess.
maxDocsKOMaximal fuzzy relevant documents to assess.
maxDocsHMaximal irrelevant documents to assess.
void CopyIdealGroups ( tObjType  objtype,
tObjType  grouptype,
cCalc *  calc 
)
private

Copy the ideal groups into the current clustering.

Parameters
objtypeType of the clustering (otProfile or otDoc).
grouptypeType of the groups (otCommunity or otTopic).
calcMethod used to compute the groups descriptions.
void BuildClass ( GSubject subject,
GClass parent 
)
private

Build a new class corresponding to a given subject.

Parameters
subjectCorresponding subject.
parentParent class.
void BuildIdealCommunities ( void  )

Build the ideal communities, each community corresponds to a subject having documents. The descriptions of the communities are computed using the current plug-in.

void BuildIdealTopics ( void  )

Build the ideal topics, each topic corresponds to a subject having documents. The descriptions of the topics are computing using the current plug-in.

void BuildIdealLeafTopics ( void  )

Build the ideal topics, each topic correspond to a "leaf" subject. The descriptions of the topics are formed using the labels of the subject and its parents (each label correspond to one information entity, i.e. "genetic algorithms" is considered as one 'term').

void BuildIdealClasses ( void  )

Build the ideal classes, each class correspond to a subject. The descriptions of the classes are formed using the labels of the subject and its parents (each label correspond to one information entity, i.e. "genetic algorithms" is considered as one 'term').

void BuildIdealDocsClasses ( void  )

Build the ideal classes, each class correspond to a subject. The descriptions of the classes are formed using the description of the documents (for a "leaf" subject) or the children (for a "non-leaf" subject).

Member Data Documentation

GSession* Session
private

The Session.

bool ManualSubjects
private

Are the subject manually selected or automatically.

double NbSubjects
private

Number of subjects to randomly select.

bool RelSubjects
private

Number of subjects is relative or absolute.

size_t MaxDepth
private

Maximal depth of the subjects to be treated.

size_t NbMinDocsSubject
private

Minimal number of documents in a subject to use it.

double NbDocsPerSubject
private

Number of documents to select for each used subject.

bool PercNbDocsPerSubject
private

Number of documents per subject is relative or absolute.

bool MultipleSubjects
private

A same document is selected multiple times.

size_t NbProfMax
private

Maximal number of profiles to create in each used subject.

size_t NbProfMin
private

Minimal number of profiles to create in each used subject.

double PercSocial
private

Percentage of profiles that are social, i.e. not alone in a community.

double NbOK
private

Number of relevant documents for which an assessment of a profile from the same subject is simulated.

bool RelOK
private

Number of relevant documents is relative or absolute.

double NbKO
private

Number of fuzzy relevant documents for which an assessment of a profile from the same subject is simulated.

bool RelKO
private

Number of fuzzy relevant documents is relative or absolute.

double NbH
private

Number of irrelevant documents for which an assessment of a profile from the same subject is simulated.

bool RelH
private

Is the number of irrelevant documents relative or absolute. If relative, it is computed as a percentage of the relevant documents created) or absolute.

size_t NbDocsAssess
private

Number of documents to be assessed during a feedback process.

double PercErr
private

Percentage of documents assessed with an error.

double SwitchPerc
private

Percentage of documents to switch from one subject to another at each step of the degradation.

bool CreateProfiles
private

Create profiles.

GTopic** TmpTopics
private

Temporary array of topics.

GDoc** TmpDocs
private

Temporary array of documents.

size_t NbTmpDocs
private

Number of temporary documents.

R::RContainer<GFdbk,false,false> NewDocs
private

New documents to assess.

R::RRandom* SwitchRandom
private

Random generator of switching documents.

size_t SwitchPos
private

Position of next document to switch.

R::RContainer<GProfile,false,false> NewProfiles
private

New profiles created during an action of the simulator.