数据-R语言-图表-决策-Linux-PythonR语言:TCGA数据分析R语言小技能

gcForest

2018-11-10  本文已影响7人  Liam_ml

简介

gcForest算法在Zhou和Feng 2017(https://arxiv.org/abs/1702.08835,参考本文的技术细节)和pylablanche(https://github.com/pylablanche)中提出了Python3.X在github上实现这个算法(https://github.com/pylablanche/gcForest)。我们提供了一个名为gcForest的R包,它是pylablanche的gcForest模块(Python3.X)的R接口。如果您想了解更多关于gcForest的信息,请阅读源文章(Deep Forest)。

基本要求

Python 3.X
Numpy> = 1.12.0
Scikit-learn> = 0.18.1

安装

install.packages('gcForest')
devtools::install_github('DataXujing/gcForest_r')

使用gcForest

例子:

library(gcForest)
sk <- reticulate::import('sklearn')
train_test_split <- sk$model_selection$train_test_split

data <- sk$datasets$load_iris
iris <- data()
X = iris$data
y = iris$target
data_split = train_test_split(X, y, test_size=0.33)

X_tr <- data_split[[1]]
X_te <- data_split[[2]]
y_tr <- data_split[[3]]
y_te <- data_split[[4]]

gcforest_m <- gcforest(shape_1X=4L, window=2L, tolerance=0.0)
gcforest_m$fit(X_tr,y_tr)
gcf_model <- model_save(gcforest_m,'../gcforest_model.model')

gcf <- model_load('../gcforest_model.model')
gcf$predict(X_te)
上一篇下一篇

猜你喜欢

热点阅读