How to fix HPCC ECL Learning Trees Error: Object 'types' does not have a member named 't_Work-Item'?

How to fix HPCC ECL Learning Trees Error: Object 'types' does not have a member named 't_Work-Item'?

我正在尝试使用 HPCC ML_Core 和 LearningTree 库对一些数据进行分类。数据全部为数值,因变量为无符号整数。无论我做什么,我都会得到同样的错误 "Object 'types' does not have a member named 't_Work_Item' "

错误的位置甚至不在我的文件中。它位于名为 RF_Base.ecl.

的文件中

我不知道如何解决这个错误。

我使用本教程来设置我的代码:https://hpccsystems.com/blog/HPCC-Sytems-Machine-Learning

这些是我收到的错误消息:

图片Link:https://i.imgur.com/4WxElRJ.jpg

我已将我正在处理的文件移动到与我安装的捆绑包相同的文件中,以查看将我的文件放在与库相同的位置是否会有帮助,但它没有。

错误出现在第62行:myLearnerC := LT.ClassificationForest();

IMPORT ML_Core, std;
IMPORT ML_Core.Discretize;
IMPORT LearningTrees AS LT;

articles_layout := RECORD
    INTEGER articleID;
    UNSIGNED INTEGER sectionName; //dependent variable I'm trying to classify
    INTEGER newsDesk; //newsDesk to key9 are independent variables I'm using to classify the section name
    INTEGER key1;
    INTEGER key2;
    INTEGER key3;
    INTEGER key4;
    INTEGER key5;
    INTEGER key6;
    INTEGER key7;
    INTEGER key8;
    INTEGER key9; //not all key attributes have data, some are empty
END;

all_articles := DATASET('~online::hjj::parsed_articles_reordered', articles_layout, CSV) : PERSIST('online::hjj::all_articles');
//all_articles[1..40];

known_articles := all_articles(sectionName != 25);
//known_articles[1..40];

unknown_articles := all_articles(sectionName = 25) : PERSIST('online::hjj::unknown_articles');
//unknown_articles[1..40];


articles_layout_ext := RECORD(articles_layout)
  UNSIGNED4 RND;
END;

articles_ext := PROJECT(known_articles, TRANSFORM(articles_layout_ext, SELF.rnd := RANDOM(), SELF := LEFT));

articles_shuffled := SORT(articles_ext, rnd);

training_articles := PROJECT(articles_shuffled[1..2330], articles_layout) : PERSIST('online:hjj::training_articles');
//training_articles[1..30];

testing_articles := PROJECT(articles_shuffled[2331..2923], articles_layout) : PERSIST('online:hjj::testing_articles');
//testing_articles[1..30];

ML_Core.ToField(training_articles, training_articles_NF);
training_articles_NF[1..50];

ML_Core.ToField(testing_articles, testing_articles_NF);
testing_articles_NF[1..50];

myIndTrainDataNF := training_articles_NF(number > 1);

myDepTrainDataNF := PROJECT(training_articles_NF(number = 1), TRANSFORM(RECORDOF(LEFT), SELF.number := 1, SELF := LEFT));

myIndTestDataNF := training_articles_NF(number > 1);

myDepTestDataNF := PROJECT(testing_articles_NF(number = 1), TRANSFORM(RECORDOF(LEFT), SELF.number := 1, SELF := LEFT));

myDepTrainDataDF := Discretize.ByRounding(myDepTrainDataNF);

myDepTestDataDF := Discretize.ByRounding(myDepTestDataNF);

//PROBLEM STATEMENT HERE
myLearnerC := LT.ClassificationForest();

myModelC := myLearnerC.GetModel(myIndTrainDataNF, myDepTrainDataDF);

predictedClasses := myLearnerC.Classify(myModelC, myIndTestDataNF) : PERSIST('online::hjj::predicted_classes');

assessmentC := ML_Core.Analysis.Classification.Accuracy(predictedClasses, myDepTestDataDF) : PERSIST('online::hjj::assessment');

错误在 RF_Base.ecl 文件的第 14 行

IMPORT $.^ AS LT;
IMPORT LT.Internal AS int;
IMPORT LT.LT_Types as Types;
IMPORT ML_Core as ML;
IMPORT ML.Types AS CTypes;
IMPORT std.system.Thorlib;
IMPORT ML_Core.ModelOps2;

GenField := Types.GenField;
ModelStats := Types.ModelStats;

//ERROR HERE
t_Work_Item := CTypes.t_Work_Item;

t_Count := CTypes.t_Count;
t_RecordId := CTypes.t_RecordID;
t_FieldNumber := CTypes.t_FieldNumber;
t_TreeId := t_FieldNumber;
Layout_Model := CTypes.Layout_Model;
wiInfo := Types.wiInfo;
TreeNodeDat := Types.TreeNodeDat;
NumericField := CTypes.NumericField;
DiscreteField := CTypes.DiscreteField;
Layout_Model2 := CTypes.Layout_Model2;
FeatureImportanceRec := Types.FeatureImportanceRec;
nfNull := DATASET([], NumericField);

真的不确定如何解决这个问题。提前致谢。

这里发生了什么?

1- 您的代码失败,因为 LearningTrees (LT) 失败:

IMPORT LearningTrees AS LT;
[...]
myLearnerC := LT.ClassificationForest();

2- LearningTrees 使用 RF_Base.ecl,但由于存在错误而无法构建。

3- RF_Base.ecl 文件在第 14、19 和 24 行有 3 个语法错误...因此未构建。

解决方案:"Fix RF_Base.ecl and everything should work"。

说起来容易做起来难

我克隆了:

  • ML_Core
  • ecl-ml
  • 学习树

...和 ​​RF_Base.ecl 并且有效。

你应该尝试什么?

  • 检查您是否克隆了所有 3 个库
  • 检查路径是否与我的一样: