Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 1.65 KB

SupportVectorMachine.md

File metadata and controls

44 lines (35 loc) · 1.65 KB

SupportVectorMachine

SVM implementations - src.

// Create simple SupportVectorMachine
var inputShape = new Shape(28); // shape of input features
var numClasses = 10; // number of hyperplaces - typically one per category
var lambda = 1e-5f; // update factor for HyperPlane weights

var svmInfo = new SVMInfo(inputShape, numClasses, lambda);
var svm = new SupportVectorMachine(svmInfo);

Gradients

Gradient calculators for HyperPlane weight updates.

Implemented Gradients

  1. Adam
  2. SGD
// Default Values
public Gradient Gradient { get; set; } = Gradient.Adam;
public float LearningRate { get; set; } = .01f;
public float BetaOne { get; set; } = .9f;
public float BetaTwo { get; set; } = .999f;
public float Epsilon { get; set; } = 1e-8f;

// Configure a SupportVectorMachine's Gradient optimizer
var info = new SVMInfo(inputShape, numCategories, 1e-3f);
var svm = new SupportVectorMachine(info, ExecutionStrategy.Sync, new GradientInfo
{
    Gradient = Gradient.SGD,
    LearningRate = 1e-3f
});
        

Example

All pre-built examples using Radiate.Data datasets.

  1. Breast Cancer Classification
  2. Mnist Image Classification