KevinCoble / AIToolbox

A toolbox of AI modules written in Swift: Graphs/Trees, Support Vector Machines, Neural Networks, PCA, K-Means, Genetic Algorithms
Apache License 2.0
794 stars 87 forks source link

load model with not plist file #23

Open moddedayja opened 5 years ago

moddedayja commented 5 years ago

When creating SVM init by function public init?(loadFrom path: String) svm is nil. because file model is not plist

how to create svm model by other model file (attach file)?
model.zip

Thanks!

KevinCoble commented 5 years ago

For simplicity, I have used a plist read/write method for all model types in the AIToolbox library. It does not read files created by other programs.

The SVM code in AIToolbox is a direct port from the LibSVM C code, which can be found at https://www.csie.ntu.edu.tw/~cjlin/libsvm/

You could add code (possibly use an extension on the SVM class) to read the file into the variables based on the C read routines in that library. If you did that successfully, I would be happy to include a pull-request with that modification to the project.

Your other choice would be to create a plist file from a simple model using AIToolbox, then edit that file and move the arrays from your text file in. I suspect that would be a very troublesome adventure though.