本文整理汇总了Java中weka.core.Utils.forName方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.forName方法的具体用法?Java Utils.forName怎么用?Java Utils.forName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.core.Utils
的用法示例。
在下文中一共展示了Utils.forName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WekaMatchingRule
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Create a MatchingRule, which can be trained using the Weka library for
* identity resolution.
*
* @param finalThreshold
* determines the confidence level, which needs to be exceeded by
* the classifier, so that it can classify a record as match.
*
* @param classifierName
* Has the name of a specific classifier from the Weka library.
*
* @param parameters
* Hold the parameters to tune the classifier.
*/
public WekaMatchingRule(double finalThreshold, String classifierName, String parameters[]) {
super(finalThreshold);
this.parameters = parameters;
// create classifier
try {
this.classifier = (Classifier) Utils.forName(Classifier.class, classifierName, parameters);
} catch (Exception e) {
e.printStackTrace();
}
// create list for comparators
this.comparators = new LinkedList<>();
}
示例2: fromCommandline
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Returns a fully configured object from the given commandline.
*
* @param cmdline the commandline to turn into an object
* @return the object or null in case of an error
*/
public static AbstractOutput fromCommandline(String cmdline) {
AbstractOutput result;
String[] options;
String classname;
try {
options = Utils.splitOptions(cmdline);
classname = options[0];
options[0] = "";
result =
(AbstractOutput) Utils
.forName(AbstractOutput.class, classname, options);
} catch (Exception e) {
result = null;
}
return result;
}
示例3: getObject
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Tries to instantiate the class stored for this property, optional options
* will be set as well. Returns null if unsuccessful.
*
* @param property the property to get the object for
* @param defaultValue the default object spec string
* @param cls the class the object must be derived from
* @return if successful the fully configured object, null otherwise
*/
protected static Object getObject(String property, String defaultValue,
Class<?> cls) {
Object result;
String tmpStr;
String[] tmpOptions;
result = null;
try {
tmpStr = get(property, defaultValue);
tmpOptions = Utils.splitOptions(tmpStr);
if (tmpOptions.length != 0) {
tmpStr = tmpOptions[0];
tmpOptions[0] = "";
result = Utils.forName(cls, tmpStr, tmpOptions);
}
} catch (Exception e) {
e.printStackTrace();
result = null;
}
return result;
}
示例4: getClassifierErrorsPlotInstances
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Returns an instance of the class used for generating plot instances for
* displaying the classifier errors.
*
* @return an instance of the class
*/
public static ClassifierErrorsPlotInstances getClassifierErrorsPlotInstances() {
ClassifierErrorsPlotInstances result;
String classname;
String[] options;
try {
options = Utils.splitOptions(get("ClassifierErrorsPlotInstances",
"weka.gui.explorer.ClassifierErrorsPlotInstances"));
classname = options[0];
options[0] = "";
result = (ClassifierErrorsPlotInstances) Utils.forName(
ClassifierErrorsPlotInstances.class, classname, options);
} catch (Exception e) {
e.printStackTrace();
result = new ClassifierErrorsPlotInstances();
}
return result;
}
示例5: getClustererAssignmentsPlotInstances
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Returns an instance of the class used for generating plot instances for
* displaying the cluster assignments.
*
* @return an instance of the class
*/
public static ClustererAssignmentsPlotInstances getClustererAssignmentsPlotInstances() {
ClustererAssignmentsPlotInstances result;
String classname;
String[] options;
try {
options = Utils.splitOptions(get("ClustererAssignmentsPlotInstances",
"weka.gui.explorer.ClustererAssignmentsPlotInstances"));
classname = options[0];
options[0] = "";
result = (ClustererAssignmentsPlotInstances) Utils.forName(
ClustererAssignmentsPlotInstances.class, classname, options);
} catch (Exception e) {
e.printStackTrace();
result = new ClustererAssignmentsPlotInstances();
}
return result;
}
示例6: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
@Override
public void setOptions(String[] options) throws Exception {
m_config = new HDFSConfig();
String path = Utils.getOption("dest", options); //$NON-NLS-1$
if (!DistributedJobConfig.isEmpty(path)) {
setHDFSPath(path);
}
String factor = Utils.getOption("dfs-replication", options); //$NON-NLS-1$
if (!DistributedJobConfig.isEmpty(factor)) {
setDFSReplicationFactor(factor);
}
String saverSpec = Utils.getOption("saver", options); //$NON-NLS-1$
if (!DistributedJobConfig.isEmpty(saverSpec)) {
String[] split = Utils.splitOptions(saverSpec);
String saverClass = split[0];
split[0] = ""; //$NON-NLS-1$
AbstractFileSaver s = (AbstractFileSaver) Utils.forName(
AbstractFileSaver.class, saverClass, split);
setSaver(s);
}
m_config.setOptions(options);
}
示例7: forName
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Creates a new instance of an attribute/subset evaluator given it's class
* name and (optional) arguments to pass to it's setOptions method. If the
* evaluator implements OptionHandler and the options parameter is non-null,
* the evaluator will have it's options set.
*
* @param evaluatorName the fully qualified class name of the evaluator
* @param options an array of options suitable for passing to setOptions. May
* be null.
* @return the newly created evaluator, ready for use.
* @exception Exception if the evaluator name is invalid, or the options
* supplied are not acceptable to the evaluator
*/
public static ASEvaluation forName(String evaluatorName,
String[] options) throws Exception {
return (ASEvaluation) Utils.forName(ASEvaluation.class,
evaluatorName,
options);
}
示例8: forName
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Creates a new instance of a search class given it's class name and
* (optional) arguments to pass to it's setOptions method. If the
* search method implements OptionHandler and the options parameter is
* non-null, the search method will have it's options set.
*
* @param searchName the fully qualified class name of the search class
* @param options an array of options suitable for passing to setOptions. May
* be null.
* @return the newly created search object, ready for use.
* @throws Exception if the search class name is invalid, or the options
* supplied are not acceptable to the search class.
*/
public static ASSearch forName(String searchName,
String [] options) throws Exception {
return (ASSearch)Utils.forName(ASSearch.class,
searchName,
options);
}
示例9: forName
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Creates a new instance of a classifier given it's class name and (optional)
* arguments to pass to it's setOptions method. If the classifier implements
* OptionHandler and the options parameter is non-null, the classifier will
* have it's options set.
*
* @param classifierName the fully qualified class name of the classifier
* @param options an array of options suitable for passing to setOptions. May
* be null.
* @return the newly created classifier, ready for use.
* @exception Exception if the classifier name is invalid, or the options
* supplied are not acceptable to the classifier
*/
public static Classifier forName(String classifierName, String[] options)
throws Exception {
return ((AbstractClassifier) Utils.forName(Classifier.class,
classifierName, options));
}
示例10: forName
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Creates a new instance of a clusterer given it's class name and (optional)
* arguments to pass to it's setOptions method. If the clusterer implements
* OptionHandler and the options parameter is non-null, the clusterer will
* have it's options set.
*
* @param clustererName the fully qualified class name of the clusterer
* @param options an array of options suitable for passing to setOptions. May
* be null.
* @return the newly created search object, ready for use.
* @exception Exception if the clusterer class name is invalid, or the options
* supplied are not acceptable to the clusterer.
*/
public static Clusterer forName(String clustererName, String[] options)
throws Exception {
return (Clusterer) Utils.forName(Clusterer.class, clustererName, options);
}
示例11: forName
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Creates a new instance of a kernel given it's class name and (optional)
* arguments to pass to it's setOptions method.
*
* @param kernelName the fully qualified class name of the classifier
* @param options an array of options suitable for passing to setOptions. May
* be null.
* @return the newly created classifier, ready for use.
* @throws Exception if the classifier name is invalid, or the options
* supplied are not acceptable to the classifier
*/
public static Kernel forName(String kernelName, String[] options)
throws Exception {
return (Kernel) Utils.forName(Kernel.class, kernelName, options);
}
示例12: forName
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Creates a new instance of a estimatorr given it's class name and (optional)
* arguments to pass to it's setOptions method. If the estimator implements
* OptionHandler and the options parameter is non-null, the estimator will
* have it's options set.
*
* @param name the fully qualified class name of the estimatorr
* @param options an array of options suitable for passing to setOptions. May
* be null.
* @return the newly created estimator, ready for use.
* @exception Exception if the estimator name is invalid, or the options
* supplied are not acceptable to the estimator
*/
public static Estimator forName(String name, String[] options)
throws Exception {
return (Estimator) Utils.forName(Estimator.class, name, options);
}