遇到代理问题,我尝试在this instruction之后的Windows中从本地副本安装cat for L。
唯一的区别是我没有通过gitbash下载catboost repo,而是通过网站手动下载。
我已经安装了python并将其添加到路径中。
我已经安装了 Visual Studio Community 2017 ,Windows平台开发和使用C ++选项的桌面开发。
我还安装了用于桌面(x86,x64)和VC ++ 2017 v141工具集(x86,x64)选项的VC ++ 2015.3 v140工具集。
直到这里没有问题或警告。
然后我将工作目录设置为catboost R-package。然后使用devtools构建和安装包。
这里我对build有以下警告:
> devtools::build()
"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore --quiet CMD build \
"C:\Users\xq.do\Downloads\catboost-master\catboost-master\catboost\R-package" \
--no-resave-data --no-manual
* checking for file 'C:\Users\xq.do\Downloads\catboost-master\catboost-master\catboost\R-package/DESCRIPTION' ... OK
* preparing 'catboost':
* checking DESCRIPTION meta-information ... OK
* cleaning src
Warning: C:/Users/xq.do/AppData/Local/Temp/RtmpCaOZOZ/Rbuild1f043c9b6da4/catboost/man/catboost.train.Rd:56: unknown macro '\t'
Warning: C:/Users/xq.do/AppData/Local/Temp/RtmpCaOZOZ/Rbuild1f043c9b6da4/catboost/man/catboost.train.Rd:56: unknown macro '\t'
Warning: C:/Users/xq.do/AppData/Local/Temp/RtmpCaOZOZ/Rbuild1f043c9b6da4/catboost/man/catboost.train.Rd:56: unknown macro '\t'
Warning: C:/Users/xq.do/AppData/Local/Temp/RtmpCaOZOZ/Rbuild1f043c9b6da4/catboost/man/catboost.train.Rd:56: unknown macro '\t'
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'catboost_0.7.2.tar.gz'
[1] "C:/Users/xq.do/Downloads/catboost-master/catboost-master/catboost/catboost_0.7.2.tar.gz"
以及安装时出现以下错误:
> devtools::install()
Installing catboost
"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore --quiet CMD INSTALL \
"C:/Users/xq.do/Downloads/catboost-master/catboost-master/catboost/R-package" \
--library="C:/documents/xq.do/Documents/R/win-library/3.4" --install-tests
* installing *source* package 'catboost' ...
** libs
running 'src/Makefile.win' ...
/cygdrive/c/Users/xq.do/Downloads/catboost-master/catboost-master/catboost/R-package/src/../../../ya.bat make -r -o ../../..
ERROR: <urlopen error timed out>
ERROR: <urlopen error timed out>
ERROR: <urlopen error timed out>
ERROR: <urlopen error timed out>
ERROR: <urlopen error timed out>
ERROR: <urlopen error timed out>
make: *** [all] Error 1
Warning: l'exécution de la commande 'make --no-print-directory -f "Makefile.win"' renvoie un statut 2
ERROR: compilation failed for package 'catboost'
* removing 'C:/documents/xq.do/Documents/R/win-library/3.4/catboost'
In R CMD INSTALL
Error: Command failed (1)
这是我的R会话信息:
> session_info()
Session info ----------------------------------------------------------------------
setting value
version R version 3.4.4 (2018-03-15)
system x86_64, mingw32
ui RStudio (1.1.442)
language (EN)
collate French_France.1252
tz Europe/Paris
date 2018-04-06
Packages --------------------------------------------------------------------------
package * version date source
base * 3.4.4 2018-03-15 local
compiler 3.4.4 2018-03-15 local
datasets * 3.4.4 2018-03-15 local
devtools * 1.13.5 2018-02-18 CRAN (R 3.4.3)
digest 0.6.15 2018-01-28 CRAN (R 3.4.3)
graphics * 3.4.4 2018-03-15 local
grDevices * 3.4.4 2018-03-15 local
memoise 1.1.0 2017-04-21 CRAN (R 3.4.4)
methods * 3.4.4 2018-03-15 local
stats * 3.4.4 2018-03-15 local
tools 3.4.4 2018-03-15 local
utils * 3.4.4 2018-03-15 local
withr 2.1.2 2018-03-15 CRAN (R 3.4.4)
yaml 2.1.18 2018-03-08 CRAN (R 3.4.4)
答案 0 :(得分:1)
Yandex团队提供了R套餐。他们应该更新他们的R指令页面。
您可以按如下方式下载并安装适用于Windows的0.7.2版软件包:
devtools::install_url('https://github.com/catboost/catboost/releases/download/v0.7.2/catboost-R-Windows-0.7.2.tgz', args = c("--no-multiarch"))
从releases page.下载软件包当有新版本时,只需更改网址中的版本号并下载新版本。
答案 1 :(得分:0)
为R安装CatBoost
# install.packages("devtools")
library(devtools)
devtools::install_github('catboost/catboost', subdir = 'catboost/R-package')
答案 2 :(得分:0)
我第一次使用devtools安装CatBoost时也遇到了一些问题。所以,这些是我当时所做的:
使用from gekko import GEKKO
import numpy as np
m = GEKKO()
m.options.SOLVER=1
# optional solver settings with APOPT
m.solver_options = ['minlp_maximum_iterations 1000', \
# minlp iterations with integer solution
'minlp_max_iter_with_int_sol 100', \
# treat minlp as nlp
'minlp_as_nlp 1', \
# nlp sub-problem max iterations
'nlp_maximum_iterations 5000', \
# 1 = depth first, 2 = breadth first
'minlp_branch_method 1', \
# maximum deviation from whole number
'minlp_integer_tol 0.0005', \
# covergence tolerance
'minlp_gap_tol 0.0001']
n = 128
p = 8
q = 16
x = m.Array(m.Var,(n,n),integer=True)
for i in range(n):
for j in range(n):
x[i,j].value = 1
x[i,j].lower = 0
x[i,j].upper = 1
s = 60
# don't need a gekko array here, constants are okay
#a = m.Array(m.Param,(x.shape[0],))
a = np.array([172,282,10, 264, 287, 442, 393, 428, 484, 444, 344, 250, 293, 34, 473, 110, 338, 62,
250, 205, 81, 336, 249, 199, 328, 447, 408, 82, 357, 334, 181, 133, 378, 79, 292, 103,
494, 382, 10, 477, 237, 267, 337, 313, 395, 110, 114, 381, 52, 232, 457, 69, 167, 344,
363, 284, 136 ,240, 258, 449, 119, 317, 370, 404, 197, 102, 428, 238, 321, 103, 282, 37,
41, 86, 496 ,31, 148, 245, 78, 219, 37, 115, 378, 129, 37, 448, 415, 368, 238, 406,
408, 100, 112 ,289 ,205, 329, 338, 396, 494, 145, 355, 45, 5, 220, 411, 167, 85, 369,
426, 442, 406 ,217, 57, 176, 12, 368, 444, 227, 337, 63, 267, 216, 227, 182, 408, 116,
385, 140])
# use .value to assign a value instead of over-writing the gekko variable
# with a floating point number
#for i in range(len(a)):
# a[i].value = a_[i]
O1 = np.array(range(n))
O_= np.transpose(np.nonzero(O1+1))
O = np.zeros((x.shape[0],x.shape[1]),dtype=int)
for i in range(n):
for j in range(n):
O[i,O_[i]] = 1
d = np.empty((p,q)) # doesn't need to be a gekko array
for i in range(p):
for j in range(q):
d[i,j] = (round(p/2)-int(i/2))*4-(j%4)
#condition - use m.abs2 or m.abs3 for versions of ABS that
# have continuous first and second derivatives
xabs = [[m.Intermediate(m.abs3(x[i,j]-O[i,j])) for j in range(n)] for i in range(n)]
# matrix summation
msum = m.sum([m.sum([xabs[i][j] for i in range(n)]) for j in range(n)])
m.Equation(msum<=2*s)
for i in range(n):
m.Equation(m.sum(x[:,i])==1)
for i in range(n):
m.Equation(m.sum(x[i,:])==1)
#Objective - can add multiple objectives
e = d.reshape(n)
for i in range(n):
for j in range(n):
m.Obj(a[i]*x[i,j]*e[j])
#m.Obj(m.sum(a.T*m.sum(x*d.reshape(1,n))))
#Set global options
m.options.IMODE = 3
#Solve simulation
m.solve(disp=True,debug=True)
安装文件。尝试这样的事情:
install.packages()
以上步骤对我来说效果很好。在某些情况下,必须将文件扩展名从install.packages("C:/Users/AnastasiyaRomanova/Downloads/catboost-R-Windows-0.18.1.tgz", repos = NULL, type = "source", INSTALL_opts = c("--no-multiarch", "--no-test-load"))
重命名为.tgz
,以免发生错误。