我有以下代码:
#load required library
library(data.tree)
library(entropy)
library(RWeka)
library(partykit)
library(FSelector)
library(e1071)
library(caret)
library(RWekajars)
#Load dataset
rest_contries <- fromJSON("https://restcountries.eu/rest/v1/all")
View(rest_contries)
class(rest_contries)
dim(rest_contries)
cleaned_rest_countries <- rest_contries[,c(1,2,5,6)]
View(cleaned_rest_countries)
#================ J48 Algorithm =================================================
m <- J48(region~., data = cleaned_rest_countries)
plot(m)
这应该为我绘制来自 J48 算法的贝叶斯网络图。我怎么会收到以下错误:
> m <- J48(region~., data = cleaned_rest_countries)
Error in .jcall(o, "Ljava/lang/Class;", "getClass") :
weka.core.UnsupportedAttributeTypeException: weka.classifiers.trees.j48.C45PruneableClassifierTree: Cannot handle string attributes!
请协助解决问题。当我从 CSV 读取数据时,它运行良好,但从 json 中我得到一个字符串属性错误。