xlearn安装
xlearn简介
xLearn is a high performance, easy-to-use, and scalable machine learning package, which can be used to solve large-scale classification and regression problems.
If you are the user of liblinear, libfm, or libffm, now the xLearn is your another better choice. This project comes from the PKU-Cloud lab: homepage
xLearn does not rely on any third-party library, and hence users can just clone the code and compile it by using cmake. Also, xLearn supports very simple python API for users.Apart from this, xLearn supports many useful features that has been widely used in the machine learning competitions like cross-validation, early-stop, etc.

安装步骤
首先确保g++版本在g++.8及以上,确保cmake的版本在3.0以上
不是的话,请先升级g++或者cmake
--------------------------------------------------------------------------------
下载cmake安装包:
cd cmake
./configure
make
sudo make instal
以下说明解压到~目录
tar -zxvf xlearn-master.zip; //在解压后的文件中找到CMakeLists.txt, 添加如下的句话,比如加在26行。
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11 -pthread")
cd xlearn-master;
mkdir build;
cd build
cmake ..
make -j4
测试
./xlearn_train ./small_train.txt -v ./small_test.txt -s -x f1
./xlearn_predict ./small_test.txt ./small_train.txt.model
没有报错,则动态库安装成功。可以用命令行来运行程序。若想用python调用API,则需要执行以下安装步骤。
python 安装
修改.bash_profile文件
添加
export PYTHONPATH=~/xlearn-master/build/python-package/xlearn
source .bash_profile
cd ~/xlearn-master/build/python-package
sh install-python.sh
在当前目录测试,
# coding: utf-8
# This file test the xlearn python package.
# We create a ffm model for binary classification problem.
# The dataset comes from the criteo CTR.
import xlearn as xl # Create factorazation machine
ffm_model = xl.create_ffm() # Set training data and validation data
ffm_model.setTrain("./small_train.txt")
ffm_model.setValidate("./small_test.txt") # Set hyper-parameters
param = { 'task':'binary',
'lr' : 0.2,
'lambda' : 0.002,
'metric' : 'auc' } # Tarin model
ffm_model.fit(param, "model.out") # Predict
ffm_model.setTest("./small_test.txt")
ffm_model.predict("model.out", "output")
testing
以上没有报错,即安装成功。
其它说明请查看,xlearn-master/doc的文件说明。
参考链接
xlearn: https://github.com/aksnzhy/xlearn
cmake: https://cmake.org/download/
xlearn安装的更多相关文章
- linux xlearn安装
机器学习中的又一个利器,广泛用于Kaggle或类似的数据比赛. xlearn的优势: 1.通用性好,包括主流的算法(lr, fm, ffm 等),用户不用再切换于不同软件之间 2.性能好,测试 xL ...
- docker——容器安装tomcat
写在前面: 继续docker的学习,学习了docker的基本常用命令之后,我在docker上安装jdk,tomcat两个基本的java web工具,这里对操作流程记录一下. 软件准备: 1.jdk-7 ...
- 网络原因导致 npm 软件包 node-sass / gulp-sass 安装失败的处理办法
如果你正在构建一个基于 gulp 的前端自动化开发环境,那么极有可能会用到 gulp-sass ,由于网络原因你可能会安装失败,因为安装过程中部分细节会到亚马逊云服务器上获取文件.本文主要讨论在不变更 ...
- Sublime Text3安装JsHint
介绍 Sublime Text3使用jshint依赖Nodejs,SublimeLinter和Sublimelinter-jshint. NodeJs的安装省略. 安装SublimeLinter Su ...
- Fabio 安装和简单使用
Fabio(Go 语言):https://github.com/eBay/fabio Fabio 是一个快速.现代.zero-conf 负载均衡 HTTP(S) 路由器,用于部署 Consul 管理的 ...
- gentoo 安装
加载完光驱后 1进行ping命令查看网络是否通畅 2设置硬盘的标识为GPT(主要用于64位且启动模式为UEFI,还有一个是MBR,主要用于32位且启动模式为bois) parted -a optima ...
- Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级
Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 5.安装Database软件 5. ...
- Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part1:准备工作
Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part1:准备工作 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 1.实施前准备工作 1.1 服务器安装操 ...
- 【原】nodejs全局安装和本地安装的区别
来微信支付有2年多了,从2年前的互联网模式转变为O2O模式,主要的场景是跟线下的商户去打交道,不像以往的互联网模式,有产品经理提需求,我们帮忙去解决问题. 转型后是这样的,团队成员更多需要去寻找业务的 ...
随机推荐
- Java基础 - 面向对象 - 类方法传参
调用方法时可以给该方法传递一个或多个值,传给方法的值叫实参,在方法内部,接收实参的变量叫做形参,形参的声明语法与变量的声明语法一样.形参只在方法内部有效. Java中方法的参数主要有3种,分别为值参数 ...
- Android项目使用Ant多渠道打包(最新sdk)
参考文章: http://blog.csdn.net/liuhe688/article/details/6679879 http://www.eoeandroid.com/thread-323111- ...
- 解决python中write()函数向文件中写中文时出现乱码的问题
今天看<python编程从入门到实践>的第10章文件.异常,在做练习的时候,向文件中写内容,但是写中文就不行,后来在百度上查了众多资料,解决方法如下: 解决:在open()函数中添加一个e ...
- Servlet中参数获取方法
在web.xml里面可以定义两种参数: 一种是全局范围的参数, 一种是servlet内的参数. web.xml里定义参数的应用举例:在做分页功能时,可以在代码中直给定pageSize的值,这样,写死在 ...
- 中文Appium API 文档
该文档是Testerhome官方翻译的源地址:https://github.com/appium/appium/tree/master/docs/cn官方网站上的:http://appium.io/s ...
- php如何实现定时任务,php定时任务方法,最佳解决方案,php自动任务处理
php如何实现定时任务,php定时任务方法,最佳解决方案,php自动任务处理 Joe PHP 2012-01-18 定时任务对于php来说一直都是很多朋友的一个难题,但却很多地方都遇到了.比如说:游戏 ...
- service 需要注意的地方
@service标记的class,只能用于标记了@controller的类,用于其他的会出错 mybatis查询查询到返回记录,查询不到返回null
- Codeforces Round #395 (Div. 2) C. Timofey and a tree
地址:http://codeforces.com/contest/764/problem/C 题目: C. Timofey and a tree time limit per test 2 secon ...
- Sublime Text Shortcuts
Keyboard Shortcuts - Windows/Linux Warning This topic is a draft and may contain wrong information. ...
- Oracle数据库安全(二)资源限制于口令管理
一.资源限制与口令管理概述 1.概要文件介绍: 在Oracle数据库中,用户对数据库和系统资源使用的限制以及对用户口令的管理的是建立概要文件实现的.它是Oracle数据库安全策略的重要组成不封.每个数 ...