Database Reference
In-Depth Information
["-D" degree 3]
["-G" gamma nil :not-nil]
["-R" coef0 0]
["-C" c 1]
["-N" nu 0.5]
["-Z" normalize false bool->int]
["-P" epsilon 0.1]
["-M" cache-size 40]
["-E" tolerance 0.001]
["-H" shrinking true bool->int]
["-W" weights nil :not-nil]])
3.
Before we use this, let's also write a function to calculate the classiication accuracy
by re-classifying each instance and tracking whether the SVM identiied the class
values correctly or not. We'll use this to see how well the trained SVM is:
(defn eval-instance
([] {:correct 0, :incorrect 0})
([_] {:correct 0, :incorrect 0})
([classifier sums instance]
(if (= (.classValue instance)
(.classifyInstance classifier instance))
(assoc sums
:correct (inc (sums :correct)))
(assoc sums
:incorrect (inc (sums :incorrect))))))
4.
Now, let's get a sample of 35 of the observations (about 10 percent of the total) and
train the SVM on them:
(def ion-sample (sample-instances ion 35))
(def ion-svm (svm ion-sample))
5.
It'll output some information about the optimizations, and then it will be ready to use.
We'll use eval-instance to see how it did:
user=> (reduce (partial eval-instance ion-svm)
(eval-instance) ion)
{:incorrect 81, :correct 270}
This gives us a total correct of 77 percent.
 
Search WWH ::




Custom Search