日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

xlearn安装

發布時間:2025/4/14 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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++4.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 2 -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/

轉載于:https://www.cnblogs.com/hdu-2010/p/7908723.html

總結

以上是生活随笔為你收集整理的xlearn安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。