dummy-link

LIBLINEAR

LIBLINEAR bindings for Julia

Readme

LIBLINEAR

Build Status Build status

Julia bindings for LIBLINEAR.

using RDatasets, LIBLINEAR
using Printf, Statistics

# Load Fisher's classic iris data
iris = dataset("datasets", "iris")

# LIBLINEAR handles multi-class data automatically using a one-against-the rest strategy
labels = iris[:Species]

# First dimension of input data is features; second is instances
data = convert(Matrix, iris[:, 1:4])'

# Train SVM on half of the data using default parameters. See the linear_train
# function in LIBLINEAR.jl for optional parameter settings.
model = linear_train(labels[1:2:end], data[:, 1:2:end], verbose=true);

# Test model on the other half of the data.
(predicted_labels, decision_values) = linear_predict(model, data[:, 2:2:end]);

# Compute accuracy
@printf "Accuracy: %.2f%%\n" mean((predicted_labels .== labels[2:2:end]))*100

Credits

Created by Zhizhong Li.

This package is adapted from the LIBSVM Julia package by Simon Kornblith.

First Commit

10/04/2015

Last Touched

about 2 months ago

Commits

104 commits

Requires: