Changeset 7228:2cb7136f8012 in orange


Ignore:
Timestamp:
02/02/11 19:34:46 (3 years ago)
Author:
miha <miha.stajdohar@…>
Branch:
default
Convert:
4c2443b886b4f212be3e211a55eea4e98dd9e80a
Message:
 
Location:
orange/doc/Orange/rst/code
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orange/doc/Orange/rst/code/svm-custom-kernel.py

    r7220 r7228  
    11from Orange import core 
     2from Orange import data 
    23from Orange.classification import svm 
    34 
    4 data=core.ExampleTable("iris.tab") 
     5table = data.Table("iris.tab") 
    56l1=svm.SVMLearner() 
    6 l1.kernelFunc=svm.kernels.RBFKernelWrapper(core.ExamplesDistanceConstructor_Euclidean(data), gamma=0.5) 
     7l1.kernelFunc=svm.kernels.RBFKernelWrapper(core.ExamplesDistanceConstructor_Euclidean(table), gamma=0.5) 
    78l1.kernel_type=svm.SVMLearner.Custom 
    89l1.probability=True 
    9 c1=l1(data) 
     10c1=l1(table) 
    1011l1.name="SVM - RBF(Euclidean)" 
    1112 
    1213l2=svm.SVMLearner() 
    1314l2.kernelFunc=svm.kernels.RBFKernelWrapper( 
    14     core.ExamplesDistanceConstructor_Hamming(data), gamma=0.5) 
     15    core.ExamplesDistanceConstructor_Hamming(table), gamma=0.5) 
    1516l2.kernel_type=svm.SVMLearner.Custom 
    1617l2.probability=True 
    17 c2=l2(data) 
     18c2=l2(table) 
    1819l2.name="SVM - RBF(Hamming)" 
    1920 
     
    2122l3.kernelFunc = svm.kernels.CompositeKernelWrapper( 
    2223    svm.kernels.RBFKernelWrapper( 
    23     core.ExamplesDistanceConstructor_Euclidean(data), gamma=0.5), 
     24    core.ExamplesDistanceConstructor_Euclidean(table), gamma=0.5), 
    2425    svm.kernels.RBFKernelWrapper( 
    25     core.ExamplesDistanceConstructor_Hamming(data), gamma=0.5), l=0.5) 
     26    core.ExamplesDistanceConstructor_Hamming(table), gamma=0.5), l=0.5) 
    2627l3.kernel_type=svm.SVMLearner.Custom 
    2728l3.probability=True 
    28 c3=l1(data) 
     29c3=l1(table) 
    2930l3.name="SVM - Composite" 
    3031 
    3132 
    3233import orngTest, orngStat 
    33 tests=orngTest.crossValidation([l1, l2, l3], data, folds=5) 
     34tests=orngTest.crossValidation([l1, l2, l3], table, folds=5) 
    3435[ca1, ca2, ca3]=orngStat.CA(tests) 
    3536print l1.name, "CA:", ca1 
  • orange/doc/Orange/rst/code/svm-easy.py

    r7220 r7228  
    1 from Orange import core 
     1from Orange import data 
    22from Orange.classification import svm 
    33 
    4 data = core.ExampleTable("vehicle.tab") 
     4table = data.Table("vehicle.tab") 
    55 
    66svm_easy = svm.SVMLearnerEasy(name="svm easy", folds=3) 
     
    1010import orngStat, orngTest 
    1111 
    12 results = orngTest.crossValidation(learners, data, folds=5) 
     12results = orngTest.crossValidation(learners, table, folds=5) 
    1313print "Name     CA        AUC" 
    1414for learner, CA, AUC in zip(learners, orngStat.CA(results), orngStat.AUC(results)): 
  • orange/doc/Orange/rst/code/svm-linear-weights.py

    r7220 r7228  
    1 from Orange import core  
     1from Orange import data  
    22from Orange.classification import svm 
    33 
    4 data = core.ExampleTable("brown-selected") 
    5 classifier = svm.SVMLearner(data, kernel_type=svm.kernels.Linear, normalization=False) 
     4table = data.Table("brown-selected") 
     5classifier = svm.SVMLearner(table,  
     6                            kernel_type=svm.kernels.Linear,  
     7                            normalization=False) 
    68 
    79weights = svm.getLinearSVMWeights(classifier) 
  • orange/doc/Orange/rst/code/svm-recursive-feature-elimination.py

    r7220 r7228  
    1 from Orange import core 
     1from Orange import data 
    22from Orange.classification import svm 
    33 
    4 data = core.ExampleTable("brown-selected") 
    5 print data.domain 
     4table = data.Table("brown-selected") 
     5print table.domain 
    66 
    77rfe = svm.RFE() 
    8 newdata = rfe(data, 10) 
     8newdata = rfe(table, 10) 
    99print newdata.domain 
Note: See TracChangeset for help on using the changeset viewer.