³ò
ˈóHc @ sQ d Z d d k Z d d k Z d d k Z d d k l Z d d d „ ƒ YZ d S( sD
An interface class for U{SVM light}
iÿÿÿÿN( t callt SVMLightc B sh e Z d Z d Z d Z e d „ Z d „ Z e e ƒ Z d „ Z
d „ Z d „ Z d „ Z
d „ Z RS(
så
An interface class for U{SVM light}
This class currently supports classification of binary feature
vectors with default options. It calls the SVMLight binaries via
the shell.
Future versions should add a SWIG interface and support for use of
non-default SVMlight options and non-binary feature vectors.
C{SVMLight} reads sparse binary feature vectors - ordered lists
of numeric feature identifiers.
t svm_learnt svm_classifyc C sS t i i | t i f ƒ | _ t i i | t i f ƒ | _ | | _ d | _
t | ƒ t | ƒ j o t d ƒ ‚ n t
i ƒ | _ t i i | i d f ƒ | _ t i i | i d f ƒ | _ t i i | i d f ƒ | _ t i i | i d f ƒ | _ | i | i | | ƒ t | i | i | i f d | i ƒ} | d j p t ‚ d S( s^
Trains a new classifier.
@type svm_path: C{str}
@param svm_path: The filesystem path to the SVMLight binaries
@type labels: C{tuple}
@param labels: A tuple of C{1} or C{-1} training set labels.
@type vectors: C{tuple}
@param vectors: A tuple of sparse binary feature vectors.
s/ labels and vectors arrays are different lengthst examplet modelt inputt outputt stdouti N( t ost sept joinR t learn_binaryt
_svm_learnt classify_binaryt
_svm_classifyt _cleanupt Nonet _devnullt lent
ValueErrort tempfilet mkdtempt
_directoryt _example_fnamet _model_fnamet _input_fnamet
_output_fnamet _write_vectorsR t devnullt AssertionError( t selft svm_patht labelst vectorst cleanupt ret( ( s" /Users/NUS/csit/src_d2/svmlight.pyt __init__! s c C sS | i d j o<