When calling the OLS Module in LinearRegression bundle for training the model. It prompts the error that "Object math doesnot have a member named Beta" and "unknown identifier Beta". However, in the Match Module Beta function is already present.
Followed the documentation and lectures of Linear Regression to implement an LR model. Follow the same steps provided in the tutorial but this error still not able to fix. Output to see train and test data they are in the required format too. The final output expected is to learn the model and do prediction. I used this tutorial to set up my code: .I used this tutorial to set up my code:
IMPORT ETL, STD;
IMPORT Visualizer;
IMPORT ML_Core;
IMPORT LinearRegression AS LR;
dNewData := DATASET([{20220101, 20000},
{20220201, 30000},
{20220301, 40000},
{20220401, 50000},
{20220501, 60000}], {UNSIGNED date_build, UNSIGNED matched_counts});
OUTPUT(dNewData, NAMED('dummy_data'));
dTrain := PROJECT(dNewData[1..(COUNT(dNewData)-1)], RECORDOF(dNewData));
dTest := PROJECT(dNewData[COUNT(dNewData)..COUNT(dNewData)], RECORDOF(dNewData));
OUTPUT(dTrain);
OUTPUT(dTest);
ML_Core.AppendSeqId(dTrain, Id, dTrain_Id);
ML_Core.AppendSeqId(dTest, Id, dTest_Id);
OUTPUT(dTrain_Id);
OUTPUT(dTest_Id);
ML_Core.ToField(dTrain_Id, dTrainNF);
ML_Core.ToField(dTest_Id, dTestNF);
OUTPUT(dTrainNF);
OUTPUT(dTestNF);
dTrainNF_Ind := dTrainNF(number < 2); //number represnts the field number
dTrainNF_Dep := PROJECT(dTrainNF(number = 2), TRANSFORM(RECORDOF(LEFT),
SELF.number := 1,
SELF := LEFT ));
OUTPUT(dTrainNF_Ind);
OUTPUT(dTrainNF_Dep);
dTestNF_Ind := dTestNF(number < 2);
dTestNF_Dep := PROJECT(dTestNF(number = 2), TRANSFORM(RECORDOF(LEFT),
SELF.number := 1,
SELF := LEFT ));
//Learning a Linear Regression model
LinearRegressor := LR.OLS(dTrainNF_Ind, dTrainNF_Dep);
LR_Model := LinearRegressor.GetModel;
Betas := LinearRegressor.Betas();
//Predicting the number of records in the test set.
Predict := LinearRegressor.Predict(dTestNF_Ind, LR_Model);
OUTPUT(Predict);