Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

WebSampler Class Reference

Abstract base class for all samplers. More...

#include <sampler.h>

Inheritance diagram for WebSampler:

Inheritance graph
[legend]
Collaboration diagram for WebSampler:

Collaboration graph
[legend]
List of all members.

Public Methods

 WebSampler (WebLinkGraph *g) throw (exception)
 among other things, initializes the random number generator. More...

void SimulateForward (long n)
 samples n random variables from the page ranking distribution. More...

void ClearAllocForward ()
 Clears the list of starting places. More...

void SimulateAllocForward ()
void IncrementAllocForward (uint32 k, int32 num)
 Adds num to the starting allocation for id. More...

void TaggedSimulateForward (long n, const uint32 *fromsetsize)
 samples from part of the page ranking distribution by rejection sampling. More...

virtual WebNodePtr QEvolveFrom (WebNodePtr x)
 performs a random transition, should be overridden by derived classes. More...

virtual char * Name (char *buf)=0
 returns an identifying string in supplied buffer. More...

void ClearCounts ()
 Clears occupation counts and run sizes. More...

void ClearScratch ()
 clears scratch area for all WebNode objects in the graph. More...

void SetRandomSeed (unsigned long int s)
void PrintCounts (ostream &o)
 iterates through the WebNodeList and prints the occupation counts for each WebNode. More...

void PrintTagCounts (ostream &o)
 same as WebSampler::PrintCounts(), but only prints tagged documents. More...

uint32 LastRunSize ()
 Number of samples produced by SimulateForward(). More...

uint32 LastTaggedRunSize ()
 Number of candidates accepted by TaggedSimulateForward(). More...


Protected Attributes

WebLinkGraphgraph
uint32 number_of_nodes
gsl_rng * r
double eps
int32allocation_list
LeafNodePtr xleaf
double probabilities [TAG_NUMBER_OF_BITS]
long allocated [TAG_NUMBER_OF_BITS]
uint32 fromsetsize_remaining [TAG_NUMBER_OF_BITS]
uint32 last_run_size
uint32 last_tagged_run_size

Detailed Description

Abstract base class for all samplers.

A sampler populates the web link graph with occupation counts which are interpreted as page ranking schemes. Supported samplers must have transition probabilities of the form P(x,y) = eps * mu(y) + (1-eps) * Q(x,y), where the derived class overrides the Q(x,y) definition which is contained in the QEvolveFrom() virtual function.

Definition at line 40 of file sampler.h.


Constructor & Destructor Documentation

WebSampler::WebSampler WebLinkGraph   g throw (exception)
 

among other things, initializes the random number generator.

Definition at line 29 of file sampler.cc.

References int32, and NULL.


Member Function Documentation

void WebSampler::ClearAllocForward  
 

Clears the list of starting places.

Definition at line 111 of file sampler.cc.

References allocation_list, int32, and number_of_nodes.

Referenced by Talker::ProcessCommand(), and SimulateForward().

void WebSampler::ClearCounts  
 

Clears occupation counts and run sizes.

Definition at line 51 of file sampler.cc.

References graph, last_run_size, and last_tagged_run_size.

Referenced by Talker::ProcessCommand(), TruncatedKleinbergSampler::SetParameters(), DateBiasedPageRankSampler::SetParameters(), and PageRankSampler::SetParameters().

void WebSampler::ClearScratch  
 

clears scratch area for all WebNode objects in the graph.

Definition at line 61 of file sampler.cc.

References graph.

void WebSampler::IncrementAllocForward uint32    k,
int32    num
 

Adds num to the starting allocation for id.

Definition at line 117 of file sampler.cc.

References allocation_list, int32, number_of_nodes, and uint32.

Referenced by Talker::ProcessCommand().

uint32 WebSampler::LastRunSize   [inline]
 

Number of samples produced by SimulateForward().

Definition at line 64 of file sampler.h.

References last_run_size, and uint32.

Referenced by Talker::ProcessCommand().

uint32 WebSampler::LastTaggedRunSize   [inline]
 

Number of candidates accepted by TaggedSimulateForward().

Definition at line 67 of file sampler.h.

References last_tagged_run_size, and uint32.

Referenced by Talker::ProcessCommand().

virtual char* WebSampler::Name char *    buf [pure virtual]
 

returns an identifying string in supplied buffer.

Implemented in PageRankSampler, DateBiasedPageRankSampler, and TruncatedKleinbergSampler.

Referenced by PrintCounts(), PrintTagCounts(), and Talker::ProcessCommand().

void WebSampler::PrintCounts ostream &    o
 

iterates through the WebNodeList and prints the occupation counts for each WebNode.

Also calculates a 95% confidence interval for each count. That's why it's a WebSampler member function, and not a WebLinkGraph member function.

Definition at line 76 of file sampler.cc.

References eps, graph, last_run_size, and Name().

Referenced by Talker::ProcessCommand().

void WebSampler::PrintTagCounts ostream &    o
 

same as WebSampler::PrintCounts(), but only prints tagged documents.

Definition at line 93 of file sampler.cc.

References eps, graph, last_tagged_run_size, and Name().

Referenced by Talker::ProcessCommand().

virtual WebNodePtr WebSampler::QEvolveFrom WebNodePtr    x [inline, virtual]
 

performs a random transition, should be overridden by derived classes.

Reimplemented in PageRankSampler, DateBiasedPageRankSampler, and TruncatedKleinbergSampler.

Definition at line 53 of file sampler.h.

Referenced by SimulateAllocForward(), and TaggedSimulateForward().

void WebSampler::SetRandomSeed unsigned long int    s [inline]
 

Definition at line 60 of file sampler.h.

References r.

Referenced by Talker::ProcessCommand().

void WebSampler::SimulateAllocForward  
 

Definition at line 122 of file sampler.cc.

References allocation_list, eps, graph, LeafNode::IncrementOccupationCount(), WebNode::IncrementOccupationCount(), WebNode::NumberOfValidToLinks(), QEvolveFrom(), r, uint32, and xleaf.

Referenced by Talker::ProcessCommand(), and SimulateForward().

void WebSampler::SimulateForward long    n
 

samples n random variables from the page ranking distribution.

Each of the sampled variables is generated by a uniform on the web link graph, followed by a geometric number (mean eps) of transitions using the virtual function QEvolveFrom(). The final WebNodePtr value is recorded in the WebNode's occupation_number data member.

Definition at line 154 of file sampler.cc.

References allocation_list, ClearAllocForward(), graph, last_run_size, number_of_nodes, r, and SimulateAllocForward().

Referenced by Talker::ProcessCommand().

void WebSampler::TaggedSimulateForward long    n,
const uint32   fromsetsize
 

samples from part of the page ranking distribution by rejection sampling.

A total of n candidates are generated, not all of which are eventually accepted. Only candidates which are accepted show up in the relevant WebNode's occupation_count. Before calling this, make sure to call Grapher::BuildFromSets(), whithout which this algorithm will bomb.

Definition at line 183 of file sampler.cc.

References allocated, allocation_list, eps, fromsetsize_remaining, graph, WebNode::IncrementOccupationCount(), int32, last_tagged_run_size, number_of_nodes, WebNode::NumberOfValidToLinks(), probabilities, QEvolveFrom(), r, TAG_NUMBER_OF_BITS, WebNode::Tagged(), and uint32.

Referenced by Talker::ProcessCommand().


Member Data Documentation

long WebSampler::allocated[TAG_NUMBER_OF_BITS] [protected]
 

Definition at line 81 of file sampler.h.

Referenced by TaggedSimulateForward().

int32* WebSampler::allocation_list [protected]
 

Definition at line 77 of file sampler.h.

Referenced by ClearAllocForward(), IncrementAllocForward(), SimulateAllocForward(), SimulateForward(), and TaggedSimulateForward().

double WebSampler::eps [protected]
 

Definition at line 75 of file sampler.h.

Referenced by DateBiasedPageRankSampler::DateBiasedPageRankSampler(), TruncatedKleinbergSampler::Name(), DateBiasedPageRankSampler::Name(), PageRankSampler::Name(), PageRankSampler::PageRankSampler(), PrintCounts(), PrintTagCounts(), TruncatedKleinbergSampler::SetParameters(), DateBiasedPageRankSampler::SetParameters(), PageRankSampler::SetParameters(), SimulateAllocForward(), TaggedSimulateForward(), and TruncatedKleinbergSampler::TruncatedKleinbergSampler().

uint32 WebSampler::fromsetsize_remaining[TAG_NUMBER_OF_BITS] [protected]
 

Definition at line 82 of file sampler.h.

Referenced by TaggedSimulateForward().

WebLinkGraph* WebSampler::graph [protected]
 

Definition at line 71 of file sampler.h.

Referenced by ClearCounts(), ClearScratch(), PrintCounts(), PrintTagCounts(), TruncatedKleinbergSampler::SetParameters(), DateBiasedPageRankSampler::SetParameters(), PageRankSampler::SetParameters(), SimulateAllocForward(), SimulateForward(), and TaggedSimulateForward().

uint32 WebSampler::last_run_size [protected]
 

Definition at line 84 of file sampler.h.

Referenced by ClearCounts(), LastRunSize(), PrintCounts(), and SimulateForward().

uint32 WebSampler::last_tagged_run_size [protected]
 

Definition at line 85 of file sampler.h.

Referenced by ClearCounts(), LastTaggedRunSize(), PrintTagCounts(), and TaggedSimulateForward().

uint32 WebSampler::number_of_nodes [protected]
 

Definition at line 72 of file sampler.h.

Referenced by ClearAllocForward(), IncrementAllocForward(), SimulateForward(), and TaggedSimulateForward().

double WebSampler::probabilities[TAG_NUMBER_OF_BITS] [protected]
 

Definition at line 80 of file sampler.h.

Referenced by TaggedSimulateForward().

gsl_rng* WebSampler::r [protected]
 

Definition at line 74 of file sampler.h.

Referenced by TruncatedKleinbergSampler::QEvolveFrom(), DateBiasedPageRankSampler::QEvolveFrom(), PageRankSampler::QEvolveFrom(), SetRandomSeed(), SimulateAllocForward(), SimulateForward(), and TaggedSimulateForward().

LeafNodePtr WebSampler::xleaf [protected]
 

Definition at line 78 of file sampler.h.

Referenced by DateBiasedPageRankSampler::QEvolveFrom(), PageRankSampler::QEvolveFrom(), and SimulateAllocForward().


Generated on Wed May 29 11:37:30 2002 for MarkovPR by doxygen1.2.15