openModeller  Version 1.4.0
SamplerImpl Class Reference

#include <Sampler.hh>

Inheritance diagram for SamplerImpl:
Collaboration diagram for SamplerImpl:

List of all members.

Public Member Functions

 SamplerImpl ()
 SamplerImpl (const EnvironmentPtr &env, const OccurrencesPtr &presences, const OccurrencesPtr &absence, bool isNormalized=false)
 ~SamplerImpl ()
EnvironmentPtr getEnvironment ()
ConstEnvironmentPtr getEnvironment () const
OccurrencesPtr getPresences ()
ConstOccurrencesPtr getPresences () const
OccurrencesPtr getAbsences ()
ConstOccurrencesPtr getAbsences () const
void getMinMax (Sample *min, Sample *max) const
void normalize (Normalizer *normalizerPtr)
bool isNormalized () const
void resetNormalization ()
int numIndependent () const
int numDependent () const
int numPresence () const
int numAbsence () const
ConstOccurrencePtr getOneSample () const
ConstOccurrencePtr getPresence () const
ConstOccurrencePtr getPresence (int index) const
ConstOccurrencePtr getAbsence () const
ConstOccurrencePtr getAbsence (int index) const
OccurrencePtr generateRandomSample (Scalar abundance=1.0) const
OccurrencePtr getPseudoAbsence () const
OccurrencePtr getPseudoPresence () const
OccurrencePtr getPseudoAbsence (const Model &model, const Scalar threshold) const
OccurrencePtr getPseudoPresence (const Model &model, const Scalar threshold) const
OccurrencePtr getPseudoAbsenceOutsideInterval (const Sample *minimum, const Sample *maximum) const
OccurrencePtr getPseudoPresenceInsideInterval (const Sample *minimum, const Sample *maximum) const
OccurrencesPtr getPseudoAbsences (const int &numPoints, const Model &model, const Scalar threshold=0.5, const bool geoUnique=false, const bool envUnique=false, const int idSequenceStart=1) const
OccurrencesPtr getPseudoPresences (const int &numPoints, const Model &model, const Scalar threshold=0.5, const bool geoUnique=false, const bool envUnique=false, const int idSequenceStart=1) const
OccurrencesPtr getPseudoAbsences (const int &numPoints, const Sample *minimum, const Sample *maximum, const bool geoUnique=false, const bool envUnique=false, const int idSequenceStart=1) const
OccurrencesPtr getPseudoPresences (const int &numPoints, const Sample *minimum, const Sample *maximum, const bool geoUnique=false, const bool envUnique=false, const int idSequenceStart=1) const
int isCategorical (int i)
void environmentallyUnique ()
bool isEnvironmentallyUnique (const OccurrencesPtr &occurrences, const OccurrencePtr &point) const
void spatiallyUnique ()
bool isSpatiallyUnique (const OccurrencesPtr &occurrences, const OccurrencePtr &point) const
ConfigurationPtr getConfiguration () const
void setConfiguration (const ConstConfigurationPtr &)
void dump () const

Private Member Functions

ConstOccurrencePtr getRandomOccurrence (const OccurrencesPtr &occur) const
void setEnvironmentInOccurrences ()
void environmentallyUnique (OccurrencesPtr &occurrencesPtr, const char *type)
void spatiallyUnique (OccurrencesPtr &occurrencesPtr, const char *type)

Private Attributes

OccurrencesPtr _presence
OccurrencesPtr _absence
EnvironmentPtr _env
bool _normalized

Friends

class ReferenceCountedPointer< SamplerImpl >
class ReferenceCountedPointer< const SamplerImpl >

Detailed Description

Base class to create samplers of environmental variables and occurrence data. Each derived class can implement different behaviors, such as proportional sampling according to the distribution of occurrence data, disproportional sampling regarding presence and absence data, etc.

Definition at line 81 of file Sampler.hh.


Constructor & Destructor Documentation

Definition at line 69 of file Sampler.cpp.

References Log::debug(), and Log::instance().

Here is the call graph for this function:

SamplerImpl::SamplerImpl ( const EnvironmentPtr env,
const OccurrencesPtr presences,
const OccurrencesPtr absence,
bool  isNormalized = false 
)

Definition at line 81 of file Sampler.cpp.

References Log::debug(), Log::instance(), and setEnvironmentInOccurrences().

Here is the call graph for this function:

Definition at line 100 of file Sampler.cpp.

References Log::debug(), and Log::instance().

Here is the call graph for this function:


Member Function Documentation

void SamplerImpl::dump ( ) const

Definition at line 1156 of file Sampler.cpp.

References _absence, and _presence.

Remove sample duplicates accross the environment (presences and absences are treated separately). After erasing a point, the remaining one increases the abundance by one.

Definition at line 927 of file Sampler.cpp.

References _absence, _presence, Log::info(), and Log::instance().

Here is the call graph for this function:

void SamplerImpl::environmentallyUnique ( OccurrencesPtr occurrencesPtr,
const char *  type 
) [private]

Definition at line 942 of file Sampler.cpp.

References _env, Sample::equals(), Log::info(), and Log::instance().

Here is the call graph for this function:

Generate a random sample

Definition at line 387 of file Sampler.cpp.

References _env, Log::error(), Log::instance(), and numDependent().

Referenced by getPseudoAbsence(), and getPseudoPresence().

Here is the call graph for this function:

Get a random absence point

Definition at line 162 of file Sampler.hh.

Referenced by getOneSample().

ConstOccurrencePtr SamplerImpl::getAbsence ( int  index) const [inline]

Get a specific absence point by index

Definition at line 168 of file Sampler.hh.

Definition at line 101 of file Sampler.hh.

Definition at line 102 of file Sampler.hh.

Implements Configurable.

Definition at line 127 of file Sampler.cpp.

References _absence, _env, and _presence.

Definition at line 95 of file Sampler.hh.

Referenced by ScaleNormalizer::computeNormalization().

Definition at line 96 of file Sampler.hh.

void SamplerImpl::getMinMax ( Sample min,
Sample max 
) const [virtual]

Indicate that all non categorical variable layers must be normalized according to the interval [min, max]. Returns through offsets, scales the normalization parameters.

Implements Normalizable.

Definition at line 209 of file Sampler.cpp.

References _absence, and _presence.

Referenced by ScaleNormalizer::computeNormalization().

Samples one presence, absence or pseudo-absence point in a uniform way. There is 50% of chance to get a presence point and 50% of get an absence or pseudo-absence point. If there are real absence points (user input) then only absences are sampled. If there are not real absence, samples pseudo-absence points.

Returns:
Zero if got an absence or pseudo-absence point and not zero if got a presence point.

Definition at line 346 of file Sampler.cpp.

References _absence, _presence, Log::error(), getAbsence(), getPresence(), getPseudoAbsence(), and Log::instance().

Here is the call graph for this function:

Get a random presence point

Definition at line 150 of file Sampler.hh.

Referenced by getOneSample().

ConstOccurrencePtr SamplerImpl::getPresence ( int  index) const [inline]

Get a specific presence point by index

Definition at line 156 of file Sampler.hh.

Definition at line 98 of file Sampler.hh.

Definition at line 99 of file Sampler.hh.

Generate a pseudo absence sample

Definition at line 412 of file Sampler.cpp.

References generateRandomSample().

Referenced by getOneSample(), getPseudoAbsence(), getPseudoAbsenceOutsideInterval(), and getPseudoAbsences().

Here is the call graph for this function:

OccurrencePtr SamplerImpl::getPseudoAbsence ( const Model model,
const Scalar  threshold 
) const

Generate a pseudo absence sample outside the given model

Definition at line 428 of file Sampler.cpp.

References Log::error(), getPseudoAbsence(), and Log::instance().

Here is the call graph for this function:

OccurrencePtr SamplerImpl::getPseudoAbsenceOutsideInterval ( const Sample minimum,
const Sample maximum 
) const

Generate a pseudo absence sample outside the minimum and maximum

Definition at line 504 of file Sampler.cpp.

References Log::error(), getPseudoAbsence(), Log::instance(), and Sample::size().

Referenced by getPseudoAbsences().

Here is the call graph for this function:

OccurrencesPtr SamplerImpl::getPseudoAbsences ( const int &  numPoints,
const Model model,
const Scalar  threshold = 0.5,
const bool  geoUnique = false,
const bool  envUnique = false,
const int  idSequenceStart = 1 
) const

Generate pseudo absence samples outside the given model according to the specified threshold

Definition at line 598 of file Sampler.cpp.

References _absence, _presence, getPseudoAbsence(), isEnvironmentallyUnique(), and isSpatiallyUnique().

Here is the call graph for this function:

OccurrencesPtr SamplerImpl::getPseudoAbsences ( const int &  numPoints,
const Sample minimum,
const Sample maximum,
const bool  geoUnique = false,
const bool  envUnique = false,
const int  idSequenceStart = 1 
) const

Generate pseudo absence samples outside the minimum and maximum

Definition at line 760 of file Sampler.cpp.

References _absence, _presence, getPseudoAbsenceOutsideInterval(), isEnvironmentallyUnique(), and isSpatiallyUnique().

Here is the call graph for this function:

Generate a pseudo presence sample

Definition at line 420 of file Sampler.cpp.

References generateRandomSample().

Referenced by getPseudoPresence(), getPseudoPresenceInsideInterval(), and getPseudoPresences().

Here is the call graph for this function:

OccurrencePtr SamplerImpl::getPseudoPresence ( const Model model,
const Scalar  threshold 
) const

Generate a pseudo presence sample inside the given model

Definition at line 466 of file Sampler.cpp.

References Log::error(), getPseudoPresence(), and Log::instance().

Here is the call graph for this function:

OccurrencePtr SamplerImpl::getPseudoPresenceInsideInterval ( const Sample minimum,
const Sample maximum 
) const

Generate a pseudo presence sample inside the minimum and maximum

Definition at line 551 of file Sampler.cpp.

References Log::error(), getPseudoPresence(), Log::instance(), and Sample::size().

Referenced by getPseudoPresences().

Here is the call graph for this function:

OccurrencesPtr SamplerImpl::getPseudoPresences ( const int &  numPoints,
const Model model,
const Scalar  threshold = 0.5,
const bool  geoUnique = false,
const bool  envUnique = false,
const int  idSequenceStart = 1 
) const

Generate pseudo presence samples inside the given model according to the specified threshold

Definition at line 679 of file Sampler.cpp.

References _absence, _presence, getPseudoPresence(), isEnvironmentallyUnique(), and isSpatiallyUnique().

Here is the call graph for this function:

OccurrencesPtr SamplerImpl::getPseudoPresences ( const int &  numPoints,
const Sample minimum,
const Sample maximum,
const bool  geoUnique = false,
const bool  envUnique = false,
const int  idSequenceStart = 1 
) const

Generate pseudo presence samples inside the minimum and maximum

Definition at line 834 of file Sampler.cpp.

References _absence, _presence, getPseudoPresenceInsideInterval(), isEnvironmentallyUnique(), and isSpatiallyUnique().

Here is the call graph for this function:

Definition at line 1141 of file Sampler.cpp.

Returns 1 if i-th variable is categorical, otherwise returns 0.

Definition at line 908 of file Sampler.cpp.

References _env.

bool SamplerImpl::isEnvironmentallyUnique ( const OccurrencesPtr occurrences,
const OccurrencePtr point 
) const

If OccurrencePtr point duplicates accross the environment, return false. Otherwise return true. Missae(set/2008)

Definition at line 1065 of file Sampler.cpp.

References _env, and Sample::equals().

Referenced by getPseudoAbsences(), and getPseudoPresences().

Here is the call graph for this function:

bool SamplerImpl::isNormalized ( ) const [inline]

Returns true if "normalized()" was called, false otherwise.

Definition at line 115 of file Sampler.hh.

bool SamplerImpl::isSpatiallyUnique ( const OccurrencesPtr occurrences,
const OccurrencePtr point 
) const

If OccurrencePtr point duplicates accross geographic space, return false. Otherwise return true. Uniqueness is considered for row/col pairs defined in the input mask. If mask is undefined, use first layer as a mask. Missae(set/2008)

Definition at line 1097 of file Sampler.cpp.

References _env, and Map::getRowColumn().

Referenced by getPseudoAbsences(), and getPseudoPresences().

Here is the call graph for this function:

void SamplerImpl::normalize ( Normalizer normalizerPtr) [virtual]

Normalize sampler data

Implements Normalizable.

Definition at line 233 of file Sampler.cpp.

References _absence, _env, _normalized, _presence, Log::error(), Log::instance(), and setEnvironmentInOccurrences().

Here is the call graph for this function:

int SamplerImpl::numAbsence ( ) const

Number of absences (localities with no occurrence).

Definition at line 337 of file Sampler.cpp.

References _absence.

Number of dependent variables (attributes of the occurred thing). These are the variables to be modelled.

Definition at line 319 of file Sampler.cpp.

References _absence, and _presence.

Referenced by generateRandomSample().

Number of independent variables (environmental variables).

Definition at line 296 of file Sampler.cpp.

References _absence, _env, and _presence.

Referenced by ScaleNormalizer::computeNormalization().

int SamplerImpl::numPresence ( ) const

Number of presences (occurrence points).

Definition at line 328 of file Sampler.cpp.

References _presence.

Reset normalization

Definition at line 273 of file Sampler.cpp.

References _absence, _env, _normalized, and _presence.

void SamplerImpl::setConfiguration ( const ConstConfigurationPtr config) [virtual]

Implements Configurable.

Definition at line 156 of file Sampler.cpp.

References _absence, _env, _presence, createEnvironment(), Log::debug(), Log::error(), Log::instance(), and setEnvironmentInOccurrences().

Here is the call graph for this function:

Definition at line 108 of file Sampler.cpp.

References _absence, _env, and _presence.

Referenced by normalize(), SamplerImpl(), and setConfiguration().

Remove sample duplicates accross geographic space (presences and absences are treated separately). After erasing a point, the remaining one increases the abundance by one. Uniqueness is considered for row/col pairs defined in the input mask. If mask is undefined, use first layer as a mask.

Definition at line 990 of file Sampler.cpp.

References _absence, _presence, Log::info(), and Log::instance().

Here is the call graph for this function:

void SamplerImpl::spatiallyUnique ( OccurrencesPtr occurrencesPtr,
const char *  type 
) [private]

Definition at line 1005 of file Sampler.cpp.

References _env, Map::getRowColumn(), Log::info(), and Log::instance().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class ReferenceCountedPointer< const SamplerImpl > [friend]

Definition at line 84 of file Sampler.hh.

friend class ReferenceCountedPointer< SamplerImpl > [friend]

Definition at line 83 of file Sampler.hh.


Member Data Documentation

bool SamplerImpl::_normalized [private]

Definition at line 279 of file Sampler.hh.

Referenced by normalize(), and resetNormalization().


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