mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 20:21:21 +00:00
Correct an abbreviation
Change-Id: I7424cd587c87f1256237de1cf913b9b0b31104f2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151341 Reviewed-by: Jaime Wren <jwren@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
badc77239a
commit
bd3b3299cb
|
@ -78,56 +78,56 @@ void main() {
|
|||
|
||||
group('MeanReciprocalRankComputer', () {
|
||||
test('empty', () {
|
||||
var mrrc = MeanReciprocalRankComputer('');
|
||||
expect(mrrc.count, equals(0));
|
||||
expect(mrrc.mrr, equals(0));
|
||||
var computer = MeanReciprocalRankComputer('');
|
||||
expect(computer.count, equals(0));
|
||||
expect(computer.mrr, equals(0));
|
||||
});
|
||||
|
||||
test('clear', () {
|
||||
var mrrc = MeanReciprocalRankComputer('');
|
||||
mrrc.addRank(2);
|
||||
expect(mrrc.count, equals(1));
|
||||
expect(mrrc.mrr, equals(1 / 2));
|
||||
expect(mrrc.mrr_5, equals(1 / 2));
|
||||
var computer = MeanReciprocalRankComputer('');
|
||||
computer.addRank(2);
|
||||
expect(computer.count, equals(1));
|
||||
expect(computer.mrr, equals(1 / 2));
|
||||
expect(computer.mrr_5, equals(1 / 2));
|
||||
|
||||
mrrc.clear();
|
||||
expect(mrrc.count, equals(0));
|
||||
expect(mrrc.mrr, equals(0));
|
||||
expect(mrrc.mrr_5, equals(0));
|
||||
computer.clear();
|
||||
expect(computer.count, equals(0));
|
||||
expect(computer.mrr, equals(0));
|
||||
expect(computer.mrr_5, equals(0));
|
||||
});
|
||||
|
||||
test('mmr- single value', () {
|
||||
var mrrc = MeanReciprocalRankComputer('');
|
||||
mrrc.addRank(3);
|
||||
mrrc.addRank(3);
|
||||
mrrc.addRank(3);
|
||||
mrrc.addRank(3);
|
||||
mrrc.addRank(3);
|
||||
expect(mrrc.count, equals(5));
|
||||
expect(mrrc.mrr, doubleEquals(1 / 3));
|
||||
expect(mrrc.mrr_5, doubleEquals(1 / 3));
|
||||
test('mrr- single value', () {
|
||||
var computer = MeanReciprocalRankComputer('');
|
||||
computer.addRank(3);
|
||||
computer.addRank(3);
|
||||
computer.addRank(3);
|
||||
computer.addRank(3);
|
||||
computer.addRank(3);
|
||||
expect(computer.count, equals(5));
|
||||
expect(computer.mrr, doubleEquals(1 / 3));
|
||||
expect(computer.mrr_5, doubleEquals(1 / 3));
|
||||
});
|
||||
|
||||
test('mmr- example', () {
|
||||
var mrrc = MeanReciprocalRankComputer('');
|
||||
mrrc.addRank(3);
|
||||
mrrc.addRank(2);
|
||||
mrrc.addRank(1);
|
||||
expect(mrrc.count, equals(3));
|
||||
expect(mrrc.mrr, doubleEquals(11 / 18));
|
||||
expect(mrrc.mrr_5, doubleEquals(11 / 18));
|
||||
test('mrr- example', () {
|
||||
var computer = MeanReciprocalRankComputer('');
|
||||
computer.addRank(3);
|
||||
computer.addRank(2);
|
||||
computer.addRank(1);
|
||||
expect(computer.count, equals(3));
|
||||
expect(computer.mrr, doubleEquals(11 / 18));
|
||||
expect(computer.mrr_5, doubleEquals(11 / 18));
|
||||
});
|
||||
|
||||
test('mmr- max rank', () {
|
||||
var mrrc = MeanReciprocalRankComputer('');
|
||||
mrrc.addRank(6);
|
||||
mrrc.addRank(5);
|
||||
mrrc.addRank(4);
|
||||
mrrc.addRank(3);
|
||||
mrrc.addRank(2);
|
||||
mrrc.addRank(1);
|
||||
expect(mrrc.count, equals(6));
|
||||
expect(mrrc.mrr, greaterThan(mrrc.mrr_5));
|
||||
test('mrr- max rank', () {
|
||||
var computer = MeanReciprocalRankComputer('');
|
||||
computer.addRank(6);
|
||||
computer.addRank(5);
|
||||
computer.addRank(4);
|
||||
computer.addRank(3);
|
||||
computer.addRank(2);
|
||||
computer.addRank(1);
|
||||
expect(computer.count, equals(6));
|
||||
expect(computer.mrr, greaterThan(computer.mrr_5));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ class CompletionMetrics {
|
|||
MeanReciprocalRankComputer topLevelMrrComputer =
|
||||
MeanReciprocalRankComputer('non-type member completions');
|
||||
|
||||
Map<String, MeanReciprocalRankComputer> locationMmrComputers = {};
|
||||
Map<String, MeanReciprocalRankComputer> locationMrrComputers = {};
|
||||
|
||||
ArithmeticMeanComputer charsBeforeTop =
|
||||
ArithmeticMeanComputer('chars_before_top');
|
||||
|
@ -259,7 +259,7 @@ class CompletionMetrics {
|
|||
/// as well as the longest sets of results to compute.
|
||||
void recordCompletionResult(CompletionResult result) {
|
||||
_recordTime(result);
|
||||
_recordMmr(result);
|
||||
_recordMrr(result);
|
||||
_recordWorstResult(result);
|
||||
_recordSlowestResult(result);
|
||||
_recordMissingInformation(result);
|
||||
|
@ -279,8 +279,8 @@ class CompletionMetrics {
|
|||
}
|
||||
}
|
||||
|
||||
/// Record the MMR for the [result].
|
||||
void _recordMmr(CompletionResult result) {
|
||||
/// Record the MRR for the [result].
|
||||
void _recordMrr(CompletionResult result) {
|
||||
var rank = result.place.rank;
|
||||
// Record globally.
|
||||
successfulMrrComputer.addRank(rank);
|
||||
|
@ -299,7 +299,7 @@ class CompletionMetrics {
|
|||
// Record by completion location.
|
||||
var location = result.completionLocation;
|
||||
if (location != null) {
|
||||
var computer = locationMmrComputers.putIfAbsent(
|
||||
var computer = locationMrrComputers.putIfAbsent(
|
||||
location, () => MeanReciprocalRankComputer(location));
|
||||
computer.addRank(rank);
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ class CompletionMetricsComputer {
|
|||
|
||||
if (verbose) {
|
||||
var lines = <LocationTableLine>[];
|
||||
for (var entry in metrics.locationMmrComputers.entries) {
|
||||
for (var entry in metrics.locationMrrComputers.entries) {
|
||||
var count = entry.value.count;
|
||||
var mrr = (1 / entry.value.mrr);
|
||||
var mrr_5 = (1 / entry.value.mrr_5);
|
||||
|
@ -531,7 +531,7 @@ class CompletionMetricsComputer {
|
|||
}
|
||||
lines.sort((first, second) => second.product.compareTo(first.product));
|
||||
var table = <List<String>>[];
|
||||
table.add(['Location', 'Product', 'Count', 'Mmr', 'Mmr_5']);
|
||||
table.add(['Location', 'Product', 'Count', 'Mrr', 'Mrr_5']);
|
||||
for (var line in lines) {
|
||||
var location = line.label;
|
||||
var product = line.product.truncate().toString();
|
||||
|
@ -1036,7 +1036,7 @@ class CompletionResult {
|
|||
}
|
||||
}
|
||||
|
||||
/// The data to be printed on a single line in the table of mmr values per
|
||||
/// The data to be printed on a single line in the table of mrr values per
|
||||
/// completion location.
|
||||
class LocationTableLine {
|
||||
final String label;
|
||||
|
|
|
@ -132,10 +132,10 @@ class MeanReciprocalRankComputer {
|
|||
|
||||
void printMean() {
|
||||
print('Mean Reciprocal Rank \'$name\' (total = $count)');
|
||||
print('mmr = ${mrr.toStringAsFixed(6)} '
|
||||
print('mrr = ${mrr.toStringAsFixed(6)} '
|
||||
'(inverse = ${(1 / mrr).toStringAsFixed(3)})');
|
||||
|
||||
print('mmr_5 = ${mrr_5.toStringAsFixed(6)} '
|
||||
print('mrr_5 = ${mrr_5.toStringAsFixed(6)} '
|
||||
'(inverse = ${(1 / mrr_5).toStringAsFixed(3)})');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue