Convert NA values to ? automatically while loading

南楼画角 提交于 2019-12-11 10:48:32

问题


Is there a way to automatically convert NA values to ? in weka while loading .csv files? Or do we have to use some other script/program to either replace them with ? or a blank space before loading into weka.

Any help or suggestions are welcome. Thanks


回答1:


Unfortunately I do not believe Weka has a way to do this conversion. This is the case because Weka's native format is .arff files. In .arff files, missing values are denoted with a "?". When a .csv file is loaded, it expects missing values to also be denoted by "?".

Depending on your method of using Weka I suggest:

  1. For the Weka GUI, use "find and replace" in a simple text editor to change "NA" to "?" before loading the .csv into Weka.

  2. For the Weka Java API, write a method to preprocess your ".csv" file before handing it over to the Weka .csv loader.



来源:https://stackoverflow.com/questions/19210756/convert-na-values-to-automatically-while-loading

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!