Feature Selection ToolboxFST3 Library / Documentation

FST::Search_Monte_Carlo_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads > Class Template Reference

Implements threaded version of randomized search that repeatedly samples random subsets to eventually yield the one with highest criterion value. More...

#include <search_monte_carlo_threaded.hpp>

Inheritance diagram for FST::Search_Monte_Carlo_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads >:
Collaboration diagram for FST::Search_Monte_Carlo_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads >:

List of all members.

Classes

struct  ThreadLocal
 thread-local storage of current subset candidate, criterion clone, and tracker clone More...

Public Types

typedef Search< RETURNTYPE,
DIMTYPE, SUBSET, CRITERION > 
parent
typedef boost::shared_ptr
< CRITERION > 
PCriterion
typedef boost::shared_ptr< SUBSET > PSubset

Public Member Functions

 Search_Monte_Carlo_Threaded (const unsigned long trials_limit=1000, const unsigned long time_limit=0, const unsigned int time_limit_check_freq=10)
virtual bool search (const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os=std::cout)
 returns found subset of target_d features (optimizes cardinality if target_d==0) + criterion value
void set_stopping_condition (const unsigned long trials_limit=1000, const unsigned long time_limit=0, const unsigned int time_limit_check_freq=100)
 set maximum number of random trials or maximum time in seconds or both
void set_cardinality_randomization (const DIMTYPE d_from, const DIMTYPE d_to)
 generate subset size first from [d_from,d_to], then randomly choose exactly that number of features
void set_cardinality_randomization (const float d_prob)
 for each feature roll the dice and select it with probability d_prob
void reset_cardinality_randomization ()
 equivalent to set_cardinality_randomization(1,no_of_all_features)
virtual std::ostream & print (std::ostream &os) const

Protected Member Functions

void evaluator_thread (unsigned int idx)
unsigned long next_trial ()

Protected Attributes

PCriterion template_crit
ThreadLocal tlocal [max_threads]
boost::mutex mutex_trials_out
boost::mutex mutex_random_sub
boost::shared_ptr< StopWatchswatch
unsigned long _trials
 to be updated concurrently from threads
volatile DIMTYPE _target_d
unsigned long _time_limit
 max time allowed to be spent in seconds
unsigned long _trials_limit
 max no of candidates evaluated
unsigned int _time_limit_check_freq
 number of trials before next time check
DIMTYPE _d_from
DIMTYPE _d_to
 generate random subsets of size within these limits
float _d_prob
 active d_prob must be from (0,1]; generates random subset of random size where the mean size over a series of calls is d_prob*no_of_all_features

Detailed Description

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION, unsigned int max_threads = 2>
class FST::Search_Monte_Carlo_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads >

Implements threaded version of randomized search that repeatedly samples random subsets to eventually yield the one with highest criterion value.

Concurrently evaluates each subset candidate using clones of the supplied criterion and returns the one subset that yielded highest criterion value

Note:
Requires user-set terminating condition, either in form of the number of random trials accomplished or in form of maximum time spent or both.
offers two ways of random subset generation: a) set_cardinality_randomization(const DIMTYPE d_from, const DIMTYPE d_to) invokes the first option, i.e., when generating a random subset, the subset size is first chosen randomly from [d_from,d_to], then features are randomly selected until the required number is reached b) set_cardinality_randomization(const float d_prob) invokes the second option, where each feature is randomly included/excluded with probability d_prob. The expected subset size is thus d_prob*no_of_all_features, but can be actually anything from [0,no_of_all_features].
Examples:

demo24t.cpp, and demo35t.cpp.


Member Function Documentation

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION, unsigned int max_threads = 2>
unsigned long FST::Search_Monte_Carlo_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads >::next_trial (  )  [inline, protected]

< (synchronized) _trials increase + test whether _trials_limit has been reached

References FST::Search_Monte_Carlo_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads >::_trials.


Member Data Documentation

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION, unsigned int max_threads = 2>
PCriterion FST::Search_Monte_Carlo_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads >::template_crit [protected]

The documentation for this class was generated from the following file:

Generated on Thu Mar 31 11:38:56 2011 for FST3Library by  doxygen 1.6.1