필터 지우기
필터 지우기

Convert csv to libsvm format

조회 수: 6 (최근 30일)
Nourhan
Nourhan 2014년 9월 15일
답변: gaurang solanki 2021년 2월 19일
Hi,
How can I convert csv format into sparse compatible for libsvm format?
  댓글 수: 1
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2014년 9월 15일
Hi Nourhan,
What's libsvm format?!
tnx

댓글을 달려면 로그인하십시오.

답변 (1개)

gaurang solanki
gaurang solanki 2021년 2월 19일
Q: How to convert other data formats to LIBSVM format?
It depends on your data format. A simple way is to use libsvmwrite in the libsvm matlab/octave interface. Take a CSV (comma-separated values) file in UCI machine learning repository as an example. We download SPECTF.train. Labels are in the first column. The following steps produce a file in the libsvm format.
matlab> SPECTF = csvread('SPECTF.train'); % read a csv file
matlab> labels = SPECTF(:, 1); % labels from the 1st column
matlab> features = SPECTF(:, 2:end);
matlab> features_sparse = sparse(features); % features must be in a sparse matrix
matlab> libsvmwrite('SPECTFlibsvm.train', labels, features_sparse);
The tranformed data are stored in SPECTFlibsvm.train.
Alternatively, you can use convert.c to convert CSV format to libsvm format.
LINK :--- https://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by