Issue Details (XML | Word | Printable)

Key: MDL-12897
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Mathieu Petit-Clair
Reporter: Eloy Lafuente (stronk7)
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

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

Created: 10/Jan/08 04:43 AM   Updated: 12/Feb/08 12:37 PM
Return to search
Component/s: Tags
Affects Version/s: 1.9, 2.0
Fix Version/s: 2.0

Issue Links:
Dependency
 

Database: Any
Participants: Eloy Lafuente (stronk7) and Mathieu Petit-Clair
Security Level: None
Resolved date: 12/Feb/08
Affected Branches: MOODLE_19_STABLE, MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
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 :-)

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Mathieu Petit-Clair added a comment - 12/Feb/08 12:35 PM
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


Mathieu Petit-Clair made changes - 12/Feb/08 12:36 PM
Field Original Value New Value
Assignee Luiz Cruz [ luiz.laydner ] Mathieu Petit-Clair [ scyrma ]
Mathieu Petit-Clair made changes - 12/Feb/08 12:37 PM
Link This issue will be resolved by MDL-13124 [ MDL-13124 ]
Mathieu Petit-Clair made changes - 12/Feb/08 12:37 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]