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模式,主要的场景是跟线下的商户去打交道,不像以往的互联网模式,有产品经理提需求,我们帮忙去解决问题. 转型后是这样的,团队成员更多需要去寻找业务的 ...
随机推荐
- IO 包中的其他类
打印流 PrintWriter 和 PrintWriter 直接操作输入流和文件 序列流 SequenceInputStream 对多个输入流进行合并 操作对象 ObjectInputStream 和 ...
- 总结!linux 消耗内存和cpu 定时任务
1. c脚本 消耗内存 1)在your_directory目录下,创建文件eatmem.c ,输入以下内容 2)编译:gcc eatmem.c -o eatmem 3) 创建定时任务,每15分钟执行: ...
- elastic search安装与本地测试
elastic search安装与本地测试 elastic search是一个全文搜索引擎 教程: 综合:http://www.ruanyifeng.com/blog/2017/08/elastics ...
- socketserver模块、MySQL(数据库、数据表的操作)
一.socketserver实现并发 基于tcp的套接字,关键就是两个循环,一个链接循环,一个通信循环. socketserver模块中分两大类:server类(解决链接问题)和request类(解决 ...
- 003-spring结合java类调用quartz
一.利弊 针对001 中设置,不方便程序中动态添加任务,只能使用配置进行配置任务, 适用于已知固定时刻需要执行的任务. 针对002中设置,不方便结合调用spring注入的实体 使用于程序内部新增添的任 ...
- Verilog学习总结
1.多个always语句不能对同一变量赋值. 2.assign语句只能进行阻塞赋值,用来描述组合逻辑. 3.verilog描述方式:结构描述(门级描述和模块调用).数据流描述(assign,wire型 ...
- Linux指令od和hexdump
Linux指令:od (octal dump) 示例用法:od -c hello Linux指令:od od命令用户通常使用od命令查看特殊格式的文件内容.通过指定该命令的不同选项可以以十进制.八进制 ...
- List To Json
命名空间 using Newtonsoft.Json; 实例代码 /// <summary> /// 将list集合转换为json /// </summary> /// < ...
- 移植MarS Board代码到内核3.0.35
MarS Board提供的出厂Linux内核是3.0.15的.而Freescale的BSP都早已经更新到3.0.35.为了跟上节奏,我花了点时间把关于marsboard代码从3.0.15移植到了Fre ...
- Mysql:实现分组查询拼接未分组同一字段字符group_concat()
Mysql:实现分组查询拼接未分组同一字段字符group_concat() MySQL中,如果想实现将分组之后的多个数据合并到一列,可以使用group_concat函数,如下图所示: 在oralce中 ...