Borrar filtros
Borrar filtros

Convert csv to libsvm format

6 visualizaciones (últimos 30 días)
Nourhan
Nourhan el 15 de Sept. de 2014
Respondida: gaurang solanki el 19 de Feb. de 2021
Hi,
How can I convert csv format into sparse compatible for libsvm format?
  1 comentario
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh el 15 de Sept. de 2014
Hi Nourhan,
What's libsvm format?!
tnx

Iniciar sesión para comentar.

Respuestas (1)

gaurang solanki
gaurang solanki el 19 de Feb. de 2021
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

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by