Ignore:
Timestamp:
02/06/12 20:01:02 (2 years ago)
Author:
lanumek
Branch:
default
Children:
9835:e48466fc6eb2, 9841:05a160804431
rebase_source:
8cf30121654f25c9cb6d8ac9bdaf163e305d62da
Message:

Changed names of data sets (table replaced with data or name of the data set).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/code/svm-custom-kernel.py

    r9724 r9823  
    33 
    44from Orange.classification.svm import SVMLearner, kernels 
    5 from Orange.distance import Euclidean 
    6 from Orange.distance import Hamming 
     5from Orange.distance.instances import EuclideanConstructor 
     6from Orange.distance.instances import HammingConstructor 
    77 
    8 table = data.Table("iris.tab") 
     8iris = data.Table("iris.tab") 
    99l1 = SVMLearner() 
    10 l1.kernel_func = kernels.RBFKernelWrapper(Euclidean(table), gamma=0.5) 
     10l1.kernel_func = kernels.RBFKernelWrapper(EuclideanConstructor(iris), gamma=0.5) 
    1111l1.kernel_type = SVMLearner.Custom 
    1212l1.probability = True 
    13 c1 = l1(table) 
     13c1 = l1(iris) 
    1414l1.name = "SVM - RBF(Euclidean)" 
    1515 
    1616l2 = SVMLearner() 
    17 l2.kernel_func = kernels.RBFKernelWrapper(Hamming(table), gamma=0.5) 
     17l2.kernel_func = kernels.RBFKernelWrapper(HammingConstructor(iris), gamma=0.5) 
    1818l2.kernel_type = SVMLearner.Custom 
    1919l2.probability = True 
    20 c2 = l2(table) 
     20c2 = l2(iris) 
    2121l2.name = "SVM - RBF(Hamming)" 
    2222 
    2323l3 = SVMLearner() 
    2424l3.kernel_func = kernels.CompositeKernelWrapper( 
    25     kernels.RBFKernelWrapper(Euclidean(table), gamma=0.5), 
    26     kernels.RBFKernelWrapper(Hamming(table), gamma=0.5), l=0.5) 
     25    kernels.RBFKernelWrapper(EuclideanConstructor(iris), gamma=0.5), 
     26    kernels.RBFKernelWrapper(HammingConstructor(iris), gamma=0.5), l=0.5) 
    2727l3.kernel_type = SVMLearner.Custom 
    2828l3.probability = True 
    29 c3 = l1(table) 
     29c3 = l1(iris) 
    3030l3.name = "SVM - Composite" 
    3131 
    32 tests = evaluation.testing.cross_validation([l1, l2, l3], table, folds=5) 
     32tests = evaluation.testing.cross_validation([l1, l2, l3], iris, folds=5) 
    3333[ca1, ca2, ca3] = evaluation.scoring.CA(tests) 
    3434 
Note: See TracChangeset for help on using the changeset viewer.