| |
- __builtin__.object
-
- Array
- ArrayIter
- Constraints
- ConstraintsIter
- Document
- DocumentIter
- KernelParm
- Model
- Sample
- SampleIter
- Sparm
- Sparse
- SparseIter
- StructModel
class Constraints(__builtin__.object) |
|
The constraint set of left-right side pairs.
The idea of the constraint set is that the left-hand-side is a
document and the right-hand-side is a float, where the inequality
'lhs*w + slack >= rhs' is maintained. This object acts roughly
like a sequence with regard to constraint access. The user does
not create these objects. |
|
Methods defined here:
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __iter__(...)
- x.__iter__() <==> iter(x)
- __len__(...)
- x.__len__() <==> len(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- __str__(...)
- x.__str__() <==> str(x)
Data descriptors defined here:
- m
- The number of constraints in this example.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x62e260>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Document(__builtin__.object) |
|
Document(sparses [,docnum,queryid,costfactor,slackid,kernelid])
Construct a single example document.
A document vector contains a sequence of svmapi.Sparse
vectors representing the contents (accessible through iteration)
as well as several other data fields. |
|
Methods defined here:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __iter__(...)
- x.__iter__() <==> iter(x)
- __len__(...)
- x.__len__() <==> len(x)
- __reduce__(...)
- Pickling support.
- __repr__(...)
- x.__repr__() <==> repr(x)
- __str__(...)
- x.__str__() <==> str(x)
Data descriptors defined here:
- costfactor
- Scales the cost of misclassifying this document by this factor.
The upper bound of the alpha of this constraint is scaled by
this factor.
- docnum
- The position of the document in the training set array.
- kernelid
- Position in the gram matrix where the kernel value can be found
when using an explicit gram matrix.
- queryid
- Constraints are generated for documents with the same query ID.
Used only when learning rankings.
- slackid
- Index of the slack variable corresponding to this constraint.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x62e4a0>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class KernelParm(__builtin__.object) |
|
Kernel parameter objects.
These encapulate a parameterization of the kernel used in learning. |
|
Methods defined here:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- Pickling support.
- __repr__(...)
- x.__repr__() <==> repr(x)
- __str__(...)
- x.__str__() <==> str(x)
Data descriptors defined here:
- coef_const
- Sigmoid constant coefficient 'c' in tanh(s a*b + c).
- coef_lin
- Sigmoid linear coefficient 's' in tanh(s a*b + c).
- custom
- String for benefit of the custom kernel.
- kernel_type
- The type of the kernel. Value values are:
0 - linear
1 - polynomial
2 - rbf
3 - sigmoid
4 - custom
5 - matrix
- poly_degree
- The degree of the polynomial kernel.
- rbf_gamma
- Gaussian width parameter for RBF kernel.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x62e720>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Model(__builtin__.object) |
|
Contains general SVM model parameters.
These objects contain general parameters related to the SVM QP,
but unrelated to any structural-learning specific data. |
|
Methods defined here:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- Pickling support.
- classify(...)
- classify(example)
Given an example, which can be either a svmapi.Document or a
svmapi.Sparse object, return the scalar classification of that
document according to this model.
Data descriptors defined here:
- alpha
- The alpha multipliers for each support vector.
- at_upper_bound
- The number of support vectors with maxed alpha.
- b
- The bias term.
- kernel_parm
- Kernel parameters.
- supvec
- The support vectors.
- sv_num
- The number of support vectors.
- totdoc
- The number of training documents.
- totwords
- The number of features.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x62e8c0>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Sparm(__builtin__.object) |
|
Struct learning parameter objects contrain attributes which control
how the structural SVM will proceed in its cutting plane
optimization. |
|
Methods defined here:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- Pickling support.
- __repr__(...)
- x.__repr__() <==> repr(x)
- __setstate__(...)
- Unpickling support.
- __str__(...)
- x.__str__() <==> str(x)
Data descriptors defined here:
- __dict__
- argv
- List of custom command line arguments.
- c
- Trade-off between margin and loss.
- ccache_size
- Maximum number of constraints to cache for each example.
Used in w=4 algorithm. Must be >= 5.
- epsilon
- Precision to which to solve the quadratic program.
- loss_function
- Identifier for different loss functions.
- loss_type
- Constraint loss type, either slack (1) or margin (2) rescaling.
- newconstretrain
- Number of new constraints to accumulate before recomputing the QP.
Used in w=1 algorithm.
- slack_norm
- Norm of the objective function slack term, either 1 or 2.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x62ecc0>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Sparse(__builtin__.object) |
|
Sparse(words [, userdefined, factor, kernel_id])
A single sparse vector with the indicated contents.
This class is used by both the user to define new sparse vectors,
and by SVM^python to pass around sparse vectors with the indicated
contents. The 'words' entry is a vector of either (index,value)
pairs indicating that 'index' has value 'value', or just a 'value'
number which is implicitly equivalent to '(index+1,value)', where
'index' was the index of the last element. |
|
Methods defined here:
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __iter__(...)
- x.__iter__() <==> iter(x)
- __len__(...)
- x.__len__() <==> len(x)
- __reduce__(...)
- Pickling support.
- __repr__(...)
- x.__repr__() <==> repr(x)
- __str__(...)
- x.__str__() <==> str(x)
Data descriptors defined here:
- factor
- Factor by which this feature vector is multiplied when summed.
- kernel_id
- The kernel ID. Feature vectors with different K-IDs are
considered orthogonal for the purpose of kernel evaluation.
- twonorm_sq
- The squared euclidian length of the vector.
- userdefined
- A string holding additional information, or None if unset.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x62eee0>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class StructModel(__builtin__.object) |
|
Parameterization for the learned structural model.
Structure model objects which contain parameterizations for
learned models. Aside from basic members including a pointer
to the underlying SVM QP model, a user may define their own
values by assigning values to this object. These assignments
are retained throughout training, written with the model (if
they are Picklable), and reloaded during classification using
this model. |
|
Methods defined here:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __reduce__(...)
- Pickling support.
- __setstate__(...)
- Unpickling support.
Data descriptors defined here:
- __dict__
- Dictionary of instance variables.
- lin_reduce
- Whether or not to reduce this model to a single support vector.
If true, and there is an existing 'w' weight vector (which happens
for linear kernels only), the support vectors in the SVM model
will be replaced with a single support vector. If false, no
pre-serialization processing will occur.
- size_psi
- Length of the linear feature vector.
- svm_model
- The SVM model.
- w
- The linear learned weights.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x62f180>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
| |