Reputation: 249
I am trying to use HPCC ML_Core and LearningTree library to classify some data. The data is all numerical and the dependent variable is an unsigned integer. No matter what I do, I get the same error "Object 'types' does not have a member named 't_Work_Item' "
The location of the error isn't even in my file. It's in a file named RF_Base.ecl.
I cannot figure out how to fix this error.
I used this tutorial to set up my code: https://hpccsystems.com/blog/HPCC-Sytems-Machine-Learning.
These are the error messages I get:
Image Link: https://i.sstatic.net/kGDon.jpg
I've moved the file I'm working on into the same file that the bundles I've installed to see if putting my file in the same location as the library would help, but it did not.
The error occurs on line 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');
The error is on line 14 of the RF_Base.ecl file
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);
Really unsure of how to fix this issue. Thanks in advance.
Upvotes: 1
Views: 180
Reputation: 7025
What happens here?
1- Your code fails because LearningTrees (LT) fails:
IMPORT LearningTrees AS LT;
[...]
myLearnerC := LT.ClassificationForest();
2- LearningTrees uses RF_Base.ecl that does not build because it has errors.
3- RF_Base.ecl files has 3 syntax errors in lines 14, 19 and 24... so it is not built.
SOLUTION: "Fix RF_Base.ecl and everything should work".
Easy to say but hard to do.
I cloned:
...and RF_Base.ecl and works.
What should you try?
Upvotes: 0