*! version 0.0.1 28may2015
help export_svmlight (SJ16-4: st0461)

Title

export_svmlight -- SVM^light data format

Syntax

export_svmlight varlist using filename

import_svmlight using filename [, clip]

Description

svmlight is an SVM software that creates a simple de facto plain text
standard for medium-sized numeric datasets; this was adopted by libsvm. The kind libsvm authors even provide a repository of
datasets in compressed svmlight format (note: this command does not
handle compression; you will need to use an external program for that).

export_svmlight saves the current Stata dataset to disk in
svmlight format. The first variable is used as the outcome variable,
which gets written without an attached column index.

import_svmlight loads the dataset svmlight format into Stata
(clearing the current dataset). The outcome variable will become the first
column.

The svmlight format is designed to hold a single outcome variable and a
sparse set of predictor variables. Exporting and reimporting a dataset
through svmlight will lose your data labels, description, and all other
metadata. Missing data in your dataset will be skipped during export, and
missing "features" will become missing data when imported.

Option

clip tells the importer to silently drop trailing columns if there are
more than matsize allows.

Examples

Loading a dataset

. !wget http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/duke.bz2

. !bunzip2 duke.bz2 -c > duke.svmlight

. import_svmlight using "duke.svmlight"

. list

Saving a dataset

. webuse highschool

. export_svmlight * using "highschool.svmlight"

. type "highschool.svmlight"

Authors

Though the license does not obligate you in any way to do so, if you find
this software useful, we would be curious and appreciative to hear about your
adventures in machine learning with Stata. Thank you.

You can contact us at

Nick Guenther

University of Waterloo

Waterloo, Canada

nguenthe@uwaterloo.ca

Matthias Schonlau

University of Waterloo

Waterloo, Canada

schonlau@uwaterloo.ca

Also see

Article: Stata Journal, volume 16, number 4: st0461

Help: [D] import, [D] export