GitHub PullRequestReviewCommentEvent at 2014-03-07 10:23:17
Repository: scikit-learn
Actor: ogrisel
Payload: {"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/10378629","id":10378629,"diff_hunk":"@@ -0,0 +1,36 @@\n+import numpy as np\n+import gc\n+from datetime import datetime\n+from sklearn.isotonic import IsotonicRegression\n+from sklearn.utils.bench import total_seconds\n+import sys\n+import matplotlib.pyplot as plt\n+import json\n+plt.ioff()\n+\n+\n+def bench_isotonic_regression(X, Y):\n+    gc.collect()\n+\n+    # start time\n+    tstart = datetime.now()\n+    clf = IsotonicRegression()\n+    clf.fit(X, Y)\n+    delta = (datetime.now() - tstart)\n+    return total_seconds(delta)\n+\n+if __name__ == '__main__':\n+    min_exp, max_exp, iters = map(int, sys.argv[1:])\n+    timings = []\n+    for i in range(min_exp, max_exp):\n+        n = 10 ** i\n+        X = np.arange(n)\n+        Y = np.random.randint(-50, 50, size=(n,)) \\\n+            + 50. * np.log(1 + np.arange(n))\n+        times = [bench_isotonic_regression(X, Y) for i in range(iters)]\n+        timing = (n, np.mean(times))\n+        timings.append(timing)\n+    xs, ys = zip(*timings)\n+    print json.dumps(timings)","path":"benchmarks/bench_isotonic.py","position":34,"original_position":34,"commit_id":"8e25dbc31568fe2af7c190c44f5f1054882a1592","original_commit_id":"8e25dbc31568fe2af7c190c44f5f1054882a1592","user":{"login":"ogrisel","id":89061,"avatar_url":"https://gravatar.com/avatar/aee56554ec30edfd680e1c937ed4e54d?d=https%3A%2F%2Fidenticons.github.com%2F99e8ff48f7f4a7ec3618f0a0efe1af07.png&r=x","gravatar_id":"aee56554ec30edfd680e1c937ed4e54d","url":"https://api.github.com/users/ogrisel","html_url":"https://github.com/ogrisel","followers_url":"https://api.github.com/users/ogrisel/followers","following_url":"https://api.github.com/users/ogrisel/following{/other_user}","gists_url":"https://api.github.com/users/ogrisel/gists{/gist_id}","starred_url":"https://api.github.com/users/ogrisel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogrisel/subscriptions","organizations_url":"https://api.github.com/users/ogrisel/orgs","repos_url":"https://api.github.com/users/ogrisel/repos","events_url":"https://api.github.com/users/ogrisel/events{/privacy}","received_events_url":"https://api.github.com/users/ogrisel/received_events","type":"User","site_admin":false},"body":"Please make it work under Python 3 by adding parens to print statements.","created_at":"2014-03-07T10:23:17Z","updated_at":"2014-03-07T10:23:17Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/2944#discussion_r10378629","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2944","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/10378629"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/2944#discussion_r10378629"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/2944"}}}}