机器学习 属性

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文件格式的示例,

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和机器学习简介

.minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } } .minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } }

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

输出量

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

机器学习 属性

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

  1. 机器学习算法_五分钟了解机器学习十大算法

    本文为有志于成为数据科学家或对此感兴趣的读者们介绍最流行的机器学习算法. 机器学习是该行业的一个创新且重要的领域.我们为机器学习程序选择的算法类型,取决于我们想要实现的目标. 现在,机器学习有很多算法 ...

  2. 深度学习算法和机器学习算法_是否可以使机器学习算法无需编码

    深度学习算法和机器学习算法 I am a firm believer that the previous step to making your own Machine Learning Algori ...

  3. 机器学习 数据模型_使用PyCaret将机器学习模型运送到数据—第二部分

    机器学习 数据模型 My previous post Machine Learning in SQL using PyCaret 1.0 provided details about integrat ...

  4. python机器学习预测_使用Python和机器学习预测未来的股市趋势

    python机器学习预测 Note from Towards Data Science's editors: While we allow independent authors to publish ...

  5. 机器学习框架_编写生产级机器学习框架的经验教训

    机器学习框架 My wonderful colleagues at Atomwise and I have written a production-level PyTorch framework f ...

  6. java element 属性_属性'value'在'HTMLElement'类型的值上不存在

    我正在玩打字稿,我正在尝试创建一个脚本,在输入框中输入文本时将更新p元素 . html看起来如下: 和 greeter.ts 文件: function greeter(person) { return ...

  7. listview属性_属性提取器:获取ListView即时更新其元素的最佳方法

    listview属性 这篇文章是关于如何处理JavaFX ListViews和TableViews的,以及如何通过这些控件了解所包含元素的更改内容. 我想知道为什么在相关书籍中没有找到关于以下模式的任 ...

  8. 机器学习 美股_我如何使用机器学习来探索英美文学之间的差异

    机器学习 美股 by Sofia Godovykh 索非亚·戈多维克(Sofia Godovykh) 我如何使用机器学习来探索英美文学之间的差异 (How I used machine learnin ...

  9. 机器学习框架_一文了解机器学习框架-TensorFlow的原理和用途

    TensorFlow是Google开发的第二代分布式机器学习系统.于2015年11月在Github上开源,并于2017年1月发布了1.0版本的预览,API接口趋于稳定.目前TensorFlow正处于快 ...

最新文章

  1. MindSpore特性支持类
  2. PyTorch 1.6正式发布!新增自动混合精度训练、Windows版开发维护权移交微软
  3. Spring Boot 2.x基础教程:使用 Thymeleaf开发Web页面
  4. 《笨办法学python》(《learn python the hard way 3thrd》)习题48(ex48)的代码实现
  5. 怎么看联想计算机的ip,如何查看本机ip
  6. Mybatis的缓存机制Cache
  7. 小程序promise封装post请求_Promise封装微信小程序的Request请求
  8. PHP移除json数据最右侧的逗号!
  9. 去掉chrome、safari input或textarea在得到焦点时出现黄色边框的方法
  10. Kali学习笔记15:防火墙识别、负载均衡识别、WAF识别
  11. linux c99 可变长数组,C中不支持可变长度数组C99(Variable length arrays C99 not supported in C)...
  12. Spring源码分析之SpringMVC的DispatcherServlet是如何处理Http请求的
  13. OpenMP并行加速笛卡尔乘积
  14. quartus仿真15:全加器和半加器及如何生成符号文件
  15. DS博客作业02--线性表
  16. 思源黑体(魅族)、方正兰亭(小米)、冬青黑体(锤子)比较
  17. HTML 做个漂亮的表格
  18. VMware安裝Ubuntu 16.04.4-server服务器版
  19. 路由的query参数
  20. 新电脑将软件安装到D盘的操作说明

热门文章

  1. centos系统linux复制命令行,linux系统CentOS7中find命令使用
  2. 8软件遇到的问题及解决方法_Excel工作表中的8个常见问题,你一定遇到过,附解决方法...
  3. zabbix5.2安装-linux
  4. C# teacher类【C#】
  5. JVM快速调优手册02:常见的垃圾收集器
  6. Shell编程—企业生产案例
  7. [js高手之路] html5 canvas系列教程 - 掌握画直线图形的常用API
  8. 用U盘作为启动盘做系统步骤
  9. PAT (Advanced Level) 1038. Recover the Smallest Number (30)
  10. AgileEAS.NET SOA 中间件平台.Net Socket通信框架-完整应用例子-在线聊天室系统-代码解析...