我正在使用keras库在r中工作,每当我尝试使用to_categorical()时,它都会给我
“ initialize_python(required_module,use_environment)中的错误: 找不到安装的Python,未加载Python绑定。”
我不确定为什么会这样,我确实安装了Python,即使在互联网上寻找答案后,我也不明白为什么会首先发生这种情况的逻辑。请帮忙!
对于上下文,我尝试执行的代码如下:
ind <- sample(2,nrow(df),replace = T,prob = c(0.8,0.2))
train <- df[ind==1,]
test <- df[ind==2,]
ytrain <- train$label
ytrain_ohe <- to_categorical(ytrain)