in lib/model/ModelTypes.cc [954:1026]
double adjustProbability(EFeature feature, core_t::TTime elapsedTime, double probability) {
// For the time of week calculation we assume that the
// probability of less likely samples depends on whether
// the value belongs to a cluster that hasn't yet been
// identified. Specifically,
// P(less likely) = P(less likely | new cluster) * P(new cluster)
// + P(less likely | existing cluster) * (1 - P(new cluster))
//
// We estimate P(less likely | new cluster) = 1, i.e. we
// assume that the density at the point will be high if
// it belongs to a new cluster and assume that P(new cluster)
// decays exponentially over time.
double pNewCluster = 0.0;
switch (feature) {
case E_IndividualCountByBucketAndPerson:
case E_IndividualNonZeroCountByBucketAndPerson:
case E_IndividualTotalBucketCountByPerson:
case E_IndividualIndicatorOfBucketPerson:
case E_IndividualLowCountsByBucketAndPerson:
case E_IndividualHighCountsByBucketAndPerson:
case E_IndividualArrivalTimesByPerson:
case E_IndividualLongArrivalTimesByPerson:
case E_IndividualShortArrivalTimesByPerson:
case E_IndividualLowNonZeroCountByBucketAndPerson:
case E_IndividualHighNonZeroCountByBucketAndPerson:
case E_IndividualUniqueCountByBucketAndPerson:
case E_IndividualLowUniqueCountByBucketAndPerson:
case E_IndividualHighUniqueCountByBucketAndPerson:
case E_IndividualInfoContentByBucketAndPerson:
case E_IndividualLowInfoContentByBucketAndPerson:
case E_IndividualHighInfoContentByBucketAndPerson:
break;
case E_IndividualTimeOfDayByBucketAndPerson:
pNewCluster = std::exp(-pow4(static_cast<double>(elapsedTime) /
static_cast<double>(core::constants::DAY)));
break;
case E_IndividualTimeOfWeekByBucketAndPerson:
pNewCluster = std::exp(-pow4(static_cast<double>(elapsedTime) /
static_cast<double>(core::constants::WEEK)));
break;
CASE_INDIVIDUAL_METRIC:
break;
case E_PopulationAttributeTotalCountByPerson:
case E_PopulationCountByBucketPersonAndAttribute:
case E_PopulationIndicatorOfBucketPersonAndAttribute:
case E_PopulationUniquePersonCountByAttribute:
case E_PopulationUniqueCountByBucketPersonAndAttribute:
case E_PopulationLowUniqueCountByBucketPersonAndAttribute:
case E_PopulationHighUniqueCountByBucketPersonAndAttribute:
case E_PopulationLowCountsByBucketPersonAndAttribute:
case E_PopulationHighCountsByBucketPersonAndAttribute:
case E_PopulationInfoContentByBucketPersonAndAttribute:
case E_PopulationLowInfoContentByBucketPersonAndAttribute:
case E_PopulationHighInfoContentByBucketPersonAndAttribute:
break;
case E_PopulationTimeOfDayByBucketPersonAndAttribute:
pNewCluster = std::exp(-pow4(static_cast<double>(elapsedTime) /
static_cast<double>(core::constants::DAY)));
break;
case E_PopulationTimeOfWeekByBucketPersonAndAttribute:
pNewCluster = std::exp(-pow4(static_cast<double>(elapsedTime) /
static_cast<double>(core::constants::WEEK)));
break;
CASE_POPULATION_METRIC:
break;
}
return pNewCluster + probability * (1.0 - pNewCluster);
}