Go Use of LIBSVM-3.18 in Python environment

Source: Internet
Author: User

http://blog.csdn.net/lj695242104/article/details/39500039

1) Install Python and go directly to the official website

2) Run "cmd" and enter Python directly to see if Python is 32-bit or 64-bit

2.1 If Python is 32-bit, locate the dynamic-link library Libsvm.dll (size:156.5kb) in the WINDOWS folder under the Libsvm-3.16 folder and add it to the system directory, such as ' C:\WINDOWS\system32\ ' , you can use LIBSVM in Python

2.2 If Python is 64-bit, you need to compile the 64-bit dynamic link library libsvm.dll yourself first. Here's how:

In the Programs list, under Microsoft Visual Studio 2012/visual Studio Tools, open VS2012 x64 cross Toolscommand Prompt, note that you must be 64-bit command Prompt.

(At this point, you may encounter an error: "Error cannot determine the location of the VS Common Tools Folder", do not panic, I am win7 64-bit system, installed VS2012, solve The method of this problem is: in the computer environment variable, the variable path setting value: C:\Windows\System32)


Dos to LIBSVM folder libsvm-3.16
Input nmake-f Makefile.win Clean all
A 64-bit dynamic-link library will be generated under the Windows directory of libsvm-3.16 (SIZE:192KB). Copy the newly generated libsvm.dll to the system directory (for example, ' C:\WINDOWS\system32\ ').



3) Testing
Open Idle
>>>import OS
>>>os.chdir (' E:\Software\LIBSVM\libsvm-3.18\python ')
>>>from Svmutil Import *
>>> y, x = Svm_read_problem (' ... /heart_scale ')
>>> m = Svm_train (y[:200], x[:200], '-C 4 ')
>>> P_label, P_ACC, P_val = Svm_predict (y[200:], x[200:], m)
accuracy = 84.2857% (59/70) (classification)

Get...

reference:http://blog.csdn.net/lqhbupt/article/details/8599295

Top
0

Go Use of LIBSVM-3.18 in Python environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.