热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

weka.core.Instance.deleteAttributeAt()方法的使用及代码示例

本文整理了Java中weka.core.Instance.deleteAttributeAt()方法的一些代码示例,展示了Instance.deleteAt

本文整理了Java中weka.core.Instance.deleteAttributeAt()方法的一些代码示例,展示了Instance.deleteAttributeAt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instance.deleteAttributeAt()方法的具体详情如下:
包路径:weka.core.Instance
类名称:Instance
方法名:deleteAttributeAt

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.insertAttributeAt(x.numAttributes());
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.insertAttributeAt(x.numAttributes());
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.insertAttributeAt(instance.numAttributes());
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 //remove all except 'i'
FilteredInstances[i] = (Instance) instance.copy();
FilteredInstances[i].setDataset(null);
for (int j = 0, offset = 0; j if (j == i) offset = 1;
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 //remove all except 'i'
FilteredInstances[i] = (Instance) instance.copy();
FilteredInstances[i].setDataset(null);
for (int j = 0, offset = 0; j if (j == i) offset = 1;
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 //remove all except 'i'
FilteredInstances[i] = (Instance) instance.copy();
FilteredInstances[i].setDataset(null);
for (int j = 0, offset = 0; j if (j == i) offset = 1;
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.deleteAttributeAt(0);
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_.deleteAttributeAt(0);
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_.deleteAttributeAt(0);
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.deleteAttributeAt(0);
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.deleteAttributeAt(0);
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.deleteAttributeAt(0);
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.deleteAttributeAt(0);
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);
}

推荐阅读
  • Week04面向对象设计与继承学习总结及作业要求
    本文总结了Week04面向对象设计与继承的重要知识点,包括对象、类、封装性、静态属性、静态方法、重载、继承和多态等。同时,还介绍了私有构造函数在类外部无法被调用、static不能访问非静态属性以及该类实例可以共享类里的static属性等内容。此外,还提到了作业要求,包括讲述一个在网上商城购物或在班级博客进行学习的故事,并使用Markdown的加粗标记和语句块标记标注关键名词和动词。最后,还提到了参考资料中关于UML类图如何绘制的范例。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • 在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板
    本文介绍了在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板的方法和步骤,包括将ResourceDictionary添加到页面中以及在ResourceDictionary中实现模板的构建。通过本文的阅读,读者可以了解到在Xamarin XAML语言中构建控件模板的具体操作步骤和语法形式。 ... [详细]
  • 本文介绍了机器学习手册中关于日期和时区操作的重要性以及其在实际应用中的作用。文章以一个故事为背景,描述了学童们面对老先生的教导时的反应,以及上官如在这个过程中的表现。同时,文章也提到了顾慎为对上官如的恨意以及他们之间的矛盾源于早年的结局。最后,文章强调了日期和时区操作在机器学习中的重要性,并指出了其在实际应用中的作用和意义。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • 本文介绍了Swing组件的用法,重点讲解了图标接口的定义和创建方法。图标接口用来将图标与各种组件相关联,可以是简单的绘画或使用磁盘上的GIF格式图像。文章详细介绍了图标接口的属性和绘制方法,并给出了一个菱形图标的实现示例。该示例可以配置图标的尺寸、颜色和填充状态。 ... [详细]
  • 重入锁(ReentrantLock)学习及实现原理
    本文介绍了重入锁(ReentrantLock)的学习及实现原理。在学习synchronized的基础上,重入锁提供了更多的灵活性和功能。文章详细介绍了重入锁的特性、使用方法和实现原理,并提供了类图和测试代码供读者参考。重入锁支持重入和公平与非公平两种实现方式,通过对比和分析,读者可以更好地理解和应用重入锁。 ... [详细]
  • 本文介绍了如何使用n3-charts绘制以日期为x轴的数据,并提供了相应的代码示例。通过设置x轴的类型为日期,可以实现对日期数据的正确显示和处理。同时,还介绍了如何设置y轴的类型和其他相关参数。通过本文的学习,读者可以掌握使用n3-charts绘制日期数据的方法。 ... [详细]
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
  • 本文整理了Java中com.evernote.android.job.JobRequest.getTransientExtras()方法的一些代码示例,展示了 ... [详细]
author-avatar
羚之舞
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有