Skip to content

Commit

Permalink
moving to a more industry standard grading scale of 0,1,2,3 from out …
Browse files Browse the repository at this point in the history
…0 to 4, and eliminating the middle choice (#206)
  • Loading branch information
epugh committed Oct 26, 2020
1 parent 8263f37 commit 1f19b4b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
17 changes: 17 additions & 0 deletions db/migrate/20200911180507_change_to_zero_to_three_grading.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class ChangeToZeroToThreeGrading < ActiveRecord::Migration
def change

scale_with_labels = {"0":"Poor","1":"Fair","2":"Good","3":"Perfect"}

scorers_to_update = ['nDCG@5', 'DCG@5', 'CG@5']

scorers_to_update.each do |scorer_name|
scorer = Scorer.where(name: scorer_name).first
unless scorer.nil?
scorer.scale = (0..3).to_a
scorer.scale_with_labels = scale_with_labels
end

end
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20200522215022) do
ActiveRecord::Schema.define(version: 20200911180507) do

create_table "annotations", force: :cascade do |t|
t.text "message", limit: 65535
Expand Down
12 changes: 6 additions & 6 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# Mayor.create(name: 'Emanuel', city: cities.first)

Scorer.where(name: 'nDCG@5').first_or_create(
scale: (0..4).to_a,
scale_with_labels: {"0":"Irrelevant","1":"Poor","2":"Fair","3":"Good","4":"Perfect"},
scale: (0..3).to_a,
scale_with_labels: {"0":"Poor","1":"Fair","2":"Good","3":"Perfect"},
show_scale_labels: true,
code: File.readlines('./db/scorers/[email protected]','\n').join('\n'),
name: 'nDCG@5',
Expand All @@ -18,17 +18,17 @@
)

Scorer.where(name: 'DCG@5').first_or_create(
scale: (0..4).to_a,
scale_with_labels: {"0":"Irrelevant","1":"Poor","2":"Fair","3":"Good","4":"Perfect"},
scale: (0..3).to_a,
scale_with_labels: {"0":"Poor","1":"Fair","2":"Good","3":"Perfect"},
show_scale_labels: true,
code: File.readlines('./db/scorers/[email protected]','\n').join('\n'),
name: 'DCG@5',
communal: true
)

Scorer.where(name: 'CG@5').first_or_create(
scale: (0..4).to_a,
scale_with_labels: {"0":"Irrelevant","1":"Poor","2":"Fair","3":"Good","4":"Perfect"},
scale: (0..3).to_a,
scale_with_labels: {"0":"Poor","1":"Fair","2":"Good","3":"Perfect"},
show_scale_labels: true,
code: File.readlines('./db/scorers/[email protected]','\n').join('\n'),
name: 'CG@5',
Expand Down

0 comments on commit 1f19b4b

Please sign in to comment.