mirror of https://github.com/MISP/MISP
chg: [decaying:model] Fith batch of fix from the PR review - WiP (not tested)
parent
32140b75b5
commit
b16945619e
|
@ -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']
|
||||
));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue