#include <sampler.h>
Inheritance diagram for WebSampler:
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 | |
WebLinkGraph * | graph |
uint32 | number_of_nodes |
gsl_rng * | r |
double | eps |
int32 * | allocation_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 |
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.
|
among other things, initializes the random number generator.
Definition at line 29 of file sampler.cc. |
|
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(). |
|
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(). |
|
clears scratch area for all WebNode objects in the graph.
Definition at line 61 of file sampler.cc. References graph. |
|
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(). |
|
Number of samples produced by SimulateForward().
Definition at line 64 of file sampler.h. References last_run_size, and uint32. Referenced by Talker::ProcessCommand(). |
|
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(). |
|
returns an identifying string in supplied buffer.
Implemented in PageRankSampler, DateBiasedPageRankSampler, and TruncatedKleinbergSampler. Referenced by PrintCounts(), PrintTagCounts(), and Talker::ProcessCommand(). |
|
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(). |
|
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(). |
|
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(). |
|
Definition at line 60 of file sampler.h. References r. Referenced by Talker::ProcessCommand(). |
|
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(). |
|
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(). |
|
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(). |
|
Definition at line 81 of file sampler.h. Referenced by TaggedSimulateForward(). |
|
Definition at line 77 of file sampler.h. Referenced by ClearAllocForward(), IncrementAllocForward(), SimulateAllocForward(), SimulateForward(), and TaggedSimulateForward(). |
|
|
Definition at line 82 of file sampler.h. Referenced by TaggedSimulateForward(). |
|
Definition at line 71 of file sampler.h. Referenced by ClearCounts(), ClearScratch(), PrintCounts(), PrintTagCounts(), TruncatedKleinbergSampler::SetParameters(), DateBiasedPageRankSampler::SetParameters(), PageRankSampler::SetParameters(), SimulateAllocForward(), SimulateForward(), and TaggedSimulateForward(). |
|
Definition at line 84 of file sampler.h. Referenced by ClearCounts(), LastRunSize(), PrintCounts(), and SimulateForward(). |
|
Definition at line 85 of file sampler.h. Referenced by ClearCounts(), LastTaggedRunSize(), PrintTagCounts(), and TaggedSimulateForward(). |
|
Definition at line 72 of file sampler.h. Referenced by ClearAllocForward(), IncrementAllocForward(), SimulateForward(), and TaggedSimulateForward(). |
|
Definition at line 80 of file sampler.h. Referenced by TaggedSimulateForward(). |
|
Definition at line 74 of file sampler.h. Referenced by TruncatedKleinbergSampler::QEvolveFrom(), DateBiasedPageRankSampler::QEvolveFrom(), PageRankSampler::QEvolveFrom(), SetRandomSeed(), SimulateAllocForward(), SimulateForward(), and TaggedSimulateForward(). |
|
Definition at line 78 of file sampler.h. Referenced by DateBiasedPageRankSampler::QEvolveFrom(), PageRankSampler::QEvolveFrom(), and SimulateAllocForward(). |