Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: quick_score.py

Issue 1620043002: Add scripts for distillability modelling (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: set upstream patchset, identical to patch set 2 Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « heuristics/distillable/write_features_csv.py ('k') | write_features_csv.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: quick_score.py
diff --git a/quick_score.py b/quick_score.py
deleted file mode 100755
index c12c84f8c83e68e76a03dcc2311596206cc30739..0000000000000000000000000000000000000000
--- a/quick_score.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import csv
-import json
-import os
-import shutil
-import sys
-
-def main(argv):
- parser = argparse.ArgumentParser()
- parser.add_argument('--features', required=True)
- options = parser.parse_args(argv)
-
- features = list(csv.DictReader(open(options.features)))
-
- t = 0
- s = 0
- for f in features:
- w = 2 if (int(f['good']) == 1) else 1
- p = 0
- if int(f['opengraph']) == 1 and not int(f['pathlength']) == 0:
- p = 1
- t += w
- if p == int(f['good']):
- s += w
-
- print t, s, float(s)/t
-
- t = 0
- c = 0
- w = 0
- for f in features:
- g = int(f['good'])
- fb = int(f['opengraph'])
- home = int(f['pathlength']) < 2
- t += g
- if fb == 1 and not home:
- if g == 1:
- c += 1
- else:
- w += 1
-
- print float(c) / (c + w)
- print float(c) / t
-
- return 0
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
-
« no previous file with comments | « heuristics/distillable/write_features_csv.py ('k') | write_features_csv.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698