chg: [decaying:model] Fith batch of fix from the PR review - WiP (not tested)

pull/5032/head
mokaddem 2019-09-12 11:28:32 +02:00
parent 32140b75b5
commit b16945619e
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
4 changed files with 16 additions and 5 deletions

View File

@ -26,6 +26,9 @@ class DecayingModelMapping extends AppModel
);
public function resetMappingForModel($new_model, $user) {
if (empty($new_model['model_id'])) {
throw new NotFoundException(__('No Decaying Model with the provided ID exists'));
}
$this->deleteAll(array(
'model_id' => $new_model['model_id']
));

View File

@ -37,7 +37,7 @@ abstract class DecayingModelBase
}
// return attribute tag with event tag matching the namespace+predicate overridden
protected function __getPrioritizedTag($attribute)
protected function __getPrioritisedTag($attribute)
{
$tags = array();
$overridden_tags = array();
@ -87,7 +87,13 @@ abstract class DecayingModelBase
if (!$flag_contain_matching_taxonomy) {
$base_score = $default_base_score;
}
return array('base_score' => $base_score, 'overridden' => $overridden_tags, 'tags' => $tags, 'taxonomy_effective_ratios' => $taxonomy_effective_ratios, 'default_base_score' => $default_base_score);
return array(
'base_score' => $base_score,
'overridden' => $overridden_tags,
'tags' => $tags,
'taxonomy_effective_ratios' => $taxonomy_effective_ratios,
'default_base_score' => $default_base_score
);
}
// Compute the current score for the provided attribute according to the last sighting with the provided model

View File

@ -3,7 +3,9 @@ include_once 'Base.php';
class Polynomial extends DecayingModelBase
{
public const DESCRIPTION = 'The implementation of the decaying formula from the paper `An indicator scoring method for MISP platforms`.';
function __construct() {
$DESCRIPTION = __('The implementation of the decaying formula from the paper `An indicator scoring method for MISP platforms`.');
}
public function computeScore($model, $attribute, $base_score, $elapsed_time)
{

View File

@ -3,9 +3,9 @@ include_once 'Polynomial.php';
class PolynomialExtended extends Polynomial
{
public const DESCRIPTION = 'The implementation of the decaying formula from the paper `An indicator scoring method for MISP platforms` with support of the `Retention` taxonomy which overrides the final score.';
function __construct() {
$DESCRIPTION = __('The implementation of the decaying formula from the paper `An indicator scoring method for MISP platforms` with support of the `Retention` taxonomy which overrides the final score.');
// setup `retention` taxonomy
$this->Taxonomy = ClassRegistry::init('Taxonomy');
$retention_taxonomy_id = $this->Taxonomy->find('first', array(