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
792 stars 87 forks source link

DeepNetwork vs MetalNeuralNetwork #11

Open heuism opened 7 years ago

heuism commented 7 years ago

Can i ask which one is better and the difference between these two?

By the way, regarding SVM, can we choose between different kernels like Linear or something?

Thanks @KevinCoble

KevinCoble commented 7 years ago

MetalNeuralNetwork is a simple network - almost exactly like the normal NeuralNetwork when using a layer type of 'simpleFeedForward', but does the processing using Apple's Metal architecture to use the GPU for parallel operation of the mathematics. It works, but does not support many of the options that the NeuralNetwork class itself does (they have to be coded in a C-like language for the graphics processor)

DeepNetwork is a set neural network classes that support convolution and pooling layers with support for deep architectures with 1, 2 or 3-dimensional input arrays. It is used by my 'Convolution' application which is also on GitHub.

SVM uses the Kernel class. If you look at the Kernel.swift file you will find an enumeration at the top of the file showing the different kernels that can be used. The KernelParameters structure then shows what parameters are needed by the different kernel types. Again, as the SVM code is a port/extension of the public library LIBSVM, I would recommend looking at the documentation for that library for more information on using different kernels.