LIBSVM Conversion of data formats

Source: Internet
Author: User
Tags svm

LIBSVM Conversion of data formats:

Data has many storage formats, TXT format, XLS format, data format, CSV format, and so on, these data formats can be converted to each other, here to introduce *. xls, *.txt How to generate data in LIBSVM format.

There are two ways to generate LIBSVM data, which is described using the FORMATDATALIBSVM tool because it is intuitive, efficient and easy to use. Actually just took advantage of the Excel macro.

I.. xls format conversion in-->SVM format

① Download Formatdatalibsvm.xls address as follows:

http://download.csdn.net/detail/smilehehe110/9702456

② preparing the Excel data set

If it is in CSV format, you can first convert it to. xls format via Excel, as described below.

③ Open Formatdatalibsvm.xls

Note A box appears above to remind you that the macro has been disabled, make sure to click Change, Enable Macros .

④ Loading Data

You can copy the data directly to the TopLeft cell, paying attention to copying only the data region -related properties, not copying the property names , or it will crash.

⑤ Conversion

Click on the Excel interface

macros, tools, macro, ->formatdatatolibsvm–> execution

View macros, view macro,-->formatdatatolibsvm–> execution

You can see that the data is being converted and moved, and you can see that the data becomes the LIBSVM format in just a minute.

When the data conversion is complete, save the file as a. txt file. Then the problem of data conversion is solved.

csv and XLS conversions

Sometimes when you start to get the data in CSV format, you want to convert it to excel in the original format, which can be done in the following ways:

② open Excel and create a new blank document.

② in the interface, click Data, from text. Locate and select the CSV file "source file. csv" and click "Import".

The operation will pop up a window without any action, click Next.

③ the next interface according to the delimiter type to select the appropriate symbol, such as commas, semicolons, etc., select Click Next

③ then click Next, if you need to change the data format to make adjustments.

④ Click Finish, pop up a window, choose the location of the data, complete the operation, you can see the data into the most original XLS format.

Ii.. txt format-->SVM format conversion

First of all, the text data mentioned here refers to data files with commas, spaces, comma, semicolons and other data separation symbols. Because it is separated by a symbol, all data items are categorized as an attribute and cannot be entered in the format of the above 2 steps, and the output of the correct result format cannot be achieved.

To solve this problem, the most significant difference between the conversion process and the above process is:

When opening the. txt file, the separated symbols of comma, semicolon, tab , etc. are removed according to the data characteristics of the text data itself.

Specifically, convert run formatdatalibsvm.xls, file , open , select the data.txt file you want to open, Then, in the Text Import Wizard, according to the data characteristics of the Data.txt file itself, select " raw data type (separator symbol)"; then select the type of the delimited symbol (the purpose is to divide the data into separate columns of data, the separation succeeds, You can see a column of columns separating separate data in the data preview: Select "Column data Format" ( General ) to complete, just adjust the data format of the above procedure and repeat steps 2 and 3 after it.

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.