-
Posts
49 -
Joined
-
Last visited
-
Days Won
1
patjdixon last won the day on September 14 2022
patjdixon had the most liked content!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
patjdixon's Achievements
-
If you use a formula to create a regression model, such as: $target.regressionModelOLS($training, false, $signal1, $signal2) you cannot access model statistics and coefficients, like these: Therefore, to get this data you need to use the Get() function. However, it does not work on an existing model. It only seems to work if the model is created in the same formula as the Get() function Is there any work around? I was hoping DataLab might help, but if I search the prediction tag for all properties I get 23 columns, none of which are coefficients.
-
Hurrah, done! Mark, thanks for hanging in there. I know I was slow on the uptick, but when I finally figured out the dictionary list thing it worked. The problem I had is that I did not know what format Formula Parameters was. The fixed code is attached. My next issue is going to be getting model coefficients. When you create a regression model with a formula instead of using the WorkBench 'Model & Predict' interface, you cannot see the statistics and model coefficients. The Get() formula does not seem to work unless you re-specify the model formula. I am going to create a separate topic on that. PM_SIM_SetModels_230416.ipynb
-
Mark, I will try your way and ensure the search returns IDs
-
I am getting closer. The first attachment shows the format of Formula Parameters in the metadata The next attachment shows that the only difference is double quotes instead of single quotes How would I fix this?
-
The issue is that a variable used for Formula Parameters requires some unknown format or syntax, or can't be done at all. In the first attachment, I use a hard coded Formula Parameters argument, and it works as expected In the next attachment, I use the variable FormulaList with the ID appended and I get a syntax error In the last attachment, I format FormulaList as a string and the push fails Has anyone ever done this successfully?
-
I got the following error:
-
How would I apply this to the creation of the formula parameters argument in the following line? FormVarList = FormVarList + '"$' + InputName + '":"' + InputVar + '_ID["ID"].iloc[0]", '
-
PM_SIM_SetModels_230416.ipynb is attached PM_SIM_SetModels_230416.ipynb
-
I tried ChatGPT, but it didn't understand what Seeq does with Formula Paramaters so its recommendations didn't format it correctly. The core issue is that I am trying to dynamically create the Formula Parameters string, but the issue I think is that the argument cannot be a string, it needs to be an ID. In other words, if I have "$parameter":argument, the argument needs to be something like Training_ID["ID"].iloc[0], not "Training_ID["ID"].iloc[0]". I am not sure how to do that. Any ideas?
-
Got a single positioner indexer out of bounds error
-
-
for ModelConfig_Column in range(1,ModelConfig_NumColumns): TargetTag = ModelConfig_CSV[0][ModelConfig_Column] #print(TargetTag_Running) # Set the type of regression formula if ModelConfig_CSV[2][ModelConfig_Column] == "OLS": RegressFormula = "$target.regressionModelOLS(" elif ModelConfig_CSV[2][ModelConfig_Column] == "Ridge": RegressFormula = "$target.regressionModelRidge(" elif ModelConfig_CSV[2][ModelConfig_Column] == "PCR": RegressFormula = "$target.regressionModelPCA(" else: RegressFormula = "" #print(RegressFormula) RegressFormula = RegressFormula+"$condition.toGroup(capsule("+DataRange+"), CapsuleBoundary.Intersect)" #print(RegressFormula) if ModelConfig_CSV[6][ModelConfig_Column]: RegressFormula =RegressFormula + ", true," else: RegressFormula =RegressFormula + ", false," #print(RegressFormula) InputList = "" FormVarList = "" for ModelConfig_Row in range (7,27): # When a cell is empty, it is false InputVar = ModelConfig_CSV[ModelConfig_Row][ModelConfig_Column] if ModelConfig_CSV[ModelConfig_Row][ModelConfig_Column]: InputName = ModelConfig_CSV[ModelConfig_Row][0] Scale = ModelConfig_CSV[1][ModelConfig_Column] locals()[InputVar + '_ID'] = spy.search({ 'Name': InputVar + '_ID', 'Scoped To':scopedtoid }) #print(Scale) if "Linear" in Scale: InputList = InputList + " $" + InputName + "," elif "Log" in Scale: InputList = InputList + " $" + InputName + ", ln($" + InputName + ").validValues()," elif "Polynomial" in Scale: Poly_Exponent = re.findall(r'\d', Scale ) #print(Poly_Exponent[0]) for ExpNum in range(1,int(Poly_Exponent[0])+1): InputList = InputList + " $" + InputName + "^"+ str(ExpNum) +"," elif "Expanded" in Scale: # not fully implemented yet, its rather complex InputList = InputList + " $" + InputName + "," else: InputList ="" # Set the list of inputs for formula variables FormVarList = FormVarList + "'$" + InputName + "':" + InputVar + "_ID['ID'].iloc[0], " #print(ModelConfig_CSV[ModelConfig_Row][ModelConfig_Column]) # remove final ',' #FormVarList = FormVarList[:-1] InputList = InputList[:-1] RegressFormula = RegressFormula + InputList + ")" VarSelectFlag = ModelConfig_CSV[5][ModelConfig_Column] print(VarSelectFlag) if VarSelectFlag == "TRUE": RegressFormula = RegressFormula + ".variableSelection(" + ModelConfig_CSV[6][ModelConfig_Column]+ ")" RegressFormula = RegressFormula + ".predict(" + InputList + ")" FormVarList = FormVarList + "'$target':" + TargetTag + "_ID['ID'].iloc[0], '$condition':Training_ID['ID'].iloc[0]" #print(RegressFormula) print(FormVarList) print() metadata = list() metadata.append({ 'Name': TargetTag +'_PRED', 'Type': 'Signal', 'Description': 'Prediction tag', 'Formula': RegressFormula, 'Formula Parameters': {str(FormVarList)} }) PRED_metadata = pandas_obj.DataFrame(metadata) spy.push(metadata = PRED_metadata, workbook=scopedtoid)
-
What I am not seeing is how to create a dynamic Formula Parameters list. I have done a bunch of DataLab formula signals, but I need a way to dynamically construct the formula parameter list. Are there any examples?
-
Thanks for the very timely response, I will take a look
-
I am trying to create formulas in which the formula parameters are dynamically created (see the attached image). I print the resulting string for the formula parameters and it looks correct. However, I get an error on the push stating that the format is incorrect. Is there a way to fix this?