|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cmu.minorthird.classify.algorithms.svm.SVMUtils
public class SVMUtils
Provides some basic utilities for dealing with libsvm. It can convert Features to nodes, instances to node arrays and Datasets to problems.
Constructor Summary | |
---|---|
SVMUtils()
|
Method Summary | |
---|---|
static libsvm.svm_problem |
convertToSVMProblem(Dataset dataset)
convert the given dataset into a svm_problem object by looping through the examples and features - features are resorted numericly |
static libsvm.svm_node |
featureToNode(Feature feature,
Instance instance)
converts the feature into an svm_node |
static libsvm.svm_node[] |
instanceToNodeArray(Instance instance)
creates the node array from an instance |
static Instance |
nodeArrayToInstance(libsvm.svm_node[] nodes,
FeatureFactory featureFactory)
creates an instance from the node array |
static Feature |
nodeToFeature(libsvm.svm_node node,
FeatureFactory featureFactory)
convert a svm_node to a feature |
static java.lang.String |
toString(libsvm.svm_node node)
|
static java.lang.String |
toString(libsvm.svm_node[] nodes)
|
static java.lang.String |
toString(libsvm.svm_problem problem)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SVMUtils()
Method Detail |
---|
public static java.lang.String toString(libsvm.svm_node node)
public static java.lang.String toString(libsvm.svm_node[] nodes)
public static java.lang.String toString(libsvm.svm_problem problem)
public static libsvm.svm_node featureToNode(Feature feature, Instance instance)
feature
- Feature to convert into a nodeinstance
- Instance feature is in - used to retrieve the weight of the feature
public static libsvm.svm_node[] instanceToNodeArray(Instance instance)
instance
- Instance to convert
public static libsvm.svm_problem convertToSVMProblem(Dataset dataset)
dataset
- - must contain features with integer names
public static Feature nodeToFeature(libsvm.svm_node node, FeatureFactory featureFactory)
node
- svm_node from LIBSVMfeatureFactory
- FeatureIdFactory object holds feature and its id information.
public static Instance nodeArrayToInstance(libsvm.svm_node[] nodes, FeatureFactory featureFactory)
nodes
- svm_node array from LIBSVMfeatureFactory
- FeatureFactory object holds feature and its id
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |