Skip to content
Snippets Groups Projects
Commit 6a89961b authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Fixed relevance_frequency_rank_global

parent 03ff8760
No related branches found
No related tags found
No related merge requests found
......@@ -197,10 +197,10 @@ namespace :tag do
puts "\nStarted Ranking LOs...\n"
# ranks each LO
# freq = cluster_frequency(close_tags)
# freq_cluster = cluster_frequency(close_tags)
LearningObject.all.each do |lo|
los_ranked[lo.id] = relevance_frequency_rank(lo, close_tags)
# los_ranked[lo.id] = relevance_frequency_rank_global(lo, close_tags, freq)
# los_ranked[lo.id] = relevance_frequency_rank_global(lo, close_tags, freq_cluster)
# los_ranked[lo.id] = relevance_raw_rank(lo, close_tags)
end
......@@ -245,7 +245,7 @@ namespace :tag do
def relevance_frequency_rank_global(lo, close_tags, freq_cluster)
# for each tag in LO that is in the cluster, accumulate it's rank
rank_sum = 0
rank_sum = 1
lo.tags.each do |t|
close_tags.each do |tag|
if tag[:id] == t.id
......@@ -255,11 +255,11 @@ namespace :tag do
end
wdf = 0
wdf = (Math.log2(freq+1)/(Math.log2(lo.tags.size)+1)) if lo.tags.size != 0
wdf = (Math.log2(rank_sum)/(Math.log2(lo.tags.size)+1)) if lo.tags.size != 0
itf = Math.log2(Tag.all.size/freq_cluster)+1
return wdf*itf*rank_sum
return wdf*itf
end
# returns the rank sum of the tags in the LO
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment