weka中使用Liblinear

本文详细介绍了在Linux和Windows系统中如何安装和配置Weka,并通过Weka包管理器下载Liblinear。在Linux中,需要下载和解压Weka,配置环境变量,然后通过包管理器安装Liblinear。在Windows中,需设置环境变量,确保Liblinear的jar文件在CLASSPATH中。对于“Liblinear not in CLASSPATH”的问题,解决方案是下载开发者版本的Weka并使用Weka包管理器安装LibLINEAR。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

LINUX

1. 下载和解压weka。下载:wget http://prdownloads.sourceforge.net/weka/weka-3-7-9.zip。解压weka到该当前目录:unzip weka-3-6-10.zip


2. 配置环境变量。
gedit~/.bashrc
export  WEKAROOT=/home/cming/weka-3-7-9
export  CLASSPATH=$CLASSPATH:$WEKAROOT/weka.jar
Source~/.bashrc


3. 运行WEKA,运行命令:cd $WEKAROOT
运行命令:java -Xmx1000M-jar weka.jar




4.通过weka packagesmanager下载liblinear,先安装WEKA3.7.9,用tools-packagemanager安装liblinear,然后到用户目录wekafiles\packages\LibLINEAR下中找到liblinear.jar在 wekafiles\packages\LibLINEAR\lib下找到liblinear-1.51-with-deps.jar,并将这两个jar放到WEKA-3-7-9的安装目录下。

5.  运行命令:

java -Xmx1024m -cpweka.jar:LibLINEAR.jar:liblinear-1.51-with-deps.jarweka.classifiers.functions.LibLINEAR -S 0 -C 1 -B -1 -t Source.arff -T Target.arff–i


WIN7

1.   环境变量

假设我们的weka.jar的目录在C:/ProgramFiles/Weka-3-6/weka.jar,其中,C:/ProgramFiles/Weka-3-6是weka安装目录。在系统环境变量中添加WEKAROOT:


如果系统环境变量中已经有CLASSPATH,那么,在CLASSPATH后面添加上%WEKAROOT%/weka.jar。如果还没有CLASSPATH,那么,新建一个即可。
运行命令:
java -Xmx1024m -cpweka.jar;LibLINEAR.jar;liblinear-1.51-with-deps.jarweka.classifiers.functions.LibLINEAR -S 0 -C 1 -B -1 -t Source.arff -T Target.arff–i



解决Liblinear not in CLASSPARH, on linux with weka

That's because the liblinear.jar you downloadedis not the original one. The creator of that jar uses his own packagestructure, his classes are placed in
de.bwaldvoge.liblinear
but the standard weka classifier looks for Linear in
liblinear
Onthe bottom of bwaldvogels website that you linked, he gives a link to a Weka wrapper that points to his package.
The Weka package manager isavailable from version 3.7.2 or later, so you have to download the developerversion, since the latest stable is 3.6.9.
Then, simply start the Weka package manager and install LibLINEAR.It worked for me this way. Note, that this will create a "wekafiles"directory in $HOME.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值