{"id":520,"date":"2015-02-14T22:46:44","date_gmt":"2015-02-15T03:46:44","guid":{"rendered":"http:\/\/digitallibraryworld.com\/?p=520"},"modified":"2015-02-17T12:14:34","modified_gmt":"2015-02-17T17:14:34","slug":"using-libsvm-with-python-with-pycharm-on-a-mac-osx","status":"publish","type":"post","link":"https:\/\/heisbudi.com\/?p=520","title":{"rendered":"Using LibSVM with Python (with PyCharm) on a Mac OSX"},"content":{"rendered":"<p>In case you are wondering how to use the awesome <a href=\"http:\/\/www.csie.ntu.edu.tw\/~cjlin\/libsvm\/\">LIBSVM<\/a> package with the awesome PyCharm IDE, here is a brief guide:<\/p>\n<p>LIBSVM documentation \u00a0mention you need to<\/p>\n<ul>\n<li><a href=\"http:\/\/www.csie.ntu.edu.tw\/~cjlin\/libsvm\/index.html#download\">Download \u00a0libsvm<\/a>(version 3.2 at the time of this writing)<\/li>\n<li>Extract the zip to a folder. By default, this\u00a0<strong>libsvm-3.20<\/strong><\/li>\n<li>Go to your command prompt, within the extracted directory,\u00a0<strong>libsvm-3.20\/<\/strong>,\u00a0type &#8220;make&#8221;. This will create a file called\u00a0libsvm.so.2. If this doesn&#8217;t work, google how to enable make command on Mac OS.<\/li>\n<li>go to\u00a0<strong>libsvm-3.20\/python<\/strong> directory, type make. This will create 2 files:\u00a0svm.py and svmutil.py<\/li>\n<\/ul>\n<p>Now, within PyCharm, say that you have a folder called <strong>Project\/code\/<\/strong> where your code is stored at this level. Copy\u00a0svm.py and svmutil.py mentioned above to your\u00a0<strong>Project\/code\/\u00a0<\/strong>directory and Copy\u00a0libsvm.so.2 file to your\u00a0<strong>Project\/<\/strong> directory.<\/p>\n<p>From\u00a0<strong>Project\/code\/somefile.py\u00a0<\/strong>python file you can import the svm library with<\/p>\n<pre><em>from svmutil import *<\/em><\/pre>\n<p>That&#8217;s it. You should be all set.<\/p>\n<p>&nbsp;<\/p>\n<div data-counters='1' data-style='square' data-size='regular' data-url='https:\/\/heisbudi.com\/?p=520' data-title='Using LibSVM with Python (with PyCharm) on a Mac OSX' class='linksalpha_container linksalpha_app_3'><a href='\/\/www.linksalpha.com\/share?network='facebook' class='linksalpha_icon_facebook'><\/a><a href='\/\/www.linksalpha.com\/share?network='twitter' class='linksalpha_icon_twitter'><\/a><a href='\/\/www.linksalpha.com\/share?network='googleplus' class='linksalpha_icon_googleplus'><\/a><a href='\/\/www.linksalpha.com\/share?network='mail' class='linksalpha_icon_mail'><\/a><\/div><div data-position='' data-url='https:\/\/heisbudi.com\/?p=520' data-title='Using LibSVM with Python (with PyCharm) on a Mac OSX' class='linksalpha_container linksalpha_app_7'><a href='\/\/www.linksalpha.com\/share?network='facebook' class='linksalpha_icon_facebook'><\/a><a href='\/\/www.linksalpha.com\/share?network='twitter' class='linksalpha_icon_twitter'><\/a><a href='\/\/www.linksalpha.com\/share?network='googleplus' class='linksalpha_icon_googleplus'><\/a><a href='\/\/www.linksalpha.com\/share?network='mail' class='linksalpha_icon_mail'><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>In case you are wondering how to use the awesome LIBSVM package with the awesome PyCharm IDE, here is a brief guide: LIBSVM documentation \u00a0mention you need to Download \u00a0libsvm(version 3.2 at the time of this writing) Extract the zip to a folder. By default, this\u00a0libsvm-3.20 Go to your command prompt, within the extracted directory,\u00a0libsvm-3.20\/,\u00a0type <a class=\"read-more\" href=\"https:\/\/heisbudi.com\/?p=520\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[32,26],"tags":[],"_links":{"self":[{"href":"https:\/\/heisbudi.com\/index.php?rest_route=\/wp\/v2\/posts\/520"}],"collection":[{"href":"https:\/\/heisbudi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/heisbudi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/heisbudi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/heisbudi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=520"}],"version-history":[{"count":5,"href":"https:\/\/heisbudi.com\/index.php?rest_route=\/wp\/v2\/posts\/520\/revisions"}],"predecessor-version":[{"id":525,"href":"https:\/\/heisbudi.com\/index.php?rest_route=\/wp\/v2\/posts\/520\/revisions\/525"}],"wp:attachment":[{"href":"https:\/\/heisbudi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/heisbudi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/heisbudi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}