Changeset 3522:83f1b3834629 in orange


Ignore:
Timestamp:
04/11/07 11:58:47 (7 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
89085557d7ee9def47e1a0b789d294c42ed2606a
Message:

documentation of composite kernel wrapper, sparse linear kernel ...

Location:
orange/doc/modules
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • orange/doc/modules/orngSVM.htm

    r3410 r3522  
    8686<p>Takes two kernel functions (K1  and K2) in initialization and uses them to compute a new kernel function: K(x,y)=K1(x,y)+K2(x,y) 
    8787<h2><INDEX name="classes/MultiplicationKernelWrapper (in orngSVM)">MultiplicationKernelWrapper</h2> 
    88 <p>Takes two kernel functions (K1  and K2) in initialization and uses them to compute a new kernel function: K(x,y)=K1(x,y)*K2(x,y) 
    89 </p> 
     88<p>Takes two kernel functions (K1  and K2) in initialization and uses them to compute a new kernel function: K(x,y)=K1(x,y)*K2(x,y)</p> 
     89<h2><INDEX name="classes/CompositeKernelWrapper (in orngSVM)">CompositeKernelWrapper</h2> 
     90<p>Takes two kernel functions (K1  and K2) in initialization and uses them to compute a new kernel function: K(x,y)=&lambda*K1(x,y)+(1-&lambda)*K2(x,y)</p> 
     91<p class=section>Attributes</p> 
     92<dl class=attributes> 
     93    <dt>_lambda</dt> 
     94    <dd>lambda to use in the kernel function</dd> 
     95</dl> 
     96<h2><INDEX name="classes/SparseLinKernel (in orngSVM)">SparseLinKernel</h2> 
     97<p>A linear kernel function that uses the examples meta attributes (must be floats) that need not be present in all examples</p> 
    9098<h2>Examples</h2> 
     99<p class="header">part of <a href="svm-custom-kernel.py">svm-custom-kernel.py</a> 
     100(uses <a href="iris.tab">iris.tab</a>)</p> 
    91101<xmp class=code>import orange, orngSVM 
    92102data=orange.ExampleTable("iris.tab") 
    93103l1=orngSVM.SVMLearner() 
    94 l1.kernelFunc=orngSVM.RBFKernelWrapper(orange.ExamplesDistanceConstructor_Euclidean(data)) 
     104l1.kernelFunc=orngSVM.RBFKernelWrapper(orange.ExamplesDistanceConstructor_Euclidean(data), gamma=0.5) 
    95105l1.kernel_type=orange.SVMLearner.CUSTOM 
    96 l1.kernelFunc.gamma=0.5 
    97106l1.probability=True 
    98107c1=l1(data) 
     
    100109 
    101110l2=orngSVM.SVMLearner() 
    102 l2.kernelFunc=orngSVM.RBFKernelWrapper(orange.ExamplesDistanceConstructor_Hamming(data)) 
     111l2.kernelFunc=orngSVM.RBFKernelWrapper(orange.ExamplesDistanceConstructor_Hamming(data), gamma=0.5) 
    103112l2.kernel_type=orange.SVMLearner.CUSTOM 
    104 l2.kernelFunc.gamma=0.5 
    105113l2.probability=True 
    106114c2=l2(data) 
    107 l2.name="SVM - RBF(Hamiltonian)" 
     115l2.name="SVM - RBF(Hamming)" 
     116 
     117l3=orngSVM.SVMLearner() 
     118l3.kernelFunc=orngSVM.CompositeKernelWrapper(orngSVM.RBFKernelWrapper(orange.ExamplesDistanceConstructor_Euclidean(data), gamma=0.5),orngSVM.RBFKernelWrapper(orange.ExamplesDistanceConstructor_Hamming(data), gamma=0.5), l=0.5) 
     119l3.kernel_type=orange.SVMLearner.CUSTOM 
     120l3.probability=True 
     121c3=l1(data) 
     122l3.name="SVM - Composite" 
     123 
    108124 
    109125import orngTest, orngStat 
    110 tests=orngTest.crossValidation([l1, l2], data, folds=5) 
    111 [ca1, ca2]=orngStat.CA(tests) 
     126tests=orngTest.crossValidation([l1, l2, l3], data, folds=5) 
     127[ca1, ca2, ca3]=orngStat.CA(tests) 
    112128print l1.name, "CA:", ca1 
    113129print l2.name, "CA:", ca2 
     130print l3.name, "CA:", ca3 
    114131</xmp> 
    115132 
Note: See TracChangeset for help on using the changeset viewer.