{"action":"created","comment":{"url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/comments/51522911","id":51522911,"diff_hunk":"@@ -171,6 +171,109 @@ def test_scaling_inputs_gives_same_or_similar_results(self):\n         assert abs(bgf_with_large_inputs.conditional_probability_alive(1, scale*2, scale*10) - bgf.conditional_probability_alive(1, 2, 10)) < 10e-5\n \n \n+class TestModifiedBetaGammaFitter():\n \n+    def test_sum_of_scalar_inputs_to_negative_log_likelihood_is_equal_to_array(self):\n+        mbgf = estimation.ModifiedBetaGeoFitter\n+        x = np.array([1,3])\n+        t_x = np.array([2,2])\n+        t = np.array([5,6])\n+        params = [1,1,1,1]\n+        assert mbgf._negative_log_likelihood(params, np.array([x[0]]), np.array([t_x[0]]), np.array([t[0]]), 0) \\\n+             + mbgf._negative_log_likelihood(params, np.array([x[1]]), np.array([t_x[1]]), np.array([t[1]]), 0) \\\n+            == mbgf._negative_log_likelihood(params, x, t_x, t, 0)\n+ \n+    def test_params_out_is_close_to_BTYDplus(self):\n+        \"\"\" See https://github.com/mplatzer/BTYDplus \"\"\"\n+        mbfg = estimation.ModifiedBetaGeoFitter()\n+        mbfg.fit(cdnow_customers['frequency'], cdnow_customers['recency'], cdnow_customers['T'], iterative_fitting=3)\n+        expected = np.array([0.525, 6.183, 0.891, 1.614])","path":"tests/test_estimation.py","position":20,"original_position":20,"commit_id":"42e1edac99652a98456748c789de07fb565559f0","original_commit_id":"42e1edac99652a98456748c789de07fb565559f0","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":":+1: nice! ","created_at":"2016-02-02T04:38:29Z","updated_at":"2016-02-02T04:38:29Z","html_url":"https://github.com/CamDavidsonPilon/lifetimes/pull/45#discussion_r51522911","pull_request_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/comments/51522911"},"html":{"href":"https://github.com/CamDavidsonPilon/lifetimes/pull/45#discussion_r51522911"},"pull_request":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/45","id":57604678,"html_url":"https://github.com/CamDavidsonPilon/lifetimes/pull/45","diff_url":"https://github.com/CamDavidsonPilon/lifetimes/pull/45.diff","patch_url":"https://github.com/CamDavidsonPilon/lifetimes/pull/45.patch","issue_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/45","number":45,"state":"open","locked":false,"title":"Added the ModifiedBetaGammaFitter class and tests","user":{"login":"rhydomako","id":2955572,"avatar_url":"https://avatars.githubusercontent.com/u/2955572?v=3","gravatar_id":"","url":"https://api.github.com/users/rhydomako","html_url":"https://github.com/rhydomako","followers_url":"https://api.github.com/users/rhydomako/followers","following_url":"https://api.github.com/users/rhydomako/following{/other_user}","gists_url":"https://api.github.com/users/rhydomako/gists{/gist_id}","starred_url":"https://api.github.com/users/rhydomako/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhydomako/subscriptions","organizations_url":"https://api.github.com/users/rhydomako/orgs","repos_url":"https://api.github.com/users/rhydomako/repos","events_url":"https://api.github.com/users/rhydomako/events{/privacy}","received_events_url":"https://api.github.com/users/rhydomako/received_events","type":"User","site_admin":false},"body":"This PR would add an implementation of the Modified BG/NBD model. See http://research.sabanciuniv.edu/20/1/stvkaf01939.doc\r\n\r\nThis model is very similar to the BG/NBD model except that it has the customers sampling dropout their drop-out probabilities immediately after their first transaction instead of after a repeat transaction. This means that P(alive) shouldn't be stuck at 1 for one-time only buyers. Apart from that difference, most of the estimates should be very similar to the BG/NBD model.\r\n\r\nDue to the similarity between the two models, for this implementation I've reused a lot of the BetaGammaFitter code with modified coefficients. This ends up feeling like there is a lot of repetition and it is definitely a question if it would make sense to combine the two classes, or just leave them separated.","created_at":"2016-01-29T04:21:05Z","updated_at":"2016-02-02T04:38:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8272d171d13282e54db5a0b0e0ad93d9c0f6f54c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/45/commits","review_comments_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/45/comments","review_comment_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/45/comments","statuses_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/statuses/42e1edac99652a98456748c789de07fb565559f0","head":{"label":"rhydomako:feature/mbg-nbd","ref":"feature/mbg-nbd","sha":"42e1edac99652a98456748c789de07fb565559f0","user":{"login":"rhydomako","id":2955572,"avatar_url":"https://avatars.githubusercontent.com/u/2955572?v=3","gravatar_id":"","url":"https://api.github.com/users/rhydomako","html_url":"https://github.com/rhydomako","followers_url":"https://api.github.com/users/rhydomako/followers","following_url":"https://api.github.com/users/rhydomako/following{/other_user}","gists_url":"https://api.github.com/users/rhydomako/gists{/gist_id}","starred_url":"https://api.github.com/users/rhydomako/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhydomako/subscriptions","organizations_url":"https://api.github.com/users/rhydomako/orgs","repos_url":"https://api.github.com/users/rhydomako/repos","events_url":"https://api.github.com/users/rhydomako/events{/privacy}","received_events_url":"https://api.github.com/users/rhydomako/received_events","type":"User","site_admin":false},"repo":{"id":49784622,"name":"lifetimes","full_name":"rhydomako/lifetimes","owner":{"login":"rhydomako","id":2955572,"avatar_url":"https://avatars.githubusercontent.com/u/2955572?v=3","gravatar_id":"","url":"https://api.github.com/users/rhydomako","html_url":"https://github.com/rhydomako","followers_url":"https://api.github.com/users/rhydomako/followers","following_url":"https://api.github.com/users/rhydomako/following{/other_user}","gists_url":"https://api.github.com/users/rhydomako/gists{/gist_id}","starred_url":"https://api.github.com/users/rhydomako/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhydomako/subscriptions","organizations_url":"https://api.github.com/users/rhydomako/orgs","repos_url":"https://api.github.com/users/rhydomako/repos","events_url":"https://api.github.com/users/rhydomako/events{/privacy}","received_events_url":"https://api.github.com/users/rhydomako/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhydomako/lifetimes","description":"Lifetime value in Python","fork":true,"url":"https://api.github.com/repos/rhydomako/lifetimes","forks_url":"https://api.github.com/repos/rhydomako/lifetimes/forks","keys_url":"https://api.github.com/repos/rhydomako/lifetimes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhydomako/lifetimes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhydomako/lifetimes/teams","hooks_url":"https://api.github.com/repos/rhydomako/lifetimes/hooks","issue_events_url":"https://api.github.com/repos/rhydomako/lifetimes/issues/events{/number}","events_url":"https://api.github.com/repos/rhydomako/lifetimes/events","assignees_url":"https://api.github.com/repos/rhydomako/lifetimes/assignees{/user}","branches_url":"https://api.github.com/repos/rhydomako/lifetimes/branches{/branch}","tags_url":"https://api.github.com/repos/rhydomako/lifetimes/tags","blobs_url":"https://api.github.com/repos/rhydomako/lifetimes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhydomako/lifetimes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhydomako/lifetimes/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhydomako/lifetimes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhydomako/lifetimes/statuses/{sha}","languages_url":"https://api.github.com/repos/rhydomako/lifetimes/languages","stargazers_url":"https://api.github.com/repos/rhydomako/lifetimes/stargazers","contributors_url":"https://api.github.com/repos/rhydomako/lifetimes/contributors","subscribers_url":"https://api.github.com/repos/rhydomako/lifetimes/subscribers","subscription_url":"https://api.github.com/repos/rhydomako/lifetimes/subscription","commits_url":"https://api.github.com/repos/rhydomako/lifetimes/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhydomako/lifetimes/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhydomako/lifetimes/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhydomako/lifetimes/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhydomako/lifetimes/contents/{+path}","compare_url":"https://api.github.com/repos/rhydomako/lifetimes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhydomako/lifetimes/merges","archive_url":"https://api.github.com/repos/rhydomako/lifetimes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhydomako/lifetimes/downloads","issues_url":"https://api.github.com/repos/rhydomako/lifetimes/issues{/number}","pulls_url":"https://api.github.com/repos/rhydomako/lifetimes/pulls{/number}","milestones_url":"https://api.github.com/repos/rhydomako/lifetimes/milestones{/number}","notifications_url":"https://api.github.com/repos/rhydomako/lifetimes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhydomako/lifetimes/labels{/name}","releases_url":"https://api.github.com/repos/rhydomako/lifetimes/releases{/id}","deployments_url":"https://api.github.com/repos/rhydomako/lifetimes/deployments","created_at":"2016-01-16T18:04:17Z","updated_at":"2016-01-16T18:04:17Z","pushed_at":"2016-02-02T03:49:06Z","git_url":"git://github.com/rhydomako/lifetimes.git","ssh_url":"git@github.com:rhydomako/lifetimes.git","clone_url":"https://github.com/rhydomako/lifetimes.git","svn_url":"https://github.com/rhydomako/lifetimes","homepage":"","size":684,"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":"e985668a5b4fed9ddd826c66e12fcf8b3b60a998","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}","deployments_url":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/deployments","created_at":"2014-12-29T02:47:57Z","updated_at":"2016-01-29T00:36:06Z","pushed_at":"2016-02-02T03:49:06Z","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":690,"stargazers_count":113,"watchers_count":113,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":10,"forks":26,"open_issues":10,"watchers":113,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/45"},"html":{"href":"https://github.com/CamDavidsonPilon/lifetimes/pull/45"},"issue":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/45"},"comments":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/CamDavidsonPilon/lifetimes/statuses/42e1edac99652a98456748c789de07fb565559f0"}}}}