All Projects → JuliaML → LIBSVM.jl

JuliaML / LIBSVM.jl

Licence: other
LIBSVM bindings for Julia

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to LIBSVM.jl

Machine learning code
机器学习与深度学习算法示例
Stars: ✭ 88 (+18.92%)
Mutual labels:  svm, regression
No-Reference-Image-Quality-Assessment-using-BRISQUE-Model
Implementation of the paper "No Reference Image Quality Assessment in the Spatial Domain" by A Mittal et al. in OpenCV (using both C++ and Python)
Stars: ✭ 137 (+85.14%)
Mutual labels:  svm, libsvm
regression-stock-prediction
Predicting Google’s stock price using regression
Stars: ✭ 54 (-27.03%)
Mutual labels:  svm, regression
Machine Learning
⚡机器学习实战(Python3):kNN、决策树、贝叶斯、逻辑回归、SVM、线性回归、树回归
Stars: ✭ 5,601 (+7468.92%)
Mutual labels:  svm, regression
Tensorflow cookbook
Code for Tensorflow Machine Learning Cookbook
Stars: ✭ 5,984 (+7986.49%)
Mutual labels:  svm, regression
Machine Learning In Action
⚡️⚡️⚡️《机器学习实战》代码(基于Python3)🚀
Stars: ✭ 533 (+620.27%)
Mutual labels:  svm, regression
Fuku Ml
Simple machine learning library / 簡單易用的機器學習套件
Stars: ✭ 280 (+278.38%)
Mutual labels:  svm, regression
Ailearning
AiLearning: 机器学习 - MachineLearning - ML、深度学习 - DeepLearning - DL、自然语言处理 NLP
Stars: ✭ 32,316 (+43570.27%)
Mutual labels:  svm, regression
Tiny ml
numpy 实现的 周志华《机器学习》书中的算法及其他一些传统机器学习算法
Stars: ✭ 129 (+74.32%)
Mutual labels:  svm, regression
ml course
"Learning Machine Learning" Course, Bogotá, Colombia 2019 #LML2019
Stars: ✭ 22 (-70.27%)
Mutual labels:  regression
pycobra
python library implementing ensemble methods for regression, classification and visualisation tools including Voronoi tesselations.
Stars: ✭ 111 (+50%)
Mutual labels:  regression
lyapy
Library for simulation of nonlinear control systems, control design, and Lyapunov-based learning.
Stars: ✭ 35 (-52.7%)
Mutual labels:  regression
Regression
Multiple Regression Package for PHP
Stars: ✭ 88 (+18.92%)
Mutual labels:  regression
econtools
Econometrics and data manipulation functions.
Stars: ✭ 96 (+29.73%)
Mutual labels:  regression
TextClassification
基于scikit-learn实现对新浪新闻的文本分类,数据集为100w篇文档,总计10类,测试集与训练集1:1划分。分类算法采用SVM和Bayes,其中Bayes作为baseline。
Stars: ✭ 86 (+16.22%)
Mutual labels:  svm
ML-Experiments
整理记录本人担任课程助教设计的四个机器学习实验,主要涉及简单的线性回归、朴素贝叶斯分类器、支持向量机、CNN做文本分类。内附实验指导书、讲解PPT、参考代码,欢迎各位码友讨论交流。
Stars: ✭ 85 (+14.86%)
Mutual labels:  svm
pyowl
Ordered Weighted L1 regularization for classification and regression in Python
Stars: ✭ 52 (-29.73%)
Mutual labels:  regression
prediction
Tidy, Type-Safe 'prediction()' Methods
Stars: ✭ 86 (+16.22%)
Mutual labels:  regression
cheapml
Machine Learning algorithms coded from scratch
Stars: ✭ 17 (-77.03%)
Mutual labels:  regression
Deception-Detection-on-Amazon-reviews-dataset
A SVM model that classifies the reviews as real or fake. Used both the review text and the additional features contained in the data set to build a model that predicted with over 85% accuracy without using any deep learning techniques.
Stars: ✭ 42 (-43.24%)
Mutual labels:  svm

LIBSVM.jl

Build Status codecov

This is a Julia interface for LIBSVM and for the linear SVM model provided by LIBLINEAR.

Features:

  • Supports all LIBSVM models: classification C-SVC, nu-SVC, regression: epsilon-SVR, nu-SVR and distribution estimation: one-class SVM
  • Model objects are represented by Julia type SVM which gives you easy access to model features and can be saved e.g. as JLD file
  • Supports ScikitLearn.jl API

Usage

LIBSVM API

This provides a lower level API similar to LIBSVM C-interface. See ?svmtrain for options.

using LIBSVM
using RDatasets
using Printf
using Statistics

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

# First four dimension of input data is features
X = Matrix(iris[:, 1:4])'

# LIBSVM handles multi-class data automatically using a one-against-one strategy
y = iris.Species

# Split the dataset into training set and testing set
Xtrain = X[:, 1:2:end]
Xtest  = X[:, 2:2:end]
ytrain = y[1:2:end]
ytest  = y[2:2:end]

# Train SVM on half of the data using default parameters. See documentation
# of svmtrain for options
model = svmtrain(Xtrain, ytrain)

# Test model on the other half of the data.
ŷ, decision_values = svmpredict(model, Xtest);

# Compute accuracy
@printf "Accuracy: %.2f%%\n" mean.== ytest) * 100

Precomputed kernel

It is possible to use different kernels than those that are provided. In such a case, it is required to provide a matrix filled with precomputed kernel values.

For training, a symmetric matrix is expected:

K = [k(x_1, x_1)  k(x_1, x_2)  ...  k(x_1, x_l);
     k(x_2, x_1)
         ...                            ...
     k(x_l, x_1)        ...         k(x_l, x_l)]

where x_i is i-th training instance and l is the number of training instances.

To predict n instances, a matrix of shape (l, n) is expected:

KK = [k(x_1, t_1)  k(x_1, t_2)  ...  k(x_1, t_n);
      k(x_2, t_1)
          ...                            ...
      k(x_l, t_1)        ...         k(x_l, t_n)]

where t_i is i-th instance to be predicted.

Example

# Training data
X = [-2 -1 -1 1 1 2;
     -1 -1 -2 1 2 1]
y = [1, 1, 1, 2, 2, 2]

# Testing data
T = [-1 2 3;
     -1 2 2]

# Precomputed matrix for training (corresponds to linear kernel)
K = X' * X

model = svmtrain(K, y, kernel=Kernel.Precomputed)

# Precomputed matrix for prediction
KK = X' * T

ỹ, _ = svmpredict(model, KK)

ScikitLearn API

You can alternatively use ScikitLearn.jl API with same options as svmtrain:

using LIBSVM
using RDatasets

# Classification C-SVM
iris = dataset("datasets", "iris")
X = Matrix(iris[:, 1:4])
y = iris.Species

Xtrain = X[1:2:end, :]
Xtest  = X[2:2:end, :]
ytrain = y[1:2:end]
ytest  = y[2:2:end]

model = fit!(SVC(), Xtrain, ytrain)
ŷ = predict(model, Xtest)
# Epsilon-Regression

whiteside = RDatasets.dataset("MASS", "whiteside")
X = Matrix(whiteside[:, 3:3])  # the `Gas` column
y = whiteside.Temp

model = fit!(EpsilonSVR(cost = 10., gamma = 1.), X, y)
ŷ = predict(model, X)

MLJ API

The MLJ interface to LIBSVM.jl consists of the following models:

  • classification: LinearSVC, SVC, NuSVC
  • regression: EpsilonSVR, NuSVR
  • outlier detection: OneClassSVM

Each model has a detailed document string, which includes examples of usage. Document strings can be accessed from MLJ without loading LIBSVM.jl (or its MLJ interface) as shown in the following example:

using MLJ     # or MLJModels 
doc("NuSVC", pkg="LIBSVM")

This assumes the version of MLJModels loaded is 0.15.5 or higher.

Credits

The LIBSVM.jl library is currently developed and maintained by Matti Pastell. It was originally developed by Simon Kornblith.

LIBSVM by Chih-Chung Chang and Chih-Jen Lin

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].