日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2025/3/11 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 机器学习 属性_属性关系文件格式| 机器学习 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

機器學習 屬性

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(屬性關系文件格式) 。 這種文件格式是由懷卡托大學計算機科學系開發的,顧名思義,該文件包含一個屬性列表和一個類屬性。 屬性關系文件格式大致分為兩部分:

  • Header field

    標頭字段

  • 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標題下用逗號分隔。 上面在屬性字段中提到的數據可以如下:

  • Numerical

    數值型

  • Nominal

    標稱

  • String

  • 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 fileCSVLoader load = new CSVLoader();loader.setSource(new File("C:\\Users\\Logan\\Desktop\\ML\\linearregression\\headbrain.csv"));Instances data = load.getDataSet();//get instances objectArffSaver save = new ArffSaver();save.setInstances(data);//set the dataset we want to convertsave.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

    機器學習 屬性

    總結

    以上是生活随笔為你收集整理的机器学习 属性_属性关系文件格式| 机器学习的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。