{"action":"created","comment":{"url":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/comments/33364367","id":33364367,"diff_hunk":"@@ -5,24 +5,78 @@\n import utils\n from isvc import iSVC\n import numpy as np\n+import isvc_gui as gui\n \n clf = iSVC(display=True, gamma=1)\n #generate data\n X, y = utils.gen_noise_gauss(100)\n+n = np.size(X,0)\n big_x, big_y = utils.getBoxbyX(X, grid=30)\n big_xy = np.c_[big_x.reshape(big_x.size, 1), big_y.reshape(big_x.size, 1)]\n+# add supervised labels\n+y_semisupervised= np.zeros((n,1))\n+n_perm = np.random.permutation(n) # random partition for labeling\n+\n+labeled_fraction = 0.1\n+\n+num_labels = int(np.ceil(labeled_fraction*n)) # number of labeled examples based on the fraction of dataset size\n+print \"Number of labels used: \" + str(num_labels)\n+y_semisupervised[n_perm[0:num_labels]] = y[n_perm[0:num_labels]].reshape(num_labels,1) # label selected examples\n+#x_labeled = X[n_perm[0:num_labels], :]\n+#y_labeled = y[n_perm[0:num_labels]]\n+x_labeled_normal = X[np.where(y_semisupervised==-1)[0], :]\n+x_labeled_anomaly = X[np.where(y_semisupervised==1)[0],:]\n+x_labeled_unknown = X[np.where(y_semisupervised==0)[0],:]\n+\n #build SVC model\n-clf.fit(X)\n+#clf.fit(X, y_semisupervised)\n # distance to center a\n-dist_all = clf.decision_function(big_xy)\n+#dist_all = clf.decision_function(big_xy)\n # plot\n-outliers = X[clf.bsv_ind, :]\n-plt.plot(X[clf.inside_ind, 0], X[clf.inside_ind, 1], 'ko', mfc='None')\n-# plt.plot(X[clf.sv_ind, 0], X[clf.sv_ind, 1], 'bo')\n-# plt.plot(X[clf.sv_ind, 0], X[clf.sv_ind, 1], 'o', markerfacecolor='None', ms=12, markeredgewidth=1.5, markeredgecolor='k')\n-plt.plot(X[clf.bsv_ind, 0], X[clf.bsv_ind, 1], 'ks', mfc='None')\n-plt.plot(X[clf.bsv_ind, 0], X[clf.bsv_ind, 1], 'kx', mfc='None')\n-plt.contourf(big_x,big_y,dist_all.reshape(big_x.shape), 100, cmap='bone_r', alpha=0.2)\n-plt.contour(big_x,big_y,dist_all.reshape(big_x.shape), [clf.r], colors='k')\n-utils.setAxSquare(plt.gca())\n-plt.show()\n\\ No newline at end of file\n+#outliers = X[clf.bsv_ind, :]\n+\n+\n+#print \"Number of support vectors: \" + str(np.size(clf.sv_ind,0))\n+#print \"Number of inside points: \" + str(np.size(clf.inside_ind,0))\n+#print \"Number of outside points: \" + str(np.size(clf.bsv_ind,0))\n+\n+# plt.plot(X[clf.bsv_ind, 0], X[clf.bsv_ind, 1], 'bo')\n+# plt.plot(X[clf.inside_ind, 0], X[clf.inside_ind, 1], 'go')\n+# plt.plot(X[clf.sv_ind, 0], X[clf.sv_ind, 1], 'ro')\n+#\n+# plt.plot(x_labeled_normal[:,0], x_labeled_normal[:,1], 'g*', markersize=12)\n+# plt.plot(x_labeled_anomaly[:,0], x_labeled_anomaly[:,1], 'b*', markersize=12)\n+# plt.contourf(big_x,big_y,dist_all.reshape(big_x.shape), 100, cmap='bone_r', alpha=0.2)\n+# plt.contour(big_x,big_y,dist_all.reshape(big_x.shape), [clf.r], colors='k')\n+# utils.setAxSquare(plt.gca())\n+# plt.show()\n+\n+model = gui.Model()\n+ctrl = gui.Controller(model)\n+# View\n+root = gui.Tk()\n+root.title(\"iSVC Demo\")\n+view = gui.View(root, ctrl)\n+model.views.append(view)\n+\n+\n+for anomaly in x_labeled_anomaly:","path":"Python/test_isvc.py","position":72,"original_position":72,"commit_id":"901861306df40e09c443f4db69901c6864786f73","original_commit_id":"901861306df40e09c443f4db69901c6864786f73","user":{"login":"feuerchop","id":1778236,"avatar_url":"https://avatars.githubusercontent.com/u/1778236?v=3","gravatar_id":"","url":"https://api.github.com/users/feuerchop","html_url":"https://github.com/feuerchop","followers_url":"https://api.github.com/users/feuerchop/followers","following_url":"https://api.github.com/users/feuerchop/following{/other_user}","gists_url":"https://api.github.com/users/feuerchop/gists{/gist_id}","starred_url":"https://api.github.com/users/feuerchop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feuerchop/subscriptions","organizations_url":"https://api.github.com/users/feuerchop/orgs","repos_url":"https://api.github.com/users/feuerchop/repos","events_url":"https://api.github.com/users/feuerchop/events{/privacy}","received_events_url":"https://api.github.com/users/feuerchop/received_events","type":"User","site_admin":false},"body":"this is not supposed to be called outside of GUI. ","created_at":"2015-06-26T15:09:08Z","updated_at":"2015-06-26T15:09:08Z","html_url":"https://github.com/feuerchop/IndicativeSVC/pull/4#discussion_r33364367","pull_request_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/comments/33364367"},"html":{"href":"https://github.com/feuerchop/IndicativeSVC/pull/4#discussion_r33364367"},"pull_request":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/4","id":38657407,"html_url":"https://github.com/feuerchop/IndicativeSVC/pull/4","diff_url":"https://github.com/feuerchop/IndicativeSVC/pull/4.diff","patch_url":"https://github.com/feuerchop/IndicativeSVC/pull/4.patch","issue_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues/4","number":4,"state":"open","locked":false,"title":"first commit","user":{"login":"bojankolosnjaji","id":658738,"avatar_url":"https://avatars.githubusercontent.com/u/658738?v=3","gravatar_id":"","url":"https://api.github.com/users/bojankolosnjaji","html_url":"https://github.com/bojankolosnjaji","followers_url":"https://api.github.com/users/bojankolosnjaji/followers","following_url":"https://api.github.com/users/bojankolosnjaji/following{/other_user}","gists_url":"https://api.github.com/users/bojankolosnjaji/gists{/gist_id}","starred_url":"https://api.github.com/users/bojankolosnjaji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bojankolosnjaji/subscriptions","organizations_url":"https://api.github.com/users/bojankolosnjaji/orgs","repos_url":"https://api.github.com/users/bojankolosnjaji/repos","events_url":"https://api.github.com/users/bojankolosnjaji/events{/privacy}","received_events_url":"https://api.github.com/users/bojankolosnjaji/received_events","type":"User","site_admin":false},"body":"Added supervised information and connected the test script to the gui.","created_at":"2015-06-26T14:56:38Z","updated_at":"2015-06-26T15:09:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"449b558c7fbeb72f382b5983d0b24c17a9db0a87","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/4/commits","review_comments_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/4/comments","review_comment_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/comments{/number}","comments_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues/4/comments","statuses_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/statuses/901861306df40e09c443f4db69901c6864786f73","head":{"label":"feuerchop:isvc-with-supervised-info","ref":"isvc-with-supervised-info","sha":"901861306df40e09c443f4db69901c6864786f73","user":{"login":"feuerchop","id":1778236,"avatar_url":"https://avatars.githubusercontent.com/u/1778236?v=3","gravatar_id":"","url":"https://api.github.com/users/feuerchop","html_url":"https://github.com/feuerchop","followers_url":"https://api.github.com/users/feuerchop/followers","following_url":"https://api.github.com/users/feuerchop/following{/other_user}","gists_url":"https://api.github.com/users/feuerchop/gists{/gist_id}","starred_url":"https://api.github.com/users/feuerchop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feuerchop/subscriptions","organizations_url":"https://api.github.com/users/feuerchop/orgs","repos_url":"https://api.github.com/users/feuerchop/repos","events_url":"https://api.github.com/users/feuerchop/events{/privacy}","received_events_url":"https://api.github.com/users/feuerchop/received_events","type":"User","site_admin":false},"repo":{"id":37600014,"name":"IndicativeSVC","full_name":"feuerchop/IndicativeSVC","owner":{"login":"feuerchop","id":1778236,"avatar_url":"https://avatars.githubusercontent.com/u/1778236?v=3","gravatar_id":"","url":"https://api.github.com/users/feuerchop","html_url":"https://github.com/feuerchop","followers_url":"https://api.github.com/users/feuerchop/followers","following_url":"https://api.github.com/users/feuerchop/following{/other_user}","gists_url":"https://api.github.com/users/feuerchop/gists{/gist_id}","starred_url":"https://api.github.com/users/feuerchop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feuerchop/subscriptions","organizations_url":"https://api.github.com/users/feuerchop/orgs","repos_url":"https://api.github.com/users/feuerchop/repos","events_url":"https://api.github.com/users/feuerchop/events{/privacy}","received_events_url":"https://api.github.com/users/feuerchop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/feuerchop/IndicativeSVC","description":"Support Vector Clustering with minor supervised labels","fork":false,"url":"https://api.github.com/repos/feuerchop/IndicativeSVC","forks_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/forks","keys_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/teams","hooks_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/hooks","issue_events_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues/events{/number}","events_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/events","assignees_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/assignees{/user}","branches_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/branches{/branch}","tags_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/tags","blobs_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/refs{/sha}","trees_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/statuses/{sha}","languages_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/languages","stargazers_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/stargazers","contributors_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/contributors","subscribers_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/subscribers","subscription_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/subscription","commits_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/commits{/sha}","git_commits_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/commits{/sha}","comments_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/comments{/number}","issue_comment_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues/comments{/number}","contents_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/contents/{+path}","compare_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/merges","archive_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/downloads","issues_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues{/number}","pulls_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls{/number}","milestones_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/milestones{/number}","notifications_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/labels{/name}","releases_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/releases{/id}","created_at":"2015-06-17T14:30:48Z","updated_at":"2015-06-17T14:37:12Z","pushed_at":"2015-06-26T14:56:38Z","git_url":"git://github.com/feuerchop/IndicativeSVC.git","ssh_url":"git@github.com:feuerchop/IndicativeSVC.git","clone_url":"https://github.com/feuerchop/IndicativeSVC.git","svn_url":"https://github.com/feuerchop/IndicativeSVC","homepage":null,"size":14000,"stargazers_count":0,"watchers_count":0,"language":"Matlab","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"feuerchop:master","ref":"master","sha":"93a06e5e86dec01f80d0a5db4633c53566d6ba0f","user":{"login":"feuerchop","id":1778236,"avatar_url":"https://avatars.githubusercontent.com/u/1778236?v=3","gravatar_id":"","url":"https://api.github.com/users/feuerchop","html_url":"https://github.com/feuerchop","followers_url":"https://api.github.com/users/feuerchop/followers","following_url":"https://api.github.com/users/feuerchop/following{/other_user}","gists_url":"https://api.github.com/users/feuerchop/gists{/gist_id}","starred_url":"https://api.github.com/users/feuerchop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feuerchop/subscriptions","organizations_url":"https://api.github.com/users/feuerchop/orgs","repos_url":"https://api.github.com/users/feuerchop/repos","events_url":"https://api.github.com/users/feuerchop/events{/privacy}","received_events_url":"https://api.github.com/users/feuerchop/received_events","type":"User","site_admin":false},"repo":{"id":37600014,"name":"IndicativeSVC","full_name":"feuerchop/IndicativeSVC","owner":{"login":"feuerchop","id":1778236,"avatar_url":"https://avatars.githubusercontent.com/u/1778236?v=3","gravatar_id":"","url":"https://api.github.com/users/feuerchop","html_url":"https://github.com/feuerchop","followers_url":"https://api.github.com/users/feuerchop/followers","following_url":"https://api.github.com/users/feuerchop/following{/other_user}","gists_url":"https://api.github.com/users/feuerchop/gists{/gist_id}","starred_url":"https://api.github.com/users/feuerchop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feuerchop/subscriptions","organizations_url":"https://api.github.com/users/feuerchop/orgs","repos_url":"https://api.github.com/users/feuerchop/repos","events_url":"https://api.github.com/users/feuerchop/events{/privacy}","received_events_url":"https://api.github.com/users/feuerchop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/feuerchop/IndicativeSVC","description":"Support Vector Clustering with minor supervised labels","fork":false,"url":"https://api.github.com/repos/feuerchop/IndicativeSVC","forks_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/forks","keys_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/teams","hooks_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/hooks","issue_events_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues/events{/number}","events_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/events","assignees_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/assignees{/user}","branches_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/branches{/branch}","tags_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/tags","blobs_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/refs{/sha}","trees_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/statuses/{sha}","languages_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/languages","stargazers_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/stargazers","contributors_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/contributors","subscribers_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/subscribers","subscription_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/subscription","commits_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/commits{/sha}","git_commits_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/git/commits{/sha}","comments_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/comments{/number}","issue_comment_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues/comments{/number}","contents_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/contents/{+path}","compare_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/merges","archive_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/downloads","issues_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues{/number}","pulls_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls{/number}","milestones_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/milestones{/number}","notifications_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/labels{/name}","releases_url":"https://api.github.com/repos/feuerchop/IndicativeSVC/releases{/id}","created_at":"2015-06-17T14:30:48Z","updated_at":"2015-06-17T14:37:12Z","pushed_at":"2015-06-26T14:56:38Z","git_url":"git://github.com/feuerchop/IndicativeSVC.git","ssh_url":"git@github.com:feuerchop/IndicativeSVC.git","clone_url":"https://github.com/feuerchop/IndicativeSVC.git","svn_url":"https://github.com/feuerchop/IndicativeSVC","homepage":null,"size":14000,"stargazers_count":0,"watchers_count":0,"language":"Matlab","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/4"},"html":{"href":"https://github.com/feuerchop/IndicativeSVC/pull/4"},"issue":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues/4"},"comments":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/feuerchop/IndicativeSVC/statuses/901861306df40e09c443f4db69901c6864786f73"}}}}