You need to enable JavaScript to run this app. 如何使用python-weka-wrapper实现pos_x与pos_y的预测?
优惠活动
大模型
产品
解决方案
定价
更多

如何使用python-weka-wrapper实现pos_x与pos_y的预测?

问题描述
  • 计划基于python-weka-wrapper实现预测功能,通过循环逻辑完成自动化批量结果输出,目前程序始终无法正常运行
  • 对照Weka图形界面的可正常复现操作流程:
    1. 启动Weka
    2. 进入Explorer功能页的Preprocess标签,导入目标arff格式数据文件
    3. 切换到Forecast标签页,选中需要预测的两个属性
    4. 点击Start按钮即可得到正常运行的输出结果
  • 暂未定位到代码错误根源:不清楚如何在代码中实现目标属性选择逻辑,即指定待预测的字段
数据集样本
@relation data_new3

@attribute pos_x numeric
@attribute pos_y numeric
@attribute angle numeric
@attribute vel numeric
@attribute vel_x numeric
@attribute vel_y numeric

@data
414049364,21773560,75.06043,16.775027,15.827037,-5.559355
414049656,21773926,43.232657,4.452031,3.258594,-3.033504
414049938,21774287,43.836066,4.347145,4.300749,-0.633426
414050204,21774638,44.704315,4.157368,3.119995,2.747606
当前调试代码
import weka.core.jvm as jvm
import weka.core.converters as conv
from weka.classifiers import Evaluation, Classifier
from weka.core.classes import Random
import weka.plot.classifiers as plcls
df = conv.load_any_file("data_new3.arff")
df.class_is_last()

cls = Classifier(classname="weka.classifiers.functions.LinearRegression", options=["-C","-S","1"])
evl = Evaluation(df)
evl.crossvalidate_model(cls, df, 10, Random(1))
plcls.plot_classifier_errors(evl.predictions, absolute=False, wait=True)
现存代码适配问题
  • 需求为预测pos_x和pos_y两个属性,目前代码仅通过df.class_is_last()方法将数据集最后一个属性设为预测目标,无法匹配多目标预测的要求
  • 如果移除类标签配置、将数据集设置为无类标签状态,代码会直接运行报错
  • 无法复刻Weka图形界面中Forecast模块的多属性预测逻辑,找不到对应的代码实现入口

内容的提问来源于stack exchange,提问作者jonny5

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.11.04 21:06:03