rhel7.2从头构建和安装xgboost包
xgboost 是"极端梯度上升"(Extreme Gradient Boosting)的简称, 它类似于梯度上升框架,但是更加高效。它兼具线性模型求解器和树学习算法。因此,它快速的秘诀在于算法在单机上也可以并行计算的能力。
这使得xgboost至少比现有的梯度上升实现有至少10倍的提升。它提供多种目标函数,包括回归,分类和排序。
下面是在rhel7.2从头构建和安装xgboost包的步骤:
安装前提:java、maven、git
设置java环境变量
# vi /etc/profile
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
# source /etc/profile
# yum install -y maven
# git clone --recursive https://github.com/dmlc/xgboost
# cd xgboost
# make -j4
# cd jvm-packages/
# mvn package
如上,表示构建jar包完成。
注:如果出现这个错误
[ERROR] Failed to execute goal org.scalastyle:scalastyle-maven-plugin:0.8.0:check (checkstyle) on project xgboost-jvm: Execution checkstyle of goal org.scalastyle:scalastyle-maven-plugin:0.8.0:check failed: Plugin org.scalastyle:scalastyle-maven-plugin:0.8.0 or one of its dependencies could not be resolved: Could not transfer artifact org.scala-lang:scala-library:jar:2.11.6 from/to central (https://repo.maven.apache.org/maven2): GET request of: org/scala-lang/scala-library/2.11.6/scala-library-2.11.6.jar from central failed: Premature end of Content-Length delimited message body (expected: 5564007; received: 901957 -> [Help 1]
屏蔽pom.xml 此文件中如下内容
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
</configuration>
<executions>
<execution>
<id>checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin> -->
然后在重新执行 mvn package
参考:https://docs.databricks.com/user-guide/faq/xgboost.html
https://xgboost.readthedocs.io/en/latest/jvm/#installation
评论