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安装的更多相关文章

  1. linux xlearn安装

     机器学习中的又一个利器,广泛用于Kaggle或类似的数据比赛. xlearn的优势: 1.通用性好,包括主流的算法(lr, fm, ffm 等),用户不用再切换于不同软件之间 2.性能好,测试 xL ...

  2. docker——容器安装tomcat

    写在前面: 继续docker的学习,学习了docker的基本常用命令之后,我在docker上安装jdk,tomcat两个基本的java web工具,这里对操作流程记录一下. 软件准备: 1.jdk-7 ...

  3. 网络原因导致 npm 软件包 node-sass / gulp-sass 安装失败的处理办法

    如果你正在构建一个基于 gulp 的前端自动化开发环境,那么极有可能会用到 gulp-sass ,由于网络原因你可能会安装失败,因为安装过程中部分细节会到亚马逊云服务器上获取文件.本文主要讨论在不变更 ...

  4. Sublime Text3安装JsHint

    介绍 Sublime Text3使用jshint依赖Nodejs,SublimeLinter和Sublimelinter-jshint. NodeJs的安装省略. 安装SublimeLinter Su ...

  5. Fabio 安装和简单使用

    Fabio(Go 语言):https://github.com/eBay/fabio Fabio 是一个快速.现代.zero-conf 负载均衡 HTTP(S) 路由器,用于部署 Consul 管理的 ...

  6. gentoo 安装

    加载完光驱后 1进行ping命令查看网络是否通畅 2设置硬盘的标识为GPT(主要用于64位且启动模式为UEFI,还有一个是MBR,主要用于32位且启动模式为bois) parted -a optima ...

  7. 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. ...

  8. 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 服务器安装操 ...

  9. 【原】nodejs全局安装和本地安装的区别

    来微信支付有2年多了,从2年前的互联网模式转变为O2O模式,主要的场景是跟线下的商户去打交道,不像以往的互联网模式,有产品经理提需求,我们帮忙去解决问题. 转型后是这样的,团队成员更多需要去寻找业务的 ...

随机推荐

  1. Python图像处理库Pillow入门

    http://python.jobbole.com/84956/ Pillow是Python里的图像处理库(PIL:Python Image Library),提供了了广泛的文件格式支持,强大的图像处 ...

  2. c++编译/连接/运行

    1.gcc命令&makefile语法&makefile编写: https://www.cnblogs.com/ycloneal/p/5230266.html 2.头文件&库文件 ...

  3. java maven项目打包

    使用IDEA打包,首先调出来maven projects窗口: 菜单栏Help->Find Action(Ctrl+Shift+A),输入Maven projects https://blog. ...

  4. unity里无损实现制定物体bloom

    虽然标题是实现hdr+bloom,但实际感觉更像是控制单个物体bloom https://blog.csdn.net/zsy654321/article/details/80682651

  5. C++ 常见字符处理 收录

    1.string字符串删除 字符串中 指定字符 std::string& HTTPRequestHandlerImpl::replace_all_distinct(std::string&am ...

  6. selenium入门基础知识

    内容转载自:http://blog.csdn.net/huangbowen521/article/details/7816538 1.selenium介绍: Selenium是一个浏览器自动化操作框架 ...

  7. Go语言版本的helloworld

    新建一个project,然后建立一个main目录,在main目录下新建一个go类文件:main.go 内容如下: package main import "fmt" func ma ...

  8. python 数据库查询条件`不等于`

    1.python 数据库查询条件不等于 当在做数据库查询的时候,想根据业务需求进行条件的筛选或过滤, 但是django封装的数据库语句中没有 '不等于' 查询操作. 2.例如:通过以下语句进行'不等于 ...

  9. jquery请求数据

    $(document).ready(function() { $.ajax({ url: "http://123.207.88.84:8080/zdm/AppApi/Search/Categ ...

  10. 初级dba学习之路参考

    今天周一拖着疲惫的身躯 11点才离开公司,回到家估计写完这篇博客就要17号了. 一个人走在回家的路上,很黑,突然很多感触,一个人在北京拼搏,不敢停止学习的脚步,因为只要停下来就会感觉到孤独. 回顾一下 ...