Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[audit] Make sure --audit output is reproducible across systems. #1788

Merged
merged 4 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/RunTests
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ exit $ErrorCount;
# and if any of them exists, we use it instead.
#
__DATA__

# Test 1:
{VW} -k -l 20 --initial_t 128000 --power_t 1 -d train-sets/0001.dat \
-f models/0001_1.model -c --passes 8 --invariant \
Expand Down Expand Up @@ -1650,3 +1651,8 @@ echo "1 | feature:1" | {VW} -a --initial_weight 0.1 --initial_t 0.3

# Test 176: same model on cluster mode
./same-model-test.sh

# Test 177: check --audit output is reproducible
printf '3 |f a b c |e x y z\n2 |f a y c |e x\n' | {VW} --oaa 3 -q ef --audit
train-sets/ref/audit2.stdout

12 changes: 12 additions & 0 deletions test/train-sets/ref/audit2.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
0
f^a:57420:1:0@0 f^b:62864:1:0@0 f^c:228992:1:0@0 e^x:125152:1:0@0 e^y:27664:1:0@0 e^z:259284:1:0@0 Constant:202096:1:0@0 e^x*f^a:96492:1:0@0 e^x*f^b:93488:1:0@0 e^x*f^c:189984:1:0@0 e^y*f^a:195964:1:0@0 e^y*f^b:190624:1:0@0 e^y*f^c:91056:1:0@0 e^z*f^a:166384:1:0@0 e^z*f^b:171052:1:0@0 e^z*f^c:71484:1:0@0
0
f^a:57421:1:0@0 f^b:62865:1:0@0 f^c:228993:1:0@0 e^x:125153:1:0@0 e^y:27665:1:0@0 e^z:259285:1:0@0 Constant:202097:1:0@0 e^x*f^a:96493:1:0@0 e^x*f^b:93489:1:0@0 e^x*f^c:189985:1:0@0 e^y*f^a:195965:1:0@0 e^y*f^b:190625:1:0@0 e^y*f^c:91057:1:0@0 e^z*f^a:166385:1:0@0 e^z*f^b:171053:1:0@0 e^z*f^c:71485:1:0@0
0
f^a:57422:1:0@0 f^b:62866:1:0@0 f^c:228994:1:0@0 e^x:125154:1:0@0 e^y:27666:1:0@0 e^z:259286:1:0@0 Constant:202098:1:0@0 e^x*f^a:96494:1:0@0 e^x*f^b:93490:1:0@0 e^x*f^c:189986:1:0@0 e^y*f^a:195966:1:0@0 e^y*f^b:190626:1:0@0 e^y*f^c:91058:1:0@0 e^z*f^a:166386:1:0@0 e^z*f^b:171054:1:0@0 e^z*f^c:71486:1:0@0
-0.324225
f^a:57420:1:-0.0540374@4 f^c:228992:1:-0.0540374@4 e^x:125152:1:-0.0540374@4 Constant:202096:1:-0.0540374@4 e^x*f^a:96492:1:-0.0540374@4 e^x*f^c:189984:1:-0.0540374@4 f^y:154732:1:0@0 e^x*f^y:246988:1:0@0
-0.324225
f^a:57421:1:-0.0540374@4 f^c:228993:1:-0.0540374@4 e^x:125153:1:-0.0540374@4 Constant:202097:1:-0.0540374@4 e^x*f^a:96493:1:-0.0540374@4 e^x*f^c:189985:1:-0.0540374@4 f^y:154733:1:0@0 e^x*f^y:246989:1:0@0
0.324225
f^a:57422:1:0.0540374@4 f^c:228994:1:0.0540374@4 e^x:125154:1:0.0540374@4 Constant:202098:1:0.0540374@4 e^x*f^a:96494:1:0.0540374@4 e^x*f^c:189986:1:0.0540374@4 f^y:154734:1:0@0 e^x*f^y:246990:1:0@0
2 changes: 1 addition & 1 deletion vowpalwabbit/gd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void print_features(vw& all, example& ec)
INTERACTIONS::generate_interactions<audit_results, const uint64_t, audit_feature, true, audit_interaction>(
all, ec, dat);

sort(dat.results.begin(), dat.results.end());
stable_sort(dat.results.begin(), dat.results.end());
if (all.audit)
{
for (string_value& sv : dat.results) cout << '\t' << sv.s;
Expand Down