RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDPickers::LeaderPicker Class Reference

Implements the Leader algorithm for picking a subset of item from a pool. More...

#include <LeaderPicker.h>

Inheritance diagram for RDPickers::LeaderPicker:
RDPickers::DistPicker

Public Member Functions

 LeaderPicker ()
 Default Constructor.
 
 LeaderPicker (double threshold)
 
 LeaderPicker (double threshold, int nthreads)
 
template<typename T >
RDKit::INT_VECT lazyPick (T &func, unsigned int poolSize, unsigned int pickSize) const
 Contains the implementation for a lazy Leader diversity picker.
 
template<typename T >
RDKit::INT_VECT lazyPick (T &func, unsigned int poolSize, unsigned int pickSize, double threshold) const
 
template<typename T >
RDKit::INT_VECT lazyPick (T &func, unsigned int poolSize, unsigned int pickSize, const RDKit::INT_VECT &firstPicks, double threshold) const
 
template<typename T >
RDKit::INT_VECT lazyPick (T &func, unsigned int poolSize, unsigned int pickSize, const RDKit::INT_VECT &firstPicks, double threshold, int nthreads) const
 
RDKit::INT_VECT pick (const double *distMat, unsigned int poolSize, unsigned int pickSize, const RDKit::INT_VECT &firstPicks, double threshold, int nthreads) const
 Contains the implementation for the Leader diversity picker.
 
RDKit::INT_VECT pick (const double *distMat, unsigned int poolSize, unsigned int pickSize) const override
 
- Public Member Functions inherited from RDPickers::DistPicker
 DistPicker ()
 Default constructor.
 
virtual ~DistPicker ()
 

Public Attributes

double default_threshold {0.0}
 
int default_nthreads {1}
 

Detailed Description

Implements the Leader algorithm for picking a subset of item from a pool.

This class inherits from the DistPicker and implements a specific picking strategy aimed at diversity. See documentation for "pick()" member function for the algorithm details

Definition at line 32 of file LeaderPicker.h.

Constructor & Destructor Documentation

◆ LeaderPicker() [1/3]

RDPickers::LeaderPicker::LeaderPicker ( )
inline

Default Constructor.

Definition at line 40 of file LeaderPicker.h.

◆ LeaderPicker() [2/3]

RDPickers::LeaderPicker::LeaderPicker ( double threshold)
inline

Definition at line 41 of file LeaderPicker.h.

◆ LeaderPicker() [3/3]

RDPickers::LeaderPicker::LeaderPicker ( double threshold,
int nthreads )
inline

Definition at line 43 of file LeaderPicker.h.

Member Function Documentation

◆ lazyPick() [1/4]

template<typename T >
RDKit::INT_VECT RDPickers::LeaderPicker::lazyPick ( T & func,
unsigned int poolSize,
unsigned int pickSize ) const

Contains the implementation for a lazy Leader diversity picker.

See the documentation for the pick() method for details about the algorithm

Parameters
func- a function (or functor) taking two unsigned ints as arguments and returning the distance (as a double) between those two elements.
poolSize- the size of the pool to pick the items from. It is assumed that the distance matrix above contains the right number of elements; i.e. poolSize*(poolSize-1)
pickSize- the number items to pick from pool (<= poolSize)
firstPicks- (optional)the first items in the pick list
seed- (optional) seed for the random number generator. If this is <0 the generator will be seeded with a random number.

Definition at line 444 of file LeaderPicker.h.

References default_nthreads, default_threshold, and lazyPick().

Referenced by lazyPick(), lazyPick(), lazyPick(), and pick().

◆ lazyPick() [2/4]

template<typename T >
RDKit::INT_VECT RDPickers::LeaderPicker::lazyPick ( T & func,
unsigned int poolSize,
unsigned int pickSize,
const RDKit::INT_VECT & firstPicks,
double threshold ) const

Definition at line 460 of file LeaderPicker.h.

References default_nthreads, and lazyPick().

◆ lazyPick() [3/4]

template<typename T >
RDKit::INT_VECT RDPickers::LeaderPicker::lazyPick ( T & func,
unsigned int poolSize,
unsigned int pickSize,
const RDKit::INT_VECT & firstPicks,
double threshold,
int nthreads ) const

Definition at line 396 of file LeaderPicker.h.

References RDKit::getNumThreadsToUse(), and pick().

◆ lazyPick() [4/4]

template<typename T >
RDKit::INT_VECT RDPickers::LeaderPicker::lazyPick ( T & func,
unsigned int poolSize,
unsigned int pickSize,
double threshold ) const

Definition at line 452 of file LeaderPicker.h.

References default_nthreads, and lazyPick().

◆ pick() [1/2]

RDKit::INT_VECT RDPickers::LeaderPicker::pick ( const double * distMat,
unsigned int poolSize,
unsigned int pickSize ) const
inlineoverridevirtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Implements RDPickers::DistPicker.

Definition at line 114 of file LeaderPicker.h.

References default_nthreads, default_threshold, and pick().

◆ pick() [2/2]

RDKit::INT_VECT RDPickers::LeaderPicker::pick ( const double * distMat,
unsigned int poolSize,
unsigned int pickSize,
const RDKit::INT_VECT & firstPicks,
double threshold,
int nthreads ) const
inline

Contains the implementation for the Leader diversity picker.

Parameters
distMat- distance matrix - a vector of double. It is assumed that only the lower triangle element of the matrix are supplied in a 1D array
poolSize- the size of the pool to pick the items from. It is assumed that the distance matrix above contains the right number of elements; i.e. poolSize*(poolSize-1)
pickSize- maximum number items to pick from pool (<= poolSize)
firstPicks- indices of the items used to seed the pick set.

Definition at line 98 of file LeaderPicker.h.

References CHECK_INVARIANT, and lazyPick().

Referenced by lazyPick(), and pick().

Member Data Documentation

◆ default_nthreads

int RDPickers::LeaderPicker::default_nthreads {1}

Definition at line 35 of file LeaderPicker.h.

Referenced by lazyPick(), lazyPick(), lazyPick(), and pick().

◆ default_threshold

double RDPickers::LeaderPicker::default_threshold {0.0}

Definition at line 34 of file LeaderPicker.h.

Referenced by lazyPick(), and pick().


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