{"action":"created","comment":{"url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/comments/204368600","pull_request_review_id":139432197,"id":204368600,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNDM2ODYwMA==","diff_hunk":"@@ -0,0 +1,202 @@\n+\n+# yellowbrick.features.histogram\n+# Implementations of histogram with vertical lines to help with balanced binning.\n+#\n+# Author:   Juan L. Kehoe (juanluo2008@gmail.com)\n+# Author:   Prema Damodaran Roman (pdamo24@gmail.com)\n+\n+# Created:  Tue Mar 13 19:50:54 2018 -0400\n+#\n+# Copyright (C) 2018 District Data Labs\n+# For license information, see LICENSE.txt\n+#\n+# ID: histogram.py\n+\n+\"\"\"\n+Implements histogram with vertical lines to help with balanced binning.\n+\"\"\"\n+\n+##########################################################################\n+## Imports\n+##########################################################################\n+import matplotlib.pyplot as plt\n+import numpy as np\n+\n+from yellowbrick.features.base import FeatureVisualizer\n+from yellowbrick.exceptions import YellowbrickValueError\n+from yellowbrick.utils import is_dataframe\n+\n+##########################################################################\n+## Balanced Binning Reference\n+##########################################################################\n+\n+class BalancedBinningReference(FeatureVisualizer):\n+    \"\"\"\n+    BalancedBinningReference allows to generate a histogram with vertical lines\n+    showing the recommended value point to bin your data so they can be evenly\n+    distributed in each bin.\n+\n+    Parameters\n+    ----------\n+    ax : matplotlib Axes, default: None\n+        This is inherited from FeatureVisualizer and is defined within\n+        BalancedBinningReference.\n+    feature : string, default: None\n+        The name of the X variable\n+        If a DataFrame is passed to fit and feature is None, feature\n+        is selected as the column of the DataFrame.  There must be only\n+        one column in the DataFrame.\n+    target : string, default: None\n+        The name of the Y variable\n+        Default: Counts\n+    bins : number of bins to generate the histogram\n+    kwargs : dict\n+        Keyword arguments that are passed to the base class and may influence\n+        the visualization as defined in other Visualizers.\n+\n+    Examples\n+    --------\n+    >>> visualizer = BalancedBinningReference()\n+    >>> visualizer.fit(X)\n+    >>> visualizer.poof()\n+\n+\n+    Notes\n+    -----\n+    These parameters can be influenced later on in the visualization\n+    process, but can and should be set as early as possible.\n+    \"\"\"\n+\n+    def __init__(self, ax=None, feature=None, target='Counts', bins=4, **kwargs):\n+\n+        super(BalancedBinningReference, self).__init__(ax, **kwargs)\n+\n+        self.feature = feature\n+        self.target = target\n+        self.bins = bins\n+\n+    def draw(self, X, **kwargs):\n+        \"\"\"\n+        Draws a histogram with the reference value for binning as vetical lines\n+        Parameters\n+        ----------\n+        X : ndarray or DataFrame of shape n x 1","path":"yellowbrick/features/histogram.py","position":83,"original_position":83,"commit_id":"87dd60bbb4a443da386d7b837158a4c7c6dda264","original_commit_id":"87dd60bbb4a443da386d7b837158a4c7c6dda264","user":{"login":"bbengfort","id":745966,"node_id":"MDQ6VXNlcjc0NTk2Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/745966?v=4","gravatar_id":"","url":"https://api.github.com/users/bbengfort","html_url":"https://github.com/bbengfort","followers_url":"https://api.github.com/users/bbengfort/followers","following_url":"https://api.github.com/users/bbengfort/following{/other_user}","gists_url":"https://api.github.com/users/bbengfort/gists{/gist_id}","starred_url":"https://api.github.com/users/bbengfort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbengfort/subscriptions","organizations_url":"https://api.github.com/users/bbengfort/orgs","repos_url":"https://api.github.com/users/bbengfort/repos","events_url":"https://api.github.com/users/bbengfort/events{/privacy}","received_events_url":"https://api.github.com/users/bbengfort/received_events","type":"User","site_admin":false},"body":"For the target module, `X` becomes `y`: \r\n\r\n```\r\nParameters \r\n------------ \r\n\r\ny : array-like with one dimensions or pd.Series \r\n```","created_at":"2018-07-23T11:35:21Z","updated_at":"2018-07-23T11:44:59Z","html_url":"https://github.com/DistrictDataLabs/yellowbrick/pull/518#discussion_r204368600","pull_request_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/518","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/comments/204368600"},"html":{"href":"https://github.com/DistrictDataLabs/yellowbrick/pull/518#discussion_r204368600"},"pull_request":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/518"}}},"pull_request":{"url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/518","id":202990565,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyOTkwNTY1","html_url":"https://github.com/DistrictDataLabs/yellowbrick/pull/518","diff_url":"https://github.com/DistrictDataLabs/yellowbrick/pull/518.diff","patch_url":"https://github.com/DistrictDataLabs/yellowbrick/pull/518.patch","issue_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/issues/518","number":518,"state":"open","locked":false,"title":"Added histogram.py under features","user":{"login":"pdamodaran","id":7106134,"node_id":"MDQ6VXNlcjcxMDYxMzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/7106134?v=4","gravatar_id":"","url":"https://api.github.com/users/pdamodaran","html_url":"https://github.com/pdamodaran","followers_url":"https://api.github.com/users/pdamodaran/followers","following_url":"https://api.github.com/users/pdamodaran/following{/other_user}","gists_url":"https://api.github.com/users/pdamodaran/gists{/gist_id}","starred_url":"https://api.github.com/users/pdamodaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdamodaran/subscriptions","organizations_url":"https://api.github.com/users/pdamodaran/orgs","repos_url":"https://api.github.com/users/pdamodaran/repos","events_url":"https://api.github.com/users/pdamodaran/events{/privacy}","received_events_url":"https://api.github.com/users/pdamodaran/received_events","type":"User","site_admin":false},"body":"This is the continuation of the work started by @Juan0001.  \r\n\r\nOriginal notes:\r\n\r\nThe BalancedBinningReference is created to give references for binning samples into balanced classes.\r\n\r\nFixes #312\r\n\r\n[Description]\r\n@rebeccabilbro was working on dataset from Pitchfork, a music review website and trying to predict the reviewer's score on a piece of music based on the review content. You can check this link to follow her story on music review score prediction: https://rebeccabilbro.github.io/better-binning/\r\n\r\nThe original scores of the music reviews are numerical, numbers between 0 and 10. Because the high dimention of the text data, she was not able to predict the floating score by using regression. So she decided to bin the scores into 4 categories (“terrible”, “okay”, “great”, and “amazing”). However, the result didn't come back ideal. She found that the unbalanced samples in each bin might be the reason the performance of the model was not as good.\r\n\r\nTo solve this problem, I decided to create a visualizer to give a reference for binning balanced samples into each bin.","created_at":"2018-07-21T03:48:58Z","updated_at":"2018-07-23T11:44:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d2c9fe6d9c557841f65afe4b51162ba4959d162","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":545742505,"node_id":"MDU6TGFiZWw1NDU3NDI1MDU=","url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/labels/review","name":"review","color":"eeeeee","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/518/commits","review_comments_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/518/comments","review_comment_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/issues/518/comments","statuses_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/statuses/87dd60bbb4a443da386d7b837158a4c7c6dda264","head":{"label":"pdamodaran:develop","ref":"develop","sha":"87dd60bbb4a443da386d7b837158a4c7c6dda264","user":{"login":"pdamodaran","id":7106134,"node_id":"MDQ6VXNlcjcxMDYxMzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/7106134?v=4","gravatar_id":"","url":"https://api.github.com/users/pdamodaran","html_url":"https://github.com/pdamodaran","followers_url":"https://api.github.com/users/pdamodaran/followers","following_url":"https://api.github.com/users/pdamodaran/following{/other_user}","gists_url":"https://api.github.com/users/pdamodaran/gists{/gist_id}","starred_url":"https://api.github.com/users/pdamodaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdamodaran/subscriptions","organizations_url":"https://api.github.com/users/pdamodaran/orgs","repos_url":"https://api.github.com/users/pdamodaran/repos","events_url":"https://api.github.com/users/pdamodaran/events{/privacy}","received_events_url":"https://api.github.com/users/pdamodaran/received_events","type":"User","site_admin":false},"repo":{"id":136365533,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYzNjU1MzM=","name":"yellowbrick","full_name":"pdamodaran/yellowbrick","owner":{"login":"pdamodaran","id":7106134,"node_id":"MDQ6VXNlcjcxMDYxMzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/7106134?v=4","gravatar_id":"","url":"https://api.github.com/users/pdamodaran","html_url":"https://github.com/pdamodaran","followers_url":"https://api.github.com/users/pdamodaran/followers","following_url":"https://api.github.com/users/pdamodaran/following{/other_user}","gists_url":"https://api.github.com/users/pdamodaran/gists{/gist_id}","starred_url":"https://api.github.com/users/pdamodaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdamodaran/subscriptions","organizations_url":"https://api.github.com/users/pdamodaran/orgs","repos_url":"https://api.github.com/users/pdamodaran/repos","events_url":"https://api.github.com/users/pdamodaran/events{/privacy}","received_events_url":"https://api.github.com/users/pdamodaran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pdamodaran/yellowbrick","description":"Visual analysis and diagnostic tools to facilitate machine learning model selection.","fork":true,"url":"https://api.github.com/repos/pdamodaran/yellowbrick","forks_url":"https://api.github.com/repos/pdamodaran/yellowbrick/forks","keys_url":"https://api.github.com/repos/pdamodaran/yellowbrick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pdamodaran/yellowbrick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pdamodaran/yellowbrick/teams","hooks_url":"https://api.github.com/repos/pdamodaran/yellowbrick/hooks","issue_events_url":"https://api.github.com/repos/pdamodaran/yellowbrick/issues/events{/number}","events_url":"https://api.github.com/repos/pdamodaran/yellowbrick/events","assignees_url":"https://api.github.com/repos/pdamodaran/yellowbrick/assignees{/user}","branches_url":"https://api.github.com/repos/pdamodaran/yellowbrick/branches{/branch}","tags_url":"https://api.github.com/repos/pdamodaran/yellowbrick/tags","blobs_url":"https://api.github.com/repos/pdamodaran/yellowbrick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pdamodaran/yellowbrick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pdamodaran/yellowbrick/git/refs{/sha}","trees_url":"https://api.github.com/repos/pdamodaran/yellowbrick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pdamodaran/yellowbrick/statuses/{sha}","languages_url":"https://api.github.com/repos/pdamodaran/yellowbrick/languages","stargazers_url":"https://api.github.com/repos/pdamodaran/yellowbrick/stargazers","contributors_url":"https://api.github.com/repos/pdamodaran/yellowbrick/contributors","subscribers_url":"https://api.github.com/repos/pdamodaran/yellowbrick/subscribers","subscription_url":"https://api.github.com/repos/pdamodaran/yellowbrick/subscription","commits_url":"https://api.github.com/repos/pdamodaran/yellowbrick/commits{/sha}","git_commits_url":"https://api.github.com/repos/pdamodaran/yellowbrick/git/commits{/sha}","comments_url":"https://api.github.com/repos/pdamodaran/yellowbrick/comments{/number}","issue_comment_url":"https://api.github.com/repos/pdamodaran/yellowbrick/issues/comments{/number}","contents_url":"https://api.github.com/repos/pdamodaran/yellowbrick/contents/{+path}","compare_url":"https://api.github.com/repos/pdamodaran/yellowbrick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pdamodaran/yellowbrick/merges","archive_url":"https://api.github.com/repos/pdamodaran/yellowbrick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pdamodaran/yellowbrick/downloads","issues_url":"https://api.github.com/repos/pdamodaran/yellowbrick/issues{/number}","pulls_url":"https://api.github.com/repos/pdamodaran/yellowbrick/pulls{/number}","milestones_url":"https://api.github.com/repos/pdamodaran/yellowbrick/milestones{/number}","notifications_url":"https://api.github.com/repos/pdamodaran/yellowbrick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pdamodaran/yellowbrick/labels{/name}","releases_url":"https://api.github.com/repos/pdamodaran/yellowbrick/releases{/id}","deployments_url":"https://api.github.com/repos/pdamodaran/yellowbrick/deployments","created_at":"2018-06-06T17:48:26Z","updated_at":"2018-07-21T03:45:18Z","pushed_at":"2018-07-21T03:45:14Z","git_url":"git://github.com/pdamodaran/yellowbrick.git","ssh_url":"git@github.com:pdamodaran/yellowbrick.git","clone_url":"https://github.com/pdamodaran/yellowbrick.git","svn_url":"https://github.com/pdamodaran/yellowbrick","homepage":"http://www.scikit-yb.org/","size":39517,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"DistrictDataLabs:develop","ref":"develop","sha":"ce1a04de82f400533256ad3accafda24256eae9d","user":{"login":"DistrictDataLabs","id":7107115,"node_id":"MDEyOk9yZ2FuaXphdGlvbjcxMDcxMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7107115?v=4","gravatar_id":"","url":"https://api.github.com/users/DistrictDataLabs","html_url":"https://github.com/DistrictDataLabs","followers_url":"https://api.github.com/users/DistrictDataLabs/followers","following_url":"https://api.github.com/users/DistrictDataLabs/following{/other_user}","gists_url":"https://api.github.com/users/DistrictDataLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/DistrictDataLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DistrictDataLabs/subscriptions","organizations_url":"https://api.github.com/users/DistrictDataLabs/orgs","repos_url":"https://api.github.com/users/DistrictDataLabs/repos","events_url":"https://api.github.com/users/DistrictDataLabs/events{/privacy}","received_events_url":"https://api.github.com/users/DistrictDataLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":59121694,"node_id":"MDEwOlJlcG9zaXRvcnk1OTEyMTY5NA==","name":"yellowbrick","full_name":"DistrictDataLabs/yellowbrick","owner":{"login":"DistrictDataLabs","id":7107115,"node_id":"MDEyOk9yZ2FuaXphdGlvbjcxMDcxMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7107115?v=4","gravatar_id":"","url":"https://api.github.com/users/DistrictDataLabs","html_url":"https://github.com/DistrictDataLabs","followers_url":"https://api.github.com/users/DistrictDataLabs/followers","following_url":"https://api.github.com/users/DistrictDataLabs/following{/other_user}","gists_url":"https://api.github.com/users/DistrictDataLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/DistrictDataLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DistrictDataLabs/subscriptions","organizations_url":"https://api.github.com/users/DistrictDataLabs/orgs","repos_url":"https://api.github.com/users/DistrictDataLabs/repos","events_url":"https://api.github.com/users/DistrictDataLabs/events{/privacy}","received_events_url":"https://api.github.com/users/DistrictDataLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DistrictDataLabs/yellowbrick","description":"Visual analysis and diagnostic tools to facilitate machine learning model selection.","fork":false,"url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick","forks_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/forks","keys_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/teams","hooks_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/hooks","issue_events_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/issues/events{/number}","events_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/events","assignees_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/assignees{/user}","branches_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/branches{/branch}","tags_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/tags","blobs_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/git/refs{/sha}","trees_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/statuses/{sha}","languages_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/languages","stargazers_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/stargazers","contributors_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/contributors","subscribers_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/subscribers","subscription_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/subscription","commits_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/commits{/sha}","git_commits_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/git/commits{/sha}","comments_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/comments{/number}","issue_comment_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/issues/comments{/number}","contents_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/contents/{+path}","compare_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/merges","archive_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/downloads","issues_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/issues{/number}","pulls_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls{/number}","milestones_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/milestones{/number}","notifications_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/labels{/name}","releases_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/releases{/id}","deployments_url":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/deployments","created_at":"2016-05-18T14:12:17Z","updated_at":"2018-07-23T10:42:22Z","pushed_at":"2018-07-23T04:39:11Z","git_url":"git://github.com/DistrictDataLabs/yellowbrick.git","ssh_url":"git@github.com:DistrictDataLabs/yellowbrick.git","clone_url":"https://github.com/DistrictDataLabs/yellowbrick.git","svn_url":"https://github.com/DistrictDataLabs/yellowbrick","homepage":"http://www.scikit-yb.org/","size":39797,"stargazers_count":1437,"watchers_count":1437,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":212,"mirror_url":null,"archived":false,"open_issues_count":115,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":212,"open_issues":115,"watchers":1437,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/518"},"html":{"href":"https://github.com/DistrictDataLabs/yellowbrick/pull/518"},"issue":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/issues/518"},"comments":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/issues/518/comments"},"review_comments":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/518/comments"},"review_comment":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/pulls/518/commits"},"statuses":{"href":"https://api.github.com/repos/DistrictDataLabs/yellowbrick/statuses/87dd60bbb4a443da386d7b837158a4c7c6dda264"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bbengfort"}}