Jump to content


Super Seeqer
  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by patjdixon

  1. 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.
  2. 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
  3. Mark, I will try your way and ensure the search returns IDs
  4. 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?
  5. 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?
  6. 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]", '
  7. PM_SIM_SetModels_230416.ipynb is attached PM_SIM_SetModels_230416.ipynb
  8. 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?
  9. Got a single positioner indexer out of bounds error
  10. 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)
  11. 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?
  12. Thanks for the very timely response, I will take a look
  13. 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?
  14. Thanks Selmane, I made that correction and it works. I really wish there was a cleaner way to do this. I would like to just do calculations on conditions instead of being restricted to capsules.
  15. This helps, but it is really clunky. I hate having to type in specific dates in DataLab to create capsules. What I really want is to create conditions in WorkBench that I can use in calculations in DataLab. It looks like the best way to do that is within() in formulas. Most of the calculations cannot use conditions, they need capsules.
  16. This helps, but it is really clunky. I hate having to type in specific dates in DataLab to create capsules. What I really want is to create conditions in WorkBench that I can use in calculations in DataLab. It looks like the best way to do that is within() in formulas. Most of the calculations cannot use conditions, they need capsules.
  17. This doesn't quite work. As you can see, the average calculated this way differs from the Metric (Temp when good Avg Metric). This is really clunky, even if it worked. I am going to submit a feature request
  18. I am finding it difficult to create an SQC chart in Seeq If I show this in Excel, it is pretty easy 1. I start with a Temperature that effects a Quality measurement. The process engineer suspects there is a relationship between Temperature and Quality 2. The engineer puts a condition into Excel to show the quality good when it is greater than 80 3. We filter for all good values 4. We create the average and standard deviation for the good values 5. We put these values in columns, with a 2-standard deviation limit high and low 6. Now we can create a chart showing the quality is bad when temperature is outside limits ******** Now I want to do this in Seeq 1. I create condition for good quality 2. I use the condition to calculate the average when quality is good. THIS IS THE PROBLEM; it calculates an average for every capsule, not for the aggregate condition. Using aggregate in a formula doesn't work either. I find no way to calculate the average for the whole condition 3. Using a metric has the same problem 4. I can use "within()" to create a signal that only has temperature during good quality 5. I can then use a metric to calculate the average for good condition 6. However, I cannot use it in a formula. Therefore, the average and standard deviation from a metric cannot be used in a formula for SQC limits like I have in Excel ********* Does anyone know how this can be done in Seeq?
  19. What is the best way to copy a DataLab script from one project to another? In my case I have folders with the Workbench, Organizer, and DataLab that I need for a particular project. I can duplicate the folder, which copies the Workbench and Organizer, but does not create a DataLab project in that folder. When I create the DataLab project, I want to copy DataLab script from the prior project. If go to the prior project, make duplicates of the scripts, and try to use Move from the prior project, it asks for the directory path. I don't know what to enter. I can always open each script, save it to a local disk, then go to the new DataLab project and upload. I assumed Move would be a better way to do it. Anyone know how to make this work?
  20. Thanks James, that is the answer. I duplicated the workbook and got the Error Report. I assume this always happens when you have a CSV import?
  21. I have items imported from a CSV, and they show up in Workbench and I can create signals from Value Search. However, if I try to use any of the item in a formula it says The item with ID 00000000-0000-0000-0000-000000000276 could not be found
  22. This is great, but in my case I already have a topic and worksheets created. What I would like to do is append the end of each Organizer worksheet with the appropriate plot. For example, my worksheets could be 'Tensile' , 'Burst', 'Tear', and 'Fold'. On each one, I want to append the plot of the property to the worksheet, so 'Tensile' would have a plot of Tensile, 'Burst' a plot of Burst, etc. I cannot figure out a way to do pull/push to make this work. Any ideas?
  • Create New...