机器学习 属性_属性关系文件格式| 机器学习

机器学习 属性

Today, we will be looking at the use of attribute relation file format for machine learning in java and we would be writing a small java code to convert the popularly used .csv file format into the arff (Attribute relation file format). This file format was developed by the computer science department of the University of Waikato, as the name suggests the file contains a list of attributes and one class attribute. The attribute relation file format is broadly divided into two portions:

今天,我们将研究在Java中使用属性关系文件格式进行机器学习,并且我们将编写一个小的Java代码,将常用的.csv文件格式转换为arff(属性关系文件格式) 。 这种文件格式是由怀卡托大学计算机科学系开发的,顾名思义,该文件包含一个属性列表和一个类属性。 属性关系文件格式大致分为两部分:

  1. Header field

    标头字段

  2. Data field

    资料栏位

Now, we would be discussing these fields in detail,

现在,我们将详细讨论这些领域,

1) Header field

1)标头字段

The header field describes the name of the attributes, type of relation and their datatypes that are present in the data file the main difference between them .CSV and .arff file are that the in .CSV files you will find the values of the attributes just below their name but in .arff files, the name of the attributes are specified separately followed by the data which is present in a separate data field. The basic syntax for writing the attribute name In the header portion is as follows:

报头字段描述了属性,关系类型和数据类型存在于数据文件它们之间的主要区别.csv.arff文件是中.CSV文件,你会发现值的属性刚刚的名字在其名称下方,但在.arff文件中,分别指定属性名称,后跟单独数据字段中的数据。 在标头部分写入属性名称的基本语法如下:

 @attribute <attribute-name> <datatype>

The image below shows an example of .arff file format,

下图显示了.arff文件格式的示例,

relational headerbrain

The following example is a data set contains the head-brain relation of the various users. From the picture above one can easily identify the number of attributes along with the type of data that they contain in our example all the data in all four attributes are in the form of number i.e. numeric. Apart from being numeric, the data type can be of the form of nominal, string type and data type specification.

下面的示例是一个数据集,其中包含各个用户的头颅关系。 从上面的图片中,我们可以轻松地识别出属性的数量以及它们所包含的数据类型,在我们的示例中,所有四个属性中的所有数据都是数字即数字形式。 除了数字以外,数据类型还可以采用名义,字符串类型和数据类型规范的形式。

2) Data field

2)资料栏位

This field contains the data values of the attributes mentioned above in the attribute field these are the values will be used by our model to perform prediction and to determine the amount of accuracy that can be provided in the result of our model. The data present is separated by the comas under the heading of @data. The data as mentioned above in the attributes field can be as follows:

此字段包含属性字段中上述属性的数据值,这些值将由我们的模型用于执行预测并确定可以在模型结果中提供的准确度。 存在的数据在@data标题下用逗号分隔。 上面在属性字段中提到的数据可以如下:

  1. Numerical

    数值型

  2. Nominal

    标称

  3. String

  4. Date-time format

    日期时间格式

The .CSV file, that I have used can be downloaded from here: headbrain7.csv

我使用过的.CSV文件可以从这里下载: headbrain7.csv

Below is the code is written in Java in eclipse IDE for converting the .CSV file into .arff file format make sure you have set the path to the weka.jar file if you haven’t, then just have a look at my previous article: Introduction to weka and Machine learning in Java

以下是在eclipse IDE中用Java编写的代码,用于将.CSV文件转换为.arff文件格式,请确保已将weka.jar文件的路径设置为,如果没有,请看一下我的前一篇文章: Java中的weka和机器学习简介

Code:

码:

import java.io.File;
import java.io.IOException;
import weka.*;
import weka.core.Instances;
import weka.core.converters.ArffSaver;
import weka.core.converters.CSVLoader;
public class wekaapi {
public static void main(String[] args) throws IOException {
// load the CSV file
CSVLoader load = new CSVLoader();
loader.setSource(new File("C:\\Users\\Logan\\Desktop\\ML\\linearregression\\headbrain.csv"));
Instances data = load.getDataSet();//get instances object
ArffSaver save = new ArffSaver();
save.setInstances(data);//set the dataset we want to convert
save.setFile(new File("C:\\Users\\Logan\\Desktop\\ML\\headbrain.arff"));
System.out.println("The .arff file format is as follows");
save.writeBatch();
System.out.println(data);
}
}

Output

输出量

Attribute relation file format output

Clean display and proper orientation of data make .arff files a popular choice among the data scientists for their analysis this was all for today guys, Hope you liked this article and stay tuned for more and have a great day ahead.

整洁的显示和正确的数据方向使.arff文件成为数据科学家在分析中的普遍选择,这对于今天的人来说都是如此。希望您喜欢这篇文章,并继续关注,以取得美好的一天。

翻译自: https://www.includehelp.com/ml-ai/attribute-relation-file-format.aspx

机器学习 属性

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/544737.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C#标记废弃方法

一、普通用法 在C#中&#xff0c;如果一个方法我们不再使用&#xff0c;我们可以将其标记为“废弃”的方法&#xff0c;只需要在方法前&#xff0c;加一个[Obsolete]即可&#xff1b; [Obsolete] public void BiuBiuBiu(){// 嘿嘿嘿 }废弃方法并非不能使用&#xff0c;而是在…

阿里二面一问MySQL就开始野了,抓着底层原理不撒手啊!

最近项目增加&#xff0c;缺人手&#xff0c;面试不少&#xff0c;但匹配的人少的可怜。跟其他组的面试官聊&#xff0c;他也抱怨了一番&#xff0c;说候选人有点儿花拳绣腿&#xff0c;回答问题不落地&#xff0c;拿面试最常问的MySQL来说&#xff0c;并不只是懂“增删改查”、…

[转]“Ceph浅析”系列之(—)—Ceph概况

转载自&#xff1a;http://yizhaolingyan.net/?p11本文将对Ceph的基本情况进行概要介绍&#xff0c;以期读者能够在不涉及技术细节的情况下对Ceph建立一个初步印象。2.1 什么是Ceph&#xff1f;Ceph的官方网站Ceph.com上用如下这句话简明扼要地定义了Ceph&#xff1a;“Ceph…

关于C#监视剪贴板信息

##1、常规方法 在C#中&#xff0c;有一个常规检测剪贴板的方法&#xff0c;用的是 System.Windows.Forms.Clipboard&#xff1b; 使用起来很简单&#xff0c;代码如下&#xff1a; /// <summary> /// 设置剪贴板的文本内容 /// </summary> /// <param name&qu…

图解Java中的18 把锁!

乐观锁和悲观锁独占锁和共享锁互斥锁和读写锁公平锁和非公平锁可重入锁自旋锁分段锁锁升级&#xff08;无锁|偏向锁|轻量级锁|重量级锁&#xff09;锁优化技术&#xff08;锁粗化、锁消除&#xff09;乐观锁和悲观锁悲观锁悲观锁对应于生活中悲观的人&#xff0c;悲观的人总是想…

在CSS中使用not:first-child选择器

Introduction: 介绍&#xff1a; Well, selectors are a very common term to deal with while we are developing a website or web page. You might know quite a few of them and might as well be implementing them. You might also have noticed that all the selectors…

linux/unix 段错误捕获【续】

本文为“在C/C中捕获段错误&#xff0c;打印出错的具体位置”的续篇&#xff0c;进一步解决涉及动态链接库的情况。背景知识&#xff1a;linux/unix下动态链接库的基本原理/proc/pid/maps文件的基本格式动态链接库&#xff1a;在进程执行过程中动态加载&#xff0c;进程间可以共…

C#获取屏幕大小的“简单整理”。。

额…… 首先是有一个需求&#xff0c;两个显示器&#xff0c;程序自动获取自己所在的显示器大小&#xff0c;并显示到右下角。 我们都知道C#有一个Screen.PrimaryScreen.Bounds&#xff0c;可以获取屏幕的完整尺寸&#xff0c;但是只能获取主显示器的尺寸&#xff0c;后来我发…

Spring为什么建议构造器注入?

来源 | juejin.cn/post/6844904056230690824作者 | Richard_Yi本文的内容主要是想探讨我们在进行 Spring 开发过程当中&#xff0c;关于依赖注入的几个知识点&#xff0c;具体内容如下&#xff1a;Autowired, Resource, Inject 三个注解的区别当你在使用Autowired时&#xff0…

c#中的long类型示例_C#中带示例的带符号字节数组

c#中的long类型示例C&#xff03;中的有符号字节数组 (Signed Byte Array in C#) In C#.Net, we can create a signed byte array by using sbyte, sbyte is used to store both of the values (negative and positive) between the range of -128 to 127 (Signed 8 bits integ…

Shell中的while循环

while循环的格式while expressiondocommandcommanddone1、计数器控制的while循环主要用于已经准确知道要输入的数据和字符串的数目。举例1 #!/bin/sh2 int13 while(( $int<5 ))4 do5 echo $int6 let "int"7 done2、结束标记控制的while循环主要用于不知道读入数据…

一文玩转 EhCache 缓存框架!

Ehcache 介绍EhCache 从 Hibernate 发展而来&#xff0c;是一个纯Java的进程内缓存框架&#xff0c;具有快速、精干等特点。Ehcache是一种广泛使用的开源Java分布式缓存。主要面向通用缓存&#xff0c;Java EE和轻量级容器。它具有内存和磁盘存储&#xff0c;缓存加载器&#x…

avr uart打印_AVR | 在16x2 LCD上打印HELLO WORLD

avr uart打印We would learn the connection to the LCD first as the connections is a bit complex and here we are using an 8-bit LCD. 我们将首先学习到LCD的连接&#xff0c;因为连接有点复杂&#xff0c;这里我们使用的是8位LCD 。 Simulation 模拟 Explanation 说明…

SQLite CodeFirst、Migration 的趟坑过程 [附源码]

负二、配置说明 最近想做个东西&#xff0c;用到了SQLite&#xff0c;按照之前的方法步骤搭建的结果失败了&#xff0c;因为SQLite的版本升级了&#xff0c;导致Migration自动迁移各种报错&#xff0c;而且我查了一下自动迁移的包貌是不再更新了。——2018年1月24日 能正常使用…

linux中lvm的缩减

问题提出&#xff1a;服务器硬盘做成了lvm&#xff0c;但是/home目录空间较大&#xff0c;于是想缩减一下&#xff0c;分配给其他目录。实验环境&#xff1a;操作系统&#xff1a;redhat企业版&#xff0c;硬盘已经做成了lvm。问题解决&#xff1a;操作前的注意事项&#xff1a…

SpringBoot 过滤器、拦截器、监听器对比及使用场景!

来源 | blog.csdn.net/qq_38020915/article/details/116431612作者 | dingwen_blog一、关系图理解二、区别1.过滤器过滤器是在web应用启动的时候初始化一次, 在web应用停止的时候销毁可以对请求的URL进行过滤, 对敏感词过滤挡在拦截器的外层实现的是 javax.servlet.Filter 接口…

Java StringBuilder length()方法与示例

StringBuilder类的length()方法 (StringBuilder Class length() method) length() method is available in java.lang package. length()方法在java.lang包中可用。 length() method is used to return the length of this sequence (i.e. it counts the number of characters …

进程通信:匿名管道和命名管道

一、进程间通信方式 管道( pipe )&#xff1a;管道是一种半双工的通信方式&#xff0c;数据只能单向流动&#xff0c;而且只能在具有亲缘关系的进程间使用。进程的亲缘关系通常是指父子进程关系。有名管道 (named pipe) &#xff1a; 有名管道也是半双工的通信方式&#xff0c…

Jenkins Build Radiators(构建发射源)

为什么80%的码农都做不了架构师&#xff1f;>>> information radiators&#xff08;信息发射源&#xff09;的概念通常被用在敏捷的圈子里。 据敏捷专家Alistair Cockburn所说&#xff1a; 一个信息发射源是一个贴在一个地方的显示器&#xff0c;当人们工作或路过时…

线程池是如何重复利用空闲的线程来执行任务的?

来源&#xff1a;blog.csdn.net/anhenzhufeng/article/details/88870374在Java开发中&#xff0c;经常需要创建线程去执行一些任务&#xff0c;实现起来也非常方便&#xff0c;但如果并发的线程数量很多&#xff0c;并且每个线程都是执行一个时间很短的任务就结束了&#xff0c…