本文整理了Java中weka.core.Instance.deleteAttributeAt()
方法的一些代码示例,展示了Instance.deleteAttributeAt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instance.deleteAttributeAt()
方法的具体详情如下:
包路径:weka.core.Instance
类名称:Instance
方法名:deleteAttributeAt
[英]Deletes an attribute at the given position (0 to numAttributes() - 1). Only succeeds if the instance does not have access to any dataset because otherwise inconsistencies could be introduced.
[中]删除给定位置处的属性(0到numAttributes()-1)。仅当实例无法访问任何数据集时,才会成功,否则可能会导致不一致。
代码示例来源:origin: Waikato/meka
/**
* Delete attributes from an instance 'x' indexed by 'indicesToRemove[]'.
* @param x instance
* @param indicesToRemove array of attribute indices
* @return the modified dataset
*/
public static final Instance deleteAttributesAt(Instance x, int indicesToRemove[]) {//, boolean keep) {
Arrays.sort(indicesToRemove);
for(int j = indicesToRemove.length-1; j >= 0; j--) {
x.deleteAttributeAt(indicesToRemove[j]);
}
return x;
}
代码示例来源:origin: net.sf.meka/meka
/**
* Delete attributes from an instance 'x' indexed by 'indicesToRemove[]'.
* @param x instance
* @param indicesToRemove array of attribute indices
* @return the modified dataset
*/
public static final Instance deleteAttributesAt(Instance x, int indicesToRemove[]) {//, boolean keep) {
Arrays.sort(indicesToRemove);
for(int j = indicesToRemove.length-1; j >= 0; j--) {
x.deleteAttributeAt(indicesToRemove[j]);
}
return x;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
public static final Instance deleteAttributesAt(Instance x, int indicesToRemove[]) {//, boolean keep) {
Utils.sort(indicesToRemove);
for(int j = indicesToRemove.length-1; j >= 0; j--) {
x.deleteAttributeAt(indicesToRemove[j]);
}
return x;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
public static Instance linkTransformation(Instance x, int excl[], Instances _template) {
// copy
Instance copy = (Instance)x.copy();
copy.setDataset(null);
// delete attributes we don't need
for(int i = excl.length-1; i >= 0; i--) {
copy.deleteAttributeAt(excl[i]);
}
//set template
copy.setDataset(_template);
return copy;
}
代码示例来源:origin: net.sf.meka/meka
/**
* meka2mulan - Move L label attributes from the beginning to end of attribute space of an Instance.
* Necessary because MULAN assumes label attributes are at the end, not the beginning.
* (the extra time for this process is not counted in the running-time analysis of published work).
*/
public static final Instance meka2mulan(Instance x, int L) {
x.setDataset(null);
for(int j = 0; j
x.deleteAttributeAt(0);
}
return x;
}
代码示例来源:origin: Waikato/meka
/**
* meka2mulan - Move L label attributes from the beginning to end of attribute space of an Instance.
* Necessary because MULAN assumes label attributes are at the end, not the beginning.
* (the extra time for this process is not counted in the running-time analysis of published work).
*/
public static final Instance meka2mulan(Instance x, int L) {
x.setDataset(null);
for(int j = 0; j
x.deleteAttributeAt(0);
}
return x;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
/**
* SwitchAttributes - Move L label attributes from the beginning to end of attribute space of an Instance.
* Necessary because MULAN assumes label attributes are at the end, not the beginning.
* (the extra time for this process is not counted in the running-time analysis of published work).
*/
public static final Instance switchAttributes(Instance instance, int L) {
instance.setDataset(null);
for(int j = 0; j
instance.deleteAttributeAt(0);
}
return instance;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
protected Instance[] convertInstance(Instance instance, int c) {
Instance FilteredInstances[] = new Instance[c];
//for each 'i' classifiers
for (int i = 0; i
FilteredInstances[i] = (Instance) instance.copy();
FilteredInstances[i].setDataset(null);
for (int j = 0, offset = 0; j
else FilteredInstances[i].deleteAttributeAt(offset);
}
FilteredInstances[i].setDataset(m_InstancesTemplate);
}
return FilteredInstances;
}
代码示例来源:origin: net.sf.meka/meka
protected Instance[] convertInstance(Instance instance, int c) {
Instance FilteredInstances[] = new Instance[c];
//for each 'i' classifiers
for (int i = 0; i
FilteredInstances[i] = (Instance) instance.copy();
FilteredInstances[i].setDataset(null);
for (int j = 0, offset = 0; j
else FilteredInstances[i].deleteAttributeAt(offset);
}
FilteredInstances[i].setDataset(m_InstancesTemplate);
}
return FilteredInstances;
}
代码示例来源:origin: Waikato/meka
protected Instance[] convertInstance(Instance instance, int c) {
Instance FilteredInstances[] = new Instance[c];
//for each 'i' classifiers
for (int i = 0; i
FilteredInstances[i] = (Instance) instance.copy();
FilteredInstances[i].setDataset(null);
for (int j = 0, offset = 0; j
else FilteredInstances[i].deleteAttributeAt(offset);
}
FilteredInstances[i].setDataset(m_InstancesTemplate);
}
return FilteredInstances;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
public Instance convertInstance(Instance TestInstance, int C) {
Instance FilteredInstance = (Instance) TestInstance.copy();
FilteredInstance.setDataset(null);
for (int i = 0; i
FilteredInstance.insertAttributeAt(0);
FilteredInstance.setDataset(m_InstancesTemplate);
return FilteredInstance;
}
代码示例来源:origin: Waikato/meka
/**
* Convert a multi-label instance into a multi-class instance, according to a template.
*/
public static Instance convertInstance(Instance x, int L, Instances template) {
Instance x_ = (Instance) x.copy();
x_.setDataset(null);
for (int i = 0; i
x_.insertAttributeAt(0);
x_.setDataset(template);
return x_;
}
代码示例来源:origin: net.sf.meka/meka
/**
* Convert a multi-label instance into a multi-class instance, according to a template.
*/
public static Instance convertInstance(Instance x, int L, Instances template) {
Instance x_ = (Instance) x.copy();
x_.setDataset(null);
for (int i = 0; i
x_.insertAttributeAt(0);
x_.setDataset(template);
return x_;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
@Override
public Instance convertInstance(Instance x, int L) {
Instance x_sl = (Instance) x.copy();
x_sl.setDataset(null);
for (int i = 0; i
x_sl.insertAttributeAt(0);
x_sl.setDataset(m_InstancesTemplate);
return x_sl;
}
代码示例来源:origin: Waikato/meka
public static final Instance setTemplate(Instance x, Instances instancesTemplate) {
int L = x.classIndex();
int L_t = instancesTemplate.classIndex();
x = (Instance)x.copy();
x.setDataset(null);
for (int i = L_t; i
x.setDataset(instancesTemplate);
return x;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
public static final Instance setTemplate(Instance x, Instances instancesTemplate) {
int L = x.classIndex();
int L_t = instancesTemplate.classIndex();
x = (Instance)x.copy();
x.setDataset(null);
for (int i = L_t; i
x.setDataset(instancesTemplate);
return x;
}
代码示例来源:origin: net.sf.meka/meka
public static final Instance setTemplate(Instance x, Instances instancesTemplate) {
int L = x.classIndex();
int L_t = instancesTemplate.classIndex();
x = (Instance)x.copy();
x.setDataset(null);
for (int i = L_t; i
x.setDataset(instancesTemplate);
return x;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
protected void classify(Instance test) throws Exception {
// copy
Instance copy = (Instance)test.copy();
copy.setDataset(null);
// delete attributes we don't need
for(int i = excld.length-1; i >= 0; i--) {
copy.deleteAttributeAt(this.excld[i]);
}
//set template
copy.setDataset(this._template);
//set class
test.setValue(this.index,(int)(this.classifier.classifyInstance(copy)));
//carry on
if (next!=null) next.classify(test);
}
代码示例来源:origin: Waikato/meka
private void classify(Instance test) throws Exception {
// copy
Instance copy = (Instance)test.copy();
copy.setDataset(null);
// delete attributes we don't need
for(int i = excld.length-1; i >= 0; i--) {
copy.deleteAttributeAt(this.excld[i]);
}
//set template
copy.setDataset(this._template);
//set class
test.setValue(this.index,(int)(this.classifier.classifyInstance(copy)));
//carry on
if (next!=null) next.classify(test);
}
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
protected void classify(Instance test) throws Exception {
// copy
Instance copy = (Instance)test.copy();
copy.setDataset(null);
// delete attributes we don't need
for(int i = excld.length-1; i >= 0; i--) {
copy.deleteAttributeAt(this.excld[i]);
}
//set template
copy.setDataset(this._template);
//set class
test.setValue(this.index,(int)(this.classifier.classifyInstance(copy)));
//carry on
if (next!=null) next.classify(test);
}