-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
put_get.sg
39 lines (30 loc) · 835 Bytes
/
put_get.sg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
KNN knn()
knn.put("m_k", 2)
Kernel k = kernel("GaussianKernel")
k.put("log_width", 2.1)
k.put("log_width", 2.0)
real log_width = k.get_real("log_width")
RealVector vector(2)
vector[0] = 0.0
vector[1] = 0.1
RegressionLabels labels()
labels.put("labels", vector)
RealVector vector2 = labels.get_real_vector("labels")
labels.put("labels", vector2)
RealMatrix matrix(2,2)
matrix[0,0] = 0.0
matrix[0,1] = 0.1
matrix[1,0] = 0.2
matrix[1,1] = 0.4
RealFeatures features()
features.put("feature_matrix", matrix)
RealMatrix matrix2 = features.get_real_matrix("feature_matrix")
features.put("feature_matrix", matrix2)
EuclideanDistance distance()
knn.put("distance", distance)
SGObject distance2 = knn.get("distance")
knn.put("distance", distance2)
LibSVM svm()
svm.put("kernel", k)
SGObject k2 = svm.get("kernel")
svm.put("kernel", k2)