本文整理汇总了Java中weka.attributeSelection.ASEvaluation类的典型用法代码示例。如果您正苦于以下问题:Java ASEvaluation类的具体用法?Java ASEvaluation怎么用?Java ASEvaluation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ASEvaluation类属于weka.attributeSelection包,在下文中一共展示了ASEvaluation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculate
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* Calculate metric value
*
* @param mlData Multi-label dataset to which calculate the metric
* @return Value of the metric
*/
public double calculate(MultiLabelInstances mlData){
double res = 0.0;
try{
ASEvaluation ase = new InfoGainAttributeEval();
BinaryRelevanceAttributeEvaluator eval = new BinaryRelevanceAttributeEvaluator(ase, mlData, "avg", "none", "eval");
int [] featureIndices = mlData.getFeatureIndices();
for(int i : featureIndices){
res += eval.evaluateAttribute(i);
}
res = res / featureIndices.length;
}
catch(Exception e){
e.printStackTrace();
res = Double.NaN;
}
this.value = res;
return value;
}
示例2: AttributeFilter
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
private AttributeFilter(Class<? extends ASEvaluation> evalClazz, String evalConfig, Class<? extends ASSearch> searchClazz, String searchConfig)
{
this.evalClazz = evalClazz;
this.evalConfig = evalConfig;
this.searchClazz = searchClazz;
this.searchConfig = searchConfig;
}
示例3: buildAttributeFilterFor
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
private static Filter buildAttributeFilterFor(AttributeFilter attributeFilter, Instances dataSet) throws Exception
{
ASEvaluation evaluator = attributeFilter.getEvalClazz().newInstance();
((OptionHandler) evaluator).setOptions(Utils.splitOptions(attributeFilter.getEvalConfig()));
ASSearch search = attributeFilter.getSearchClazz().newInstance();
((OptionHandler) search).setOptions(Utils.splitOptions(attributeFilter.getSearchConfig()));
Filter filter = new AttributeSelection();
filter.setInputFormat(dataSet);
((AttributeSelection) filter).setEvaluator(evaluator);
((AttributeSelection) filter).setSearch(search);
return filter;
}
示例4: getEvaluatorSpec
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* Gets the evaluator specification string, which contains the class name of
* the attribute evaluator and any options to it
*
* @return the evaluator string.
*/
protected String getEvaluatorSpec() {
ASEvaluation e = getEvaluator();
if (e instanceof OptionHandler) {
return e.getClass().getName() + " "
+ Utils.joinOptions(((OptionHandler)e).getOptions());
}
return e.getClass().getName();
}
示例5: getFilter
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/** Creates a specialized AttributeSelection */
public Filter getFilter(ASEvaluation evaluator, ASSearch search) {
AttributeSelection af = new AttributeSelection();
if (evaluator != null) {
af.setEvaluator(evaluator);
}
if (search != null) {
af.setSearch(search);
}
return af;
}
示例6: WekaAttributeSelection
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
public WekaAttributeSelection(ASEvaluation evaluator,
ASSearch searcher) {
this.attrsel = new AttributeSelection();
this.evaluator = evaluator;
this.Searcher = searcher;
this.attreval = (AttributeEvaluator) evaluator;
}
示例7: selectAttributes
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
@TimeThis(task="select-attributes")
protected String selectAttributes(@SuppressWarnings("unused") ProcessingContext<Corpus> ctx, IdentifiedInstances<Element> trainingSet) throws Exception {
ASEvaluation eval = ASEvaluation.forName(evaluator, evaluatorOptions);
return AttributeSelection.SelectAttributes(eval, getEvalOptions(), trainingSet);
}
示例8: getEvalClazz
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
public Class<? extends ASEvaluation> getEvalClazz()
{
return evalClazz;
}
示例9: updateCapabilitiesFilter
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* updates the capabilities filter of the GOE
*
* @param filter the new filter to use
*/
protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_AttributeEvaluatorEditor.setCapabilitiesFilter(new Capabilities(null));
m_AttributeSearchEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter())
tempInst = new Instances(m_Instances, 0);
else
tempInst = new Instances(m_Instances);
int clIndex = m_ClassCombo.getSelectedIndex() - 1;
if (clIndex >= 0) {
tempInst.setClassIndex(clIndex);
}
try {
filterClass = Capabilities.forInstances(tempInst);
} catch (Exception e) {
filterClass = new Capabilities(null);
}
// set new filter
m_AttributeEvaluatorEditor.setCapabilitiesFilter(filterClass);
m_AttributeSearchEditor.setCapabilitiesFilter(filterClass);
m_StartBut.setEnabled(true);
// check capabilities...
Capabilities currentFilter = m_AttributeEvaluatorEditor
.getCapabilitiesFilter();
ASEvaluation evaluator = (ASEvaluation) m_AttributeEvaluatorEditor
.getValue();
Capabilities currentSchemeCapabilities = null;
if (evaluator != null && currentFilter != null
&& (evaluator instanceof CapabilitiesHandler)) {
currentSchemeCapabilities = ((CapabilitiesHandler) evaluator)
.getCapabilities();
if (!currentSchemeCapabilities.supportsMaybe(currentFilter)
&& !currentSchemeCapabilities.supports(currentFilter)) {
m_StartBut.setEnabled(false);
}
}
}
示例10: updateCapabilitiesFilter
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* updates the capabilities filter of the GOE
*
* @param filter the new filter to use
*/
protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_AttributeEvaluatorEditor.setCapabilitiesFilter(new Capabilities(null));
m_AttributeSearchEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter()) {
tempInst = new Instances(m_Instances, 0);
} else {
tempInst = new Instances(m_Instances);
}
int clIndex = m_ClassCombo.getSelectedIndex() - 1;
if (clIndex >= 0) {
tempInst.setClassIndex(clIndex);
}
try {
filterClass = Capabilities.forInstances(tempInst);
} catch (Exception e) {
filterClass = new Capabilities(null);
}
// set new filter
m_AttributeEvaluatorEditor.setCapabilitiesFilter(filterClass);
m_AttributeSearchEditor.setCapabilitiesFilter(filterClass);
m_StartBut.setEnabled(true);
// check capabilities...
Capabilities currentFilter = m_AttributeEvaluatorEditor
.getCapabilitiesFilter();
ASEvaluation evaluator = (ASEvaluation) m_AttributeEvaluatorEditor
.getValue();
Capabilities currentSchemeCapabilities = null;
if (evaluator != null && currentFilter != null
&& (evaluator instanceof CapabilitiesHandler)) {
currentSchemeCapabilities = ((CapabilitiesHandler) evaluator)
.getCapabilities();
if (!currentSchemeCapabilities.supportsMaybe(currentFilter)
&& !currentSchemeCapabilities.supports(currentFilter)) {
m_StartBut.setEnabled(false);
}
}
}
示例11: updateCapabilitiesFilter
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* updates the capabilities filter of the GOE
*
* @param filter the new filter to use
*/
protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_AttributeEvaluatorEditor.setCapabilitiesFilter(new Capabilities(null));
m_AttributeSearchEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter())
tempInst = new Instances(m_Instances, 0);
else
tempInst = new Instances(m_Instances);
int clIndex = m_ClassCombo.getSelectedIndex() - 1;
if (clIndex >= 0) {
tempInst.setClassIndex(clIndex);
}
try {
filterClass = Capabilities.forInstances(tempInst);
}
catch (Exception e) {
filterClass = new Capabilities(null);
}
// set new filter
m_AttributeEvaluatorEditor.setCapabilitiesFilter(filterClass);
m_AttributeSearchEditor.setCapabilitiesFilter(filterClass);
m_StartBut.setEnabled(true);
// check capabilities...
Capabilities currentFilter = m_AttributeEvaluatorEditor.getCapabilitiesFilter();
ASEvaluation evaluator = (ASEvaluation) m_AttributeEvaluatorEditor.getValue();
Capabilities currentSchemeCapabilities = null;
if (evaluator != null && currentFilter != null &&
(evaluator instanceof CapabilitiesHandler)) {
currentSchemeCapabilities = ((CapabilitiesHandler)evaluator).getCapabilities();
if (!currentSchemeCapabilities.supportsMaybe(currentFilter) &&
!currentSchemeCapabilities.supports(currentFilter)) {
m_StartBut.setEnabled(false);
}
}
}
示例12: setEvaluator
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* Sets the attribute evaluator
*
* @param evaluator the evaluator with all options set.
*/
public void setEvaluator(ASEvaluation evaluator) {
m_Evaluator = evaluator;
}
示例13: getEvaluator
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* Gets the attribute evaluator used
*
* @return the attribute evaluator
*/
public ASEvaluation getEvaluator() {
return m_Evaluator;
}
示例14: setEvaluator
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* set attribute/subset evaluator
*
* @param evaluator the evaluator to use
*/
public void setEvaluator(ASEvaluation evaluator) {
m_ASEvaluator = evaluator;
}
示例15: getEvaluator
import weka.attributeSelection.ASEvaluation; //导入依赖的package包/类
/**
* Get the name of the attribute/subset evaluator
*
* @return the name of the attribute/subset evaluator as a string
*/
public ASEvaluation getEvaluator() {
return m_ASEvaluator;
}