{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5772","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5772/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5772/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5772/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/5772","id":115897966,"number":5772,"title":"Error thrown when using t-SNE with 'cosine' as metric","user":{"login":"KaffeLatte","id":6583154,"avatar_url":"https://avatars.githubusercontent.com/u/6583154?v=3","gravatar_id":"","url":"https://api.github.com/users/KaffeLatte","html_url":"https://github.com/KaffeLatte","followers_url":"https://api.github.com/users/KaffeLatte/followers","following_url":"https://api.github.com/users/KaffeLatte/following{/other_user}","gists_url":"https://api.github.com/users/KaffeLatte/gists{/gist_id}","starred_url":"https://api.github.com/users/KaffeLatte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KaffeLatte/subscriptions","organizations_url":"https://api.github.com/users/KaffeLatte/orgs","repos_url":"https://api.github.com/users/KaffeLatte/repos","events_url":"https://api.github.com/users/KaffeLatte/events{/privacy}","received_events_url":"https://api.github.com/users/KaffeLatte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-09T15:18:17Z","updated_at":"2015-11-09T15:36:29Z","closed_at":null,"body":"Hi,\r\n\r\nWhen I use 'cosine' as metric for sklearn.manifold.tsne I get the following error: \r\n\"ValueError: All distances should be positive, either the metric or precomputed distances given as X are not correct\".\r\n\r\nAs the codomain of cosine distance is [-1,1] all output from pairwise comparison will not be positive.\r\n\r\nFor euclidean distance there is a hard coded solution for keeping distances positive by squaring them (passed as parameter).\r\n\r\nFor cosine distance I suspect that a simply 'absoluting' the values should be a fix to make it run, however seems like there should be a proper understanding of the algorithm before doing a fix (which I currently do not have unfortunately)"},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/155098188","html_url":"https://github.com/scikit-learn/scikit-learn/issues/5772#issuecomment-155098188","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5772","id":155098188,"user":{"login":"KaffeLatte","id":6583154,"avatar_url":"https://avatars.githubusercontent.com/u/6583154?v=3","gravatar_id":"","url":"https://api.github.com/users/KaffeLatte","html_url":"https://github.com/KaffeLatte","followers_url":"https://api.github.com/users/KaffeLatte/followers","following_url":"https://api.github.com/users/KaffeLatte/following{/other_user}","gists_url":"https://api.github.com/users/KaffeLatte/gists{/gist_id}","starred_url":"https://api.github.com/users/KaffeLatte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KaffeLatte/subscriptions","organizations_url":"https://api.github.com/users/KaffeLatte/orgs","repos_url":"https://api.github.com/users/KaffeLatte/repos","events_url":"https://api.github.com/users/KaffeLatte/events{/privacy}","received_events_url":"https://api.github.com/users/KaffeLatte/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T15:36:29Z","updated_at":"2015-11-09T15:36:29Z","body":"This is exactly what my input looks like: \r\narray([[ 0.09167306,  0.09066585],\r\n       [ 0.09133385,  0.09077385],\r\n       [ 0.09176718,  0.09076084],\r\n       [ 0.09245387,  0.09060492],\r\n       [ 0.09150095,  0.09072065],\r\n       [ 0.0967673 ,  0.08904389],\r\n       [ 0.09183362,  0.09067974],\r\n       [ 0.09125591,  0.09079867],\r\n       [ 0.09250068,  0.0914137 ],\r\n       [ 0.0909817 ,  0.09088597],\r\n       [ 0.09112864,  0.09083919],\r\n       [ 0.09127129,  0.09079377],\r\n       [ 0.09172245,  0.09065012],\r\n       [ 0.09142663,  0.09074431],\r\n       [ 0.09805167,  0.08863495],\r\n       [ 0.09121854,  0.09081057],\r\n       [ 0.09177796,  0.09063245],\r\n       [ 0.09156886,  0.09087076],\r\n       [ 0.09269265,  0.09034122],\r\n       [ 0.09136634,  0.09076351],\r\n       [ 0.09399547,  0.08992641],\r\n       [ 0.10255342,  0.08766025],\r\n       [ 0.09143851,  0.09090493],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09092785,  0.09083994],\r\n       [ 0.09192853,  0.09073296],\r\n       [ 0.09185886,  0.09060669],\r\n       [ 0.09105428,  0.09086286],\r\n       [ 0.09240936,  0.09082208],\r\n       [ 0.09284828,  0.09029167],\r\n       [ 0.09101436,  0.09087557],\r\n       [ 0.09196271,  0.08990672],\r\n       [ 0.09265921,  0.09035187],\r\n       [ 0.09175739,  0.09051504],\r\n       [ 0.09163332,  0.09037447],\r\n       [ 0.09151055,  0.09106741],\r\n       [ 0.09380898,  0.08998579],\r\n       [ 0.09241967,  0.09029113],\r\n       [ 0.09512628,  0.08956638],\r\n       [ 0.09366744,  0.09008822],\r\n       [ 0.09127662,  0.09079207],\r\n       [ 0.09522775,  0.08917747],\r\n       [ 0.09091669,  0.09090667],\r\n       [ 0.09091308,  0.09090782],\r\n       [ 0.09128375,  0.0907898 ],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09126985,  0.09079423],\r\n       [ 0.09226533,  0.09071602],\r\n       [ 0.09308521,  0.08984655],\r\n       [ 0.09358604,  0.09005677],\r\n       [ 0.0955665 ,  0.08942621],\r\n       [ 0.09229888,  0.09149478],\r\n       [ 0.09291504,  0.09044462],\r\n       [ 0.09143233,  0.09095439],\r\n       [ 0.09134934,  0.09036695],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09336972,  0.09012565],\r\n       [ 0.09420685,  0.0899133 ],\r\n       [ 0.09176772,  0.09063571],\r\n       [ 0.09285949,  0.0902881 ],\r\n       [ 0.09106962,  0.09092466],\r\n       [ 0.09146598,  0.09073178],\r\n       [ 0.09252208,  0.09014651],\r\n       [ 0.09176437,  0.09063678],\r\n       [ 0.09128573,  0.09078917],\r\n       [ 0.09294534,  0.09026077],\r\n       [ 0.09164598,  0.09067447],\r\n       [ 0.09133896,  0.09077222],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09183748,  0.0906135 ],\r\n       [ 0.09152983,  0.09071145],\r\n       [ 0.09121385,  0.09081206],\r\n       [ 0.09187251,  0.09060235],\r\n       [ 0.09355347,  0.09018397],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09262965,  0.09063861],\r\n       [ 0.09161119,  0.09068555],\r\n       [ 0.09094758,  0.09089684],\r\n       [ 0.09216817,  0.09050821],\r\n       [ 0.09975737,  0.08809187],\r\n       [ 0.09134445,  0.09077048],\r\n       [ 0.09376311,  0.0900004 ],\r\n       [ 0.09157299,  0.09069771],\r\n       [ 0.09115721,  0.09083009],\r\n       [ 0.09329357,  0.08966455],\r\n       [ 0.09113151,  0.09083828],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09121276,  0.0908124 ],\r\n       [ 0.09490713,  0.08938893],\r\n       [ 0.09163985,  0.09052225],\r\n       [ 0.09286909,  0.09030785],\r\n       [ 0.09241624,  0.09020385],\r\n       [ 0.09164079,  0.090516  ],\r\n       [ 0.09300068,  0.09030075],\r\n       [ 0.09229067,  0.09046921],\r\n       [ 0.09645867,  0.0898571 ],\r\n       [ 0.09202203,  0.09070106],\r\n       [ 0.09125591,  0.09079867],\r\n       [ 0.09102737,  0.09087143],\r\n       [ 0.09173248,  0.09038022],\r\n       [ 0.0914672 ,  0.09073139],\r\n       [ 0.09138648,  0.09070819],\r\n       [ 0.09192827,  0.09041669],\r\n       [ 0.09096157,  0.0909359 ],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09103268,  0.09086974],\r\n       [ 0.09237924,  0.09065317],\r\n       [ 0.09200152,  0.09060078],\r\n       [ 0.09151852,  0.09053708],\r\n       [ 0.09339108,  0.08984899],\r\n       [ 0.09340691,  0.09011381],\r\n       [ 0.09167192,  0.09066621],\r\n       [ 0.09090909,  0.09090909],\r\n       [ 0.09224366,  0.09037891],\r\n       [ 0.09163191,  0.09067895],\r\n       [ 0.10316249,  0.08713437],\r\n       [ 0.0917057 ,  0.09143187],\r\n       [ 0.0916372 ,  0.09044672],\r\n       [ 0.09095603,  0.09089415],\r\n       [ 0.091606  ,  0.0906872 ],\r\n       [ 0.10988504,  0.09604037],\r\n       [ 0.09144098,  0.09073091],\r\n       [ 0.09090909,  0.09090909]])"}}