Moodle

The calculation of correlated tags seems imperfect under small correlations...

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9, 2.0
  • Fix Version/s: 2.0
  • Component/s: Tags
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

I've been playing with user tags a bit in a medium server and, being the FIRST user there to introduce my tags I've seen something in the automatic correlation that could be improved.

After introducing my tags (10), all them have been correlated, and really they aren't at all. Looking at code, in the cache_correlated_tags() function, it seems that the $cutoff is calculated this way:

$cutoff = $tag_correlations[$tag_id]->nr * $min_correlation;

(with $min_correlation = 0.25)

That means that, when ONE user (the first) has introduced the tags A & B, the correlation will be:

$cutoff = 1 * 0.25 = 0.25

and in the next line of code:

if($correlation->nr >= $cutoff...

is ALWAYS true! because $correlation->nr is ALWAYS bigger or equal to $cutoff (because $cutoff has been calculated by multiplying by 0.25).

Summarizing:

1) The $min_correlation use seems to be buggy. It causes small $cutoffs always.
2) I would supress the $cutoff calculation and usage completely.
3) Instead I'll redefine $min_correlation like a integer number of correlations (say, at least, 2, or configurable in admin settings).
4) Any COUNT over that integer $min_correlation will be considered as related.

Or, alternatively:

1) Simply force $cutoff calclation to be at least "1" to avoid individual pairs to become correlations.

Just that. Ciao

Issue Links

Activity

Hide
Mathieu Petit-Clair added a comment -

I just became aware of this bug report... Martin and I had a look at this a few weeks ago and actually changed the code. As it made the whole thing a lot better on moodle.org, I'll close this bug.

For the record, the changes can be found in http://cvs.moodle.org/moodle/tag/lib.php?r1=1.43.2.6&r2=1.43.2.7

Show
Mathieu Petit-Clair added a comment - I just became aware of this bug report... Martin and I had a look at this a few weeks ago and actually changed the code. As it made the whole thing a lot better on moodle.org, I'll close this bug. For the record, the changes can be found in http://cvs.moodle.org/moodle/tag/lib.php?r1=1.43.2.6&r2=1.43.2.7

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: