-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default to ten docs deep scoring (#209)
* and we have made the default depth change * maybe we ought to actually save our changes!
- Loading branch information
Showing
10 changed files
with
45 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
db/migrate/20200911192850_change_default_scorers_to_at_ten_deep.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class ChangeDefaultScorersToAtTenDeep < ActiveRecord::Migration | ||
def change | ||
|
||
scorers_to_update = ['P@5', 'AP@5','nDCG@5', 'DCG@5', 'CG@5'] | ||
|
||
scorers_to_update.each do |scorer_name| | ||
scorer = Scorer.where(name: scorer_name).first | ||
unless scorer.nil? | ||
name = scorer.name | ||
name.sub!('@5', '@10') | ||
scorer.name = name | ||
scorer.code = File.readlines("./db/scorers/#{name.downcase}.js",'\n').join('\n'), | ||
scorer.save! | ||
end | ||
|
||
|
||
end | ||
|
||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
var k = 5; // @Rank | ||
var k = 10; // @Rank | ||
total = 0 | ||
|
||
eachDoc(function(doc, i) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
var k = 5 // @Rank | ||
var k = 10 // @Rank | ||
var score = 0; | ||
|
||
eachDoc(function(doc, i) { | ||
score += docRating(i); | ||
}, k) | ||
|
||
setScore(score); | ||
setScore(score); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
var k = 5 // @Rank | ||
var k = 10 // @Rank | ||
var score = 0; | ||
|
||
eachDoc(function(doc, i) { | ||
var d = Math.log2(i+2); // i is the JSindex not the DocRank; 0 vs 1 | ||
var n = Math.pow(2,docRating(i))-1; | ||
var n = Math.pow(2,docRating(i))-1; | ||
score += d?(n/d):0; | ||
}, k) | ||
|
||
setScore(score); | ||
setScore(score); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
var k = 5 // @Rank | ||
var k = 10 // @Rank | ||
|
||
var ideal = topRatings(k) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
var k = 10 // @Rank | ||
var score = avgRating(k); | ||
|
||
setScore(score); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters