|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.umbc.cs.maple.utils.WekaUtils
public class WekaUtils
Various utility functions for Weka.
Copyright (c) 2008 Eric Eaton
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
| Nested Class Summary | |
|---|---|
static class |
WekaUtils.SVMLightLabelFormat
Defines the format of the SVMLight labels |
| Constructor Summary | |
|---|---|
WekaUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
arffToSVMLight(weka.core.Instances data,
WekaUtils.SVMLightLabelFormat labelFormat)
Converts a set of instances to svm-light format |
static java.lang.String |
arffToSVMLight(weka.core.Instance data,
WekaUtils.SVMLightLabelFormat labelFormat)
Converts a set of instances to svm-light format |
static void |
convertMulticlassToBinary(weka.core.Instances data,
java.lang.String positiveClassValue)
Converts the instances in the given dataset to binary, setting the specified labels to positive. |
static boolean |
equalClassPriors(weka.core.Instances data)
Determines whether a data set has equal class priors. |
static double[] |
getClassValues(weka.core.Instances data)
Gets the class values for a set of instances. |
static int[] |
getLabels(weka.core.Instances data)
Gets the class labels for a set of instances. |
static double[] |
getWeights(weka.core.Instances data)
Gets the weights of each instance in a dataset as an array. |
static double[][] |
instancesToDoubleArrays(weka.core.Instances instances)
Converts a set of instances to an array of vectors |
static double[] |
instanceToDoubleArray(weka.core.Instance instance)
Converts an instance to a feature vector excluding the class attribute. |
static weka.core.Instances |
mergeInstances(weka.core.Instances instances1,
weka.core.Instances instances2)
Merge two instance sets. |
static int[] |
predictClasses(weka.classifiers.Classifier model,
weka.core.Instances data)
Uses the given model to predict the classes of the data. |
static weka.core.Instances |
subsetInstances(weka.core.Instances instances,
int startIdx,
int numInstancesToRetrieve)
Extract a particular subset of the instances. |
static weka.core.Instances |
trimInstances(weka.core.Instances instances,
double percentage)
Take a certain percentage of a set of instances. |
static weka.core.Instances |
trimInstances(weka.core.Instances instances,
int numInstances)
Take a certain number of a set of instances. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WekaUtils()
| Method Detail |
|---|
public static weka.core.Instances trimInstances(weka.core.Instances instances,
double percentage)
instances - percentage -
public static weka.core.Instances trimInstances(weka.core.Instances instances,
int numInstances)
instances - numInstances - the number of instances to keep
public static weka.core.Instances subsetInstances(weka.core.Instances instances,
int startIdx,
int numInstancesToRetrieve)
instances - startIdx - the start instance indexnumInstancesToRetrieve - the number of instances to retrieve
public static weka.core.Instances mergeInstances(weka.core.Instances instances1,
weka.core.Instances instances2)
instances1 - instances2 -
public static double[] instanceToDoubleArray(weka.core.Instance instance)
instance - The instance.
public static double[][] instancesToDoubleArrays(weka.core.Instances instances)
instances - The set of instances.
public static int[] predictClasses(weka.classifiers.Classifier model,
weka.core.Instances data)
model - data -
public static int[] getLabels(weka.core.Instances data)
data -
public static double[] getClassValues(weka.core.Instances data)
data -
public static void convertMulticlassToBinary(weka.core.Instances data,
java.lang.String positiveClassValue)
data - the multiclass dataset to be converted to binary.positiveClassValue - the class value to treat as positive.public static boolean equalClassPriors(weka.core.Instances data)
data -
public static double[] getWeights(weka.core.Instances data)
data - the dataset of instances
public static java.lang.String arffToSVMLight(weka.core.Instances data,
WekaUtils.SVMLightLabelFormat labelFormat)
data - the weka instances
public static java.lang.String arffToSVMLight(weka.core.Instance data,
WekaUtils.SVMLightLabelFormat labelFormat)
data - the weka instances
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||