GitHub PullRequestReviewCommentEvent at 2014-05-02 18:47:39
Repository: scikit-bio
Actor: ElBrogrammer
Payload: {"comment":{"url":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments/12242219","id":12242219,"diff_hunk":"@@ -0,0 +1,107 @@\n+#!/usr/bin/env python\n+from __future__ import division\n+\n+# ----------------------------------------------------------------------------\n+# Copyright (c) 2013--, scikit-bio development team.\n+#\n+# Distributed under the terms of the Modified BSD License.\n+#\n+# The full license is in the file COPYING.txt, distributed with this software.\n+# ----------------------------------------------------------------------------\n+\n+import numpy as np\n+\n+from .base import _validate\n+\n+\n+def gini_index(data, method='rectangles'):\n+    \"\"\"Calculate the Gini index.\n+\n+    Formula is ``G = A/(A+B)`` where ``A`` is the area between ``y=x`` and the\n+    Lorenz curve and ``B`` is the area under the Lorenz curve. Simplifies to\n+    ``1-2B`` since ``A+B=0.5``.\n+\n+    Parameters\n+    ----------\n+    data : (N,) array_like\n+        Vector of counts, abundances, proportions, etc. All entries must be\n+        non-negative.\n+    method : {'rectangles', 'trapezoids'}\n+        Method for calculating the area under the Lorenz curve. If\n+        ``'rectangles'``, connects the Lorenz curve points by lines parallel to\n+        the x axis. This is the correct method (in our opinion) though\n+        trapezoids might be desirable in some circumstances. Forumla is:\n+        ``dx(sum(i=1,i=n,h_i))``.\n+        If ``'trapezoids'``, connects the Lorenz curve points by linear\n+        segments between them. Basically assumes that the given sampling is\n+        accurate and that more features of given data would fall on linear\n+        gradients between the values of this data. Formula is:\n+        ``dx[(h_0+h_n)/2 + sum(i=1,i=n-1,h_i)]``.\n+\n+    Returns\n+    -------\n+    double\n+        Gini index.\n+","path":"skbio/maths/diversity/alpha/gini.py","position":45,"original_position":45,"commit_id":"146c607eeed685b21b020e4080be58a8b5a8ec47","original_commit_id":"ddcab2a86b28ca4e006784324f91536fc6db6311","user":{"login":"ElBrogrammer","id":1847232,"avatar_url":"https://avatars.githubusercontent.com/u/1847232?","gravatar_id":"9e0f900bf3227c537736e8d56121fa89","url":"https://api.github.com/users/ElBrogrammer","html_url":"https://github.com/ElBrogrammer","followers_url":"https://api.github.com/users/ElBrogrammer/followers","following_url":"https://api.github.com/users/ElBrogrammer/following{/other_user}","gists_url":"https://api.github.com/users/ElBrogrammer/gists{/gist_id}","starred_url":"https://api.github.com/users/ElBrogrammer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElBrogrammer/subscriptions","organizations_url":"https://api.github.com/users/ElBrogrammer/orgs","repos_url":"https://api.github.com/users/ElBrogrammer/repos","events_url":"https://api.github.com/users/ElBrogrammer/events{/privacy}","received_events_url":"https://api.github.com/users/ElBrogrammer/received_events","type":"User","site_admin":false},"body":"done","created_at":"2014-05-02T18:47:39Z","updated_at":"2014-05-02T18:47:39Z","html_url":"https://github.com/biocore/scikit-bio/pull/283#discussion_r12242219","pull_request_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/283","_links":{"self":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments/12242219"},"html":{"href":"https://github.com/biocore/scikit-bio/pull/283#discussion_r12242219"},"pull_request":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/283"}}}}