<commit_before>#!/usr/bin/env julia

using DataFrames

import Celeste.AccuracyBenchmark
import Celeste.Infer
import Celeste.ParallelRun

if length(ARGS) != 3
    println("Usage: score_predictions.jl <ground truth> <prediction> <prediction>")
    println("Where each argument is a catalog CSV")
end

truth = AccuracyBenchmark.read_catalog(ARGS[1])
first_predictions = AccuracyBenchmark.read_catalog(ARGS[2])
second_predictions = AccuracyBenchmark.read_catalog(ARGS[3])

scores = AccuracyBenchmark.score_predictions(truth, [first_predictions, second_predictions])
println(repr(scores))<commit_msg>direct support for scoring just one prediction catalog<commit_after>#!/usr/bin/env julia

using DataFrames

import Celeste.AccuracyBenchmark
import Celeste.Infer
import Celeste.ParallelRun

if !(2 <= length(ARGS) <= 3)
    println("Usage: score_predictions.jl <ground truth> <predictions> [predictions]")
    println("Where each argument is a catalog CSV")
end

have_second_predictions = (length(ARGS) == 3)

truth = AccuracyBenchmark.read_catalog(ARGS[1])
first_predictions = AccuracyBenchmark.read_catalog(ARGS[2])
if have_second_predictions
    second_predictions = AccuracyBenchmark.read_catalog(ARGS[3])
else
    second_predictions = first_predictions
end

scores = AccuracyBenchmark.score_predictions(truth, [first_predictions, second_predictions])
if !have_second_predicitons
    scores = scores[:, [:N, :first, :field, :source_type]]
end
println(repr(scores))
{'fraction_non_alphanumeric': 0.10259917920656635, 'fraction_numerical': 0.006839945280437756, 'mean_word_length': 7.265536723163842, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1545366', 'n_tokens_mistral': 496, 'n_tokens_neox': 467, 'n_words': 101}