34 lines · 746 B · Text
RawDownload
//------------------------------------------------------------------------------// name: svm-basic.ck// desc: basic support vector machine example (SVM)//// version: need chuck version 1.5.0.0 or higher// sorting: part of ChAI (ChucK for AI)//// uncomment the next line to learn more about the KNN object:// HMM.help();//// author: Yikai Li// date: Spring 2023//------------------------------------------------------------------------------ // instanceSVM svm; // prepare data[[1.0, 1.0], [2.0, 2.0], [3.0, 3.0]] @=> float x[][];[[1.0], [2.0], [3.0]] @=> float y[][]; // train// <<< "training...", "" >>>;svm.train(x, y); // testfloat res[1];// <<< "predicting...", "" >>>;svm.predict([1.5, 1.5], res);<<< res[0] >>>;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t