{"action":"created","comment":{"url":"https://api.github.com/repos/taskgraph/taskgraph/pulls/comments/27619969","id":27619969,"diff_hunk":"@@ -0,0 +1,140 @@\n+package bwmf\n+\n+import (\n+\t\"fmt\"\n+\n+\tpb \"github.com/taskgraph/taskgraph/example/bwmf/proto\"\n+\top \"github.com/taskgraph/taskgraph/op\"\n+)\n+\n+// This is an encapsulation for exposing an op.Parameter interface with a pb.DenseMatrix as the underlying data storage.\n+type blockParameter struct {\n+\tk      int\n+\tdata   *map[uint32]*pb.DenseMatrixShard\n+\tstarts []int // for binary search of blockId\n+\tsize   int\n+}\n+\n+func NewBlocksParameter(matrices *map[uint32]*pb.DenseMatrixShard) op.Parameter {\n+\tstt := make([]int, len(*matrices)+1)\n+\tost := 0\n+\tfor i := 0; i < len(*matrices); i++ {\n+\t\tstt[i] = ost\n+\t\tost += len((*matrices)[uint32(i)].Row)\n+\t}\n+\tstt[len(*matrices)] = ost\n+\tk := len((*matrices)[0].Row[0].At)\n+\treturn &blockParameter{k: k, data: matrices, starts: stt, size: k * ost}\n+}\n+\n+func NewSingleBlockParameter(matrix *pb.DenseMatrixShard) op.Parameter {\n+\tk := len(matrix.Row[0].At)\n+\tl := len(matrix.Row)\n+\treturn &blockParameter{k: k, data: &map[uint32]*pb.DenseMatrixShard{0: matrix}, starts: []int{0, l}, size: k * l}\n+}\n+\n+func bsearch(s []int, v int) (int, error) {","path":"example/bwmf/block_parameter.go","position":36,"original_position":36,"commit_id":"3f5bac5d2b28d5b7434ba9d8e238c0c57410459d","original_commit_id":"3f5bac5d2b28d5b7434ba9d8e238c0c57410459d","user":{"login":"fengjingchao","id":920884,"avatar_url":"https://avatars.githubusercontent.com/u/920884?v=3","gravatar_id":"","url":"https://api.github.com/users/fengjingchao","html_url":"https://github.com/fengjingchao","followers_url":"https://api.github.com/users/fengjingchao/followers","following_url":"https://api.github.com/users/fengjingchao/following{/other_user}","gists_url":"https://api.github.com/users/fengjingchao/gists{/gist_id}","starred_url":"https://api.github.com/users/fengjingchao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fengjingchao/subscriptions","organizations_url":"https://api.github.com/users/fengjingchao/orgs","repos_url":"https://api.github.com/users/fengjingchao/repos","events_url":"https://api.github.com/users/fengjingchao/events{/privacy}","received_events_url":"https://api.github.com/users/fengjingchao/received_events","type":"User","site_admin":false},"body":"you can use sort.Search()","created_at":"2015-04-01T22:53:56Z","updated_at":"2015-04-01T22:53:56Z","html_url":"https://github.com/taskgraph/taskgraph/pull/8#discussion_r27619969","pull_request_url":"https://api.github.com/repos/taskgraph/taskgraph/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/taskgraph/taskgraph/pulls/comments/27619969"},"html":{"href":"https://github.com/taskgraph/taskgraph/pull/8#discussion_r27619969"},"pull_request":{"href":"https://api.github.com/repos/taskgraph/taskgraph/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/taskgraph/taskgraph/pulls/8","id":29894879,"html_url":"https://github.com/taskgraph/taskgraph/pull/8","diff_url":"https://github.com/taskgraph/taskgraph/pull/8.diff","patch_url":"https://github.com/taskgraph/taskgraph/pull/8.patch","issue_url":"https://api.github.com/repos/taskgraph/taskgraph/issues/8","number":8,"state":"open","locked":false,"title":"[examples/bwfm] WIP - Block-Wise Matrix Factorization.","user":{"login":"BaiGang","id":241076,"avatar_url":"https://avatars.githubusercontent.com/u/241076?v=3","gravatar_id":"","url":"https://api.github.com/users/BaiGang","html_url":"https://github.com/BaiGang","followers_url":"https://api.github.com/users/BaiGang/followers","following_url":"https://api.github.com/users/BaiGang/following{/other_user}","gists_url":"https://api.github.com/users/BaiGang/gists{/gist_id}","starred_url":"https://api.github.com/users/BaiGang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaiGang/subscriptions","organizations_url":"https://api.github.com/users/BaiGang/orgs","repos_url":"https://api.github.com/users/BaiGang/repos","events_url":"https://api.github.com/users/BaiGang/events{/privacy}","received_events_url":"https://api.github.com/users/BaiGang/received_events","type":"User","site_admin":false},"body":"We will be implementing a distributed matrix factorization program using the fs interface, the task framework and the optimization routines provided by this project. \r\n\r\nBelow is the backlog of this on-going task.\r\n- [x] KL-divergence with smoothness factor.\r\n- [x] Projected gradient methods based optimizer.\r\n- [x] Proto defs of matrix block data and the rpc service.\r\n- [x] Loading sharded row/column matrix using the hdfs interface.\r\n- [x] Preparing `Parameters` using matrix block data.\r\n- [x] Executing the `Optimize` routine.\r\n- [ ] Checkpointing of the intermediate data for each epoch.\r\n- [ ] Signaling completion of updating T/D via `FlagMeta`. Invoking `IncEpoch` in master.\r\n- [ ] NMF test data.\r\n- [ ] Nuisance factors in KL-divergence.","created_at":"2015-02-24T12:58:23Z","updated_at":"2015-04-01T22:53:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3a9030df779f784fdd34daf1d4a92f1b0082932","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/taskgraph/taskgraph/pulls/8/commits","review_comments_url":"https://api.github.com/repos/taskgraph/taskgraph/pulls/8/comments","review_comment_url":"https://api.github.com/repos/taskgraph/taskgraph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/taskgraph/taskgraph/issues/8/comments","statuses_url":"https://api.github.com/repos/taskgraph/taskgraph/statuses/3f5bac5d2b28d5b7434ba9d8e238c0c57410459d","head":{"label":"BaiGang:pgmethod","ref":"pgmethod","sha":"3f5bac5d2b28d5b7434ba9d8e238c0c57410459d","user":{"login":"BaiGang","id":241076,"avatar_url":"https://avatars.githubusercontent.com/u/241076?v=3","gravatar_id":"","url":"https://api.github.com/users/BaiGang","html_url":"https://github.com/BaiGang","followers_url":"https://api.github.com/users/BaiGang/followers","following_url":"https://api.github.com/users/BaiGang/following{/other_user}","gists_url":"https://api.github.com/users/BaiGang/gists{/gist_id}","starred_url":"https://api.github.com/users/BaiGang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaiGang/subscriptions","organizations_url":"https://api.github.com/users/BaiGang/orgs","repos_url":"https://api.github.com/users/BaiGang/repos","events_url":"https://api.github.com/users/BaiGang/events{/privacy}","received_events_url":"https://api.github.com/users/BaiGang/received_events","type":"User","site_admin":false},"repo":{"id":30681702,"name":"taskgraph","full_name":"BaiGang/taskgraph","owner":{"login":"BaiGang","id":241076,"avatar_url":"https://avatars.githubusercontent.com/u/241076?v=3","gravatar_id":"","url":"https://api.github.com/users/BaiGang","html_url":"https://github.com/BaiGang","followers_url":"https://api.github.com/users/BaiGang/followers","following_url":"https://api.github.com/users/BaiGang/following{/other_user}","gists_url":"https://api.github.com/users/BaiGang/gists{/gist_id}","starred_url":"https://api.github.com/users/BaiGang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaiGang/subscriptions","organizations_url":"https://api.github.com/users/BaiGang/orgs","repos_url":"https://api.github.com/users/BaiGang/repos","events_url":"https://api.github.com/users/BaiGang/events{/privacy}","received_events_url":"https://api.github.com/users/BaiGang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BaiGang/taskgraph","description":"A fault tolerant, distributed task driven framework","fork":true,"url":"https://api.github.com/repos/BaiGang/taskgraph","forks_url":"https://api.github.com/repos/BaiGang/taskgraph/forks","keys_url":"https://api.github.com/repos/BaiGang/taskgraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BaiGang/taskgraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BaiGang/taskgraph/teams","hooks_url":"https://api.github.com/repos/BaiGang/taskgraph/hooks","issue_events_url":"https://api.github.com/repos/BaiGang/taskgraph/issues/events{/number}","events_url":"https://api.github.com/repos/BaiGang/taskgraph/events","assignees_url":"https://api.github.com/repos/BaiGang/taskgraph/assignees{/user}","branches_url":"https://api.github.com/repos/BaiGang/taskgraph/branches{/branch}","tags_url":"https://api.github.com/repos/BaiGang/taskgraph/tags","blobs_url":"https://api.github.com/repos/BaiGang/taskgraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BaiGang/taskgraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BaiGang/taskgraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/BaiGang/taskgraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BaiGang/taskgraph/statuses/{sha}","languages_url":"https://api.github.com/repos/BaiGang/taskgraph/languages","stargazers_url":"https://api.github.com/repos/BaiGang/taskgraph/stargazers","contributors_url":"https://api.github.com/repos/BaiGang/taskgraph/contributors","subscribers_url":"https://api.github.com/repos/BaiGang/taskgraph/subscribers","subscription_url":"https://api.github.com/repos/BaiGang/taskgraph/subscription","commits_url":"https://api.github.com/repos/BaiGang/taskgraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/BaiGang/taskgraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/BaiGang/taskgraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/BaiGang/taskgraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/BaiGang/taskgraph/contents/{+path}","compare_url":"https://api.github.com/repos/BaiGang/taskgraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BaiGang/taskgraph/merges","archive_url":"https://api.github.com/repos/BaiGang/taskgraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BaiGang/taskgraph/downloads","issues_url":"https://api.github.com/repos/BaiGang/taskgraph/issues{/number}","pulls_url":"https://api.github.com/repos/BaiGang/taskgraph/pulls{/number}","milestones_url":"https://api.github.com/repos/BaiGang/taskgraph/milestones{/number}","notifications_url":"https://api.github.com/repos/BaiGang/taskgraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BaiGang/taskgraph/labels{/name}","releases_url":"https://api.github.com/repos/BaiGang/taskgraph/releases{/id}","created_at":"2015-02-12T02:38:37Z","updated_at":"2015-03-26T14:40:46Z","pushed_at":"2015-04-01T12:43:42Z","git_url":"git://github.com/BaiGang/taskgraph.git","ssh_url":"git@github.com:BaiGang/taskgraph.git","clone_url":"https://github.com/BaiGang/taskgraph.git","svn_url":"https://github.com/BaiGang/taskgraph","homepage":null,"size":8644,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"taskgraph:master","ref":"master","sha":"c210b574aa79aca2cd2a1485afc9875923e48aa9","user":{"login":"taskgraph","id":9723611,"avatar_url":"https://avatars.githubusercontent.com/u/9723611?v=3","gravatar_id":"","url":"https://api.github.com/users/taskgraph","html_url":"https://github.com/taskgraph","followers_url":"https://api.github.com/users/taskgraph/followers","following_url":"https://api.github.com/users/taskgraph/following{/other_user}","gists_url":"https://api.github.com/users/taskgraph/gists{/gist_id}","starred_url":"https://api.github.com/users/taskgraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskgraph/subscriptions","organizations_url":"https://api.github.com/users/taskgraph/orgs","repos_url":"https://api.github.com/users/taskgraph/repos","events_url":"https://api.github.com/users/taskgraph/events{/privacy}","received_events_url":"https://api.github.com/users/taskgraph/received_events","type":"Organization","site_admin":false},"repo":{"id":30477948,"name":"taskgraph","full_name":"taskgraph/taskgraph","owner":{"login":"taskgraph","id":9723611,"avatar_url":"https://avatars.githubusercontent.com/u/9723611?v=3","gravatar_id":"","url":"https://api.github.com/users/taskgraph","html_url":"https://github.com/taskgraph","followers_url":"https://api.github.com/users/taskgraph/followers","following_url":"https://api.github.com/users/taskgraph/following{/other_user}","gists_url":"https://api.github.com/users/taskgraph/gists{/gist_id}","starred_url":"https://api.github.com/users/taskgraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskgraph/subscriptions","organizations_url":"https://api.github.com/users/taskgraph/orgs","repos_url":"https://api.github.com/users/taskgraph/repos","events_url":"https://api.github.com/users/taskgraph/events{/privacy}","received_events_url":"https://api.github.com/users/taskgraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/taskgraph/taskgraph","description":"A fault tolerant, distributed task driven framework","fork":false,"url":"https://api.github.com/repos/taskgraph/taskgraph","forks_url":"https://api.github.com/repos/taskgraph/taskgraph/forks","keys_url":"https://api.github.com/repos/taskgraph/taskgraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskgraph/taskgraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskgraph/taskgraph/teams","hooks_url":"https://api.github.com/repos/taskgraph/taskgraph/hooks","issue_events_url":"https://api.github.com/repos/taskgraph/taskgraph/issues/events{/number}","events_url":"https://api.github.com/repos/taskgraph/taskgraph/events","assignees_url":"https://api.github.com/repos/taskgraph/taskgraph/assignees{/user}","branches_url":"https://api.github.com/repos/taskgraph/taskgraph/branches{/branch}","tags_url":"https://api.github.com/repos/taskgraph/taskgraph/tags","blobs_url":"https://api.github.com/repos/taskgraph/taskgraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskgraph/taskgraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskgraph/taskgraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskgraph/taskgraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskgraph/taskgraph/statuses/{sha}","languages_url":"https://api.github.com/repos/taskgraph/taskgraph/languages","stargazers_url":"https://api.github.com/repos/taskgraph/taskgraph/stargazers","contributors_url":"https://api.github.com/repos/taskgraph/taskgraph/contributors","subscribers_url":"https://api.github.com/repos/taskgraph/taskgraph/subscribers","subscription_url":"https://api.github.com/repos/taskgraph/taskgraph/subscription","commits_url":"https://api.github.com/repos/taskgraph/taskgraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskgraph/taskgraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskgraph/taskgraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskgraph/taskgraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskgraph/taskgraph/contents/{+path}","compare_url":"https://api.github.com/repos/taskgraph/taskgraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskgraph/taskgraph/merges","archive_url":"https://api.github.com/repos/taskgraph/taskgraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskgraph/taskgraph/downloads","issues_url":"https://api.github.com/repos/taskgraph/taskgraph/issues{/number}","pulls_url":"https://api.github.com/repos/taskgraph/taskgraph/pulls{/number}","milestones_url":"https://api.github.com/repos/taskgraph/taskgraph/milestones{/number}","notifications_url":"https://api.github.com/repos/taskgraph/taskgraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskgraph/taskgraph/labels{/name}","releases_url":"https://api.github.com/repos/taskgraph/taskgraph/releases{/id}","created_at":"2015-02-08T02:19:17Z","updated_at":"2015-03-28T13:05:28Z","pushed_at":"2015-04-01T12:43:42Z","git_url":"git://github.com/taskgraph/taskgraph.git","ssh_url":"git@github.com:taskgraph/taskgraph.git","clone_url":"https://github.com/taskgraph/taskgraph.git","svn_url":"https://github.com/taskgraph/taskgraph","homepage":null,"size":9516,"stargazers_count":26,"watchers_count":26,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":8,"mirror_url":null,"open_issues_count":4,"forks":8,"open_issues":4,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/taskgraph/taskgraph/pulls/8"},"html":{"href":"https://github.com/taskgraph/taskgraph/pull/8"},"issue":{"href":"https://api.github.com/repos/taskgraph/taskgraph/issues/8"},"comments":{"href":"https://api.github.com/repos/taskgraph/taskgraph/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/taskgraph/taskgraph/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/taskgraph/taskgraph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/taskgraph/taskgraph/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/taskgraph/taskgraph/statuses/3f5bac5d2b28d5b7434ba9d8e238c0c57410459d"}}}}