{"action":"created","comment":{"url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/comments/38879109","id":38879109,"diff_hunk":"@@ -37,6 +37,117 @@ def _print_params(self):\n         return s.strip(', ')\n \n \n+class GammaGammaFitter(BaseFitter):\n+    def __init__(self, penalizer_coef=0.):\n+        self.penalizer_coef = penalizer_coef\n+\n+    @staticmethod\n+    def _negative_log_likelihood(params, frequency, avg_monetary_value, penalizer_coef):\n+        if any(i < 0 for i in params):\n+            return np.inf\n+\n+        p, q, v = params\n+\n+        x = frequency.astype('int')\n+        m = avg_monetary_value.astype('int')\n+\n+        p_0 = np.log(special.gamma(p*x+q)) - np.log(special.gamma(p)) - np.log(special.gamma(x)) - np.log(special.gamma(q))\n+        p_1 = q*np.log(v) + (p*x-1)*np.log(m) + p*x*np.log(x) - (p*x+q)*np.log(v + m*x)","path":"lifetimes/estimation.py","position":28,"original_position":28,"commit_id":"9aec6a2b7b96bd3f90c172fa6fc4b5e006081f7c","original_commit_id":"9aec6a2b7b96bd3f90c172fa6fc4b5e006081f7c","user":{"login":"CamDavidsonPilon","id":884032,"avatar_url":"https://avatars.githubusercontent.com/u/884032?v=3","gravatar_id":"","url":"https://api.github.com/users/CamDavidsonPilon","html_url":"https://github.com/CamDavidsonPilon","followers_url":"https://api.github.com/users/CamDavidsonPilon/followers","following_url":"https://api.github.com/users/CamDavidsonPilon/following{/other_user}","gists_url":"https://api.github.com/users/CamDavidsonPilon/gists{/gist_id}","starred_url":"https://api.github.com/users/CamDavidsonPilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CamDavidsonPilon/subscriptions","organizations_url":"https://api.github.com/users/CamDavidsonPilon/orgs","repos_url":"https://api.github.com/users/CamDavidsonPilon/repos","events_url":"https://api.github.com/users/CamDavidsonPilon/events{/privacy}","received_events_url":"https://api.github.com/users/CamDavidsonPilon/received_events","type":"User","site_admin":false},"body":"Ditto here: I believe there is a mistake. I get: \r\n\r\n```\r\nnp.log((v ** q) + (m ** ((p * x) - 1)) * (x ** (p * x))) - ((p * x) + q) * np.log(v + (m * x))\r\n\r\n```\r\n\r\nCan you double check apply logarithms here? \r\n\r\n","created_at":"2015-09-07T20:38:24Z","updated_at":"2015-09-07T20:38:24Z","html_url":"https://github.com/CamDavidsonPilon/lifetimes/pull/22#discussion_r38879109","pull_request_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/comments/38879109"},"html":{"href":"https://github.com/CamDavidsonPilon/lifetimes/pull/22#discussion_r38879109"},"pull_request":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/22","id":43653736,"html_url":"https://github.com/CamDavidsonPilon/lifetimes/pull/22","diff_url":"https://github.com/CamDavidsonPilon/lifetimes/pull/22.diff","patch_url":"https://github.com/CamDavidsonPilon/lifetimes/pull/22.patch","issue_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/22","number":22,"state":"open","locked":false,"title":"CLV estimation","user":{"login":"luke14free","id":166602,"avatar_url":"https://avatars.githubusercontent.com/u/166602?v=3","gravatar_id":"","url":"https://api.github.com/users/luke14free","html_url":"https://github.com/luke14free","followers_url":"https://api.github.com/users/luke14free/followers","following_url":"https://api.github.com/users/luke14free/following{/other_user}","gists_url":"https://api.github.com/users/luke14free/gists{/gist_id}","starred_url":"https://api.github.com/users/luke14free/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luke14free/subscriptions","organizations_url":"https://api.github.com/users/luke14free/orgs","repos_url":"https://api.github.com/users/luke14free/repos","events_url":"https://api.github.com/users/luke14free/events{/privacy}","received_events_url":"https://api.github.com/users/luke14free/received_events","type":"User","site_admin":false},"body":"Hi Cam, here is my work on the Gamma/Gamma model. Let me know what you think","created_at":"2015-08-28T17:50:05Z","updated_at":"2015-09-07T20:38:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36b122835a2df72e890d918c042a6eb837440e9d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/22/commits","review_comments_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/22/comments","review_comment_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/22/comments","statuses_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/statuses/9aec6a2b7b96bd3f90c172fa6fc4b5e006081f7c","head":{"label":"luke14free:cltv_estimation","ref":"cltv_estimation","sha":"9aec6a2b7b96bd3f90c172fa6fc4b5e006081f7c","user":{"login":"luke14free","id":166602,"avatar_url":"https://avatars.githubusercontent.com/u/166602?v=3","gravatar_id":"","url":"https://api.github.com/users/luke14free","html_url":"https://github.com/luke14free","followers_url":"https://api.github.com/users/luke14free/followers","following_url":"https://api.github.com/users/luke14free/following{/other_user}","gists_url":"https://api.github.com/users/luke14free/gists{/gist_id}","starred_url":"https://api.github.com/users/luke14free/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luke14free/subscriptions","organizations_url":"https://api.github.com/users/luke14free/orgs","repos_url":"https://api.github.com/users/luke14free/repos","events_url":"https://api.github.com/users/luke14free/events{/privacy}","received_events_url":"https://api.github.com/users/luke14free/received_events","type":"User","site_admin":false},"repo":{"id":41307411,"name":"lifetimes","full_name":"luke14free/lifetimes","owner":{"login":"luke14free","id":166602,"avatar_url":"https://avatars.githubusercontent.com/u/166602?v=3","gravatar_id":"","url":"https://api.github.com/users/luke14free","html_url":"https://github.com/luke14free","followers_url":"https://api.github.com/users/luke14free/followers","following_url":"https://api.github.com/users/luke14free/following{/other_user}","gists_url":"https://api.github.com/users/luke14free/gists{/gist_id}","starred_url":"https://api.github.com/users/luke14free/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luke14free/subscriptions","organizations_url":"https://api.github.com/users/luke14free/orgs","repos_url":"https://api.github.com/users/luke14free/repos","events_url":"https://api.github.com/users/luke14free/events{/privacy}","received_events_url":"https://api.github.com/users/luke14free/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/luke14free/lifetimes","description":"Lifetime value in Python","fork":true,"url":"https://api.github.com/repos/luke14free/lifetimes","forks_url":"https://api.github.com/repos/luke14free/lifetimes/forks","keys_url":"https://api.github.com/repos/luke14free/lifetimes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/luke14free/lifetimes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/luke14free/lifetimes/teams","hooks_url":"https://api.github.com/repos/luke14free/lifetimes/hooks","issue_events_url":"https://api.github.com/repos/luke14free/lifetimes/issues/events{/number}","events_url":"https://api.github.com/repos/luke14free/lifetimes/events","assignees_url":"https://api.github.com/repos/luke14free/lifetimes/assignees{/user}","branches_url":"https://api.github.com/repos/luke14free/lifetimes/branches{/branch}","tags_url":"https://api.github.com/repos/luke14free/lifetimes/tags","blobs_url":"https://api.github.com/repos/luke14free/lifetimes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/luke14free/lifetimes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/luke14free/lifetimes/git/refs{/sha}","trees_url":"https://api.github.com/repos/luke14free/lifetimes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/luke14free/lifetimes/statuses/{sha}","languages_url":"https://api.github.com/repos/luke14free/lifetimes/languages","stargazers_url":"https://api.github.com/repos/luke14free/lifetimes/stargazers","contributors_url":"https://api.github.com/repos/luke14free/lifetimes/contributors","subscribers_url":"https://api.github.com/repos/luke14free/lifetimes/subscribers","subscription_url":"https://api.github.com/repos/luke14free/lifetimes/subscription","commits_url":"https://api.github.com/repos/luke14free/lifetimes/commits{/sha}","git_commits_url":"https://api.github.com/repos/luke14free/lifetimes/git/commits{/sha}","comments_url":"https://api.github.com/repos/luke14free/lifetimes/comments{/number}","issue_comment_url":"https://api.github.com/repos/luke14free/lifetimes/issues/comments{/number}","contents_url":"https://api.github.com/repos/luke14free/lifetimes/contents/{+path}","compare_url":"https://api.github.com/repos/luke14free/lifetimes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/luke14free/lifetimes/merges","archive_url":"https://api.github.com/repos/luke14free/lifetimes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/luke14free/lifetimes/downloads","issues_url":"https://api.github.com/repos/luke14free/lifetimes/issues{/number}","pulls_url":"https://api.github.com/repos/luke14free/lifetimes/pulls{/number}","milestones_url":"https://api.github.com/repos/luke14free/lifetimes/milestones{/number}","notifications_url":"https://api.github.com/repos/luke14free/lifetimes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/luke14free/lifetimes/labels{/name}","releases_url":"https://api.github.com/repos/luke14free/lifetimes/releases{/id}","created_at":"2015-08-24T14:21:31Z","updated_at":"2015-08-24T14:21:31Z","pushed_at":"2015-09-07T15:56:46Z","git_url":"git://github.com/luke14free/lifetimes.git","ssh_url":"git@github.com:luke14free/lifetimes.git","clone_url":"https://github.com/luke14free/lifetimes.git","svn_url":"https://github.com/luke14free/lifetimes","homepage":"","size":698,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CamDavidsonPilon:master","ref":"master","sha":"6765c786201ad19c8d2bb951359d109182d86c66","user":{"login":"CamDavidsonPilon","id":884032,"avatar_url":"https://avatars.githubusercontent.com/u/884032?v=3","gravatar_id":"","url":"https://api.github.com/users/CamDavidsonPilon","html_url":"https://github.com/CamDavidsonPilon","followers_url":"https://api.github.com/users/CamDavidsonPilon/followers","following_url":"https://api.github.com/users/CamDavidsonPilon/following{/other_user}","gists_url":"https://api.github.com/users/CamDavidsonPilon/gists{/gist_id}","starred_url":"https://api.github.com/users/CamDavidsonPilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CamDavidsonPilon/subscriptions","organizations_url":"https://api.github.com/users/CamDavidsonPilon/orgs","repos_url":"https://api.github.com/users/CamDavidsonPilon/repos","events_url":"https://api.github.com/users/CamDavidsonPilon/events{/privacy}","received_events_url":"https://api.github.com/users/CamDavidsonPilon/received_events","type":"User","site_admin":false},"repo":{"id":28577939,"name":"lifetimes","full_name":"CamDavidsonPilon/lifetimes","owner":{"login":"CamDavidsonPilon","id":884032,"avatar_url":"https://avatars.githubusercontent.com/u/884032?v=3","gravatar_id":"","url":"https://api.github.com/users/CamDavidsonPilon","html_url":"https://github.com/CamDavidsonPilon","followers_url":"https://api.github.com/users/CamDavidsonPilon/followers","following_url":"https://api.github.com/users/CamDavidsonPilon/following{/other_user}","gists_url":"https://api.github.com/users/CamDavidsonPilon/gists{/gist_id}","starred_url":"https://api.github.com/users/CamDavidsonPilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CamDavidsonPilon/subscriptions","organizations_url":"https://api.github.com/users/CamDavidsonPilon/orgs","repos_url":"https://api.github.com/users/CamDavidsonPilon/repos","events_url":"https://api.github.com/users/CamDavidsonPilon/events{/privacy}","received_events_url":"https://api.github.com/users/CamDavidsonPilon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CamDavidsonPilon/lifetimes","description":"Lifetime value in Python","fork":false,"url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes","forks_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/forks","keys_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/teams","hooks_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/hooks","issue_events_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/events{/number}","events_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/events","assignees_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/assignees{/user}","branches_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/branches{/branch}","tags_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/tags","blobs_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/git/refs{/sha}","trees_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/statuses/{sha}","languages_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/languages","stargazers_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/stargazers","contributors_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/contributors","subscribers_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/subscribers","subscription_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/subscription","commits_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/commits{/sha}","git_commits_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/git/commits{/sha}","comments_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/comments{/number}","issue_comment_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/comments{/number}","contents_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/contents/{+path}","compare_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/merges","archive_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/downloads","issues_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues{/number}","pulls_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls{/number}","milestones_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/milestones{/number}","notifications_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/labels{/name}","releases_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/releases{/id}","created_at":"2014-12-29T02:47:57Z","updated_at":"2015-09-06T16:57:39Z","pushed_at":"2015-09-07T15:56:46Z","git_url":"git://github.com/CamDavidsonPilon/lifetimes.git","ssh_url":"git@github.com:CamDavidsonPilon/lifetimes.git","clone_url":"https://github.com/CamDavidsonPilon/lifetimes.git","svn_url":"https://github.com/CamDavidsonPilon/lifetimes","homepage":"","size":1111,"stargazers_count":80,"watchers_count":80,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":3,"forks":14,"open_issues":3,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/22"},"html":{"href":"https://github.com/CamDavidsonPilon/lifetimes/pull/22"},"issue":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/22"},"comments":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/statuses/9aec6a2b7b96bd3f90c172fa6fc4b5e006081f7c"}}}}