Convert Apply Model.Labelled Data to ExampleSet

KellyM
KellyM New Altair Community Member
edited November 5 in Community Q&A

Hello,

 

I am trying to build a process that applies a previously saved model to new data.  I am pulling the data in from SQL using the Read Database operator, applying the model, and then I need to rename a column before writing the data back to SQL.  Everything is fine until I try to manipulate the output from the Apply Model operator. Is there a way to convert the labelled output data to an example set so I can manipulate the results before exporting to SQL? Also, I need everything to run as one process so I can't just save the output, retrieve it, manipulate it and write to SQL.  I've tried building two separate streams in one window to do this but haven't been able to change the order of operations to run the modeling portion before retrieving the model results.

 

Thank you for the help,

 

Kelly

Tagged:

Best Answer

  • KellyM
    KellyM New Altair Community Member
    Answer ✓

    Hi @Pavithra_Rao

     

    I have done as you suggested and the Read Database operator is returning an ExampleSet. When I hover over the output port of the Read Database operator, though, no data is shown. 

     

    ReadDatabase Output.png

     

    ReadDatabase Output Port.png

     

    I am also feeding the Read Database operator into a Select Attributes operator before applying the model and no attributes show up here either. However, the attribute filter type I'm using is subset and I manually added the attributes that I want to select to feed into the model. This ends up working and I do not get an error. But when I try to manually add attributes to the Set Role or Rename operators, I do get an error that the attributes were not found in the exampleset. 

     

     

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee

    Hi Kelly,

     

    what kind of model are you using? All usual supervised models create example set as an output?

     

    Best,

    Martin

  • KellyM
    KellyM New Altair Community Member

    Hi Martin,

     

    The model uses a Logistic Regression. Yes, they do. However, when I connect the output of the Apply Model operator (technically, the Apply Threshold in my case. But I tried from the Apply Model operator as well) to the Rename operator, no attributes show up in the attribute name parameter drop down menu. And when I try to just type in the attribute name and the new name, I get an error that the attribute is missing in the example set.  I have tried connecting the output of the Apply Model operator to a Set Role operator to change the special attributes to a regular role but I run in to the same issue where no attributes are showing up in the drop down menu, as shown below.

     

    MissingAttributes.png

  • Pavithra_Rao
    Pavithra_Rao New Altair Community Member

     Hi Kelly,

     

    From observing below screenshot I guess you "Apply threshold" operator is not generating any output. You may want to make sure to get this operator set up correctly before inputting data into Set Role operator.

     

    To step/pause after execution of every operator you could add "Breakpoint" (Select the operator right click and select Breakpoint After or "F7").

    This will help you check the results at the output port of the operator and comes pretty handy while debugging the process.

     

    Hope this helps!  Let me know if you need any additional help with fixing this issue.

     

    Cheers,

  • KellyM
    KellyM New Altair Community Member

    Hi @Pavithra_Rao,

     

    Thank you for your reply. Both my Apply Model and Apply Threshold operators output an example set, complete with predictions, when I connect them to the results port.  So I do not believe your suggestion is the issue here but I appreciate it nonetheless.  If you have any other suggestions as to why I can't manipulate the output of the Apply Model or Apply Threshold operators, I'm all ears.

     

    @mschmitz Do you have any ideas?

     

    Thank you.

     

     

  • Thomas_Ott
    Thomas_Ott New Altair Community Member

    This might be related to the metadata not propogating through the process. Toggle on "Snyc Metadata with Real Data" under the Process pull down menu. 

  • KellyM
    KellyM New Altair Community Member

    Hi @Thomas_Ott,

     

    I toggled it on but I am still not showing any attributes in the Set Role or Rename operators. I have also tried validating the process after toggling it on but nothing changes.

  • Thomas_Ott
    Thomas_Ott New Altair Community Member

    Put in a breakpoint after on the Apply Model and then after the Apply Threshold. I wonder if there is an issue with the Thresholding you are are using because it shows error warnings. 

  • KellyM
    KellyM New Altair Community Member

    Both output the exact same example set. I also tried removing the thresholding but the Set Role and Rename operators are still not showing any attributes.

     

    The errors at the Apply Threshold operator are:

    • The input example set needs to contain an attribute fulfilling role prediction.
    • The input example set neets to contain an attribute fulfilling role confidence.

     

    But again, even when I remove the thesholding and directly connect the Apply Model operator to the Set Role or Rename operators, no attributes are showing up. I think the issue is stemming from reading data in from a query file. When I remove this and just use a dataset that is stored in a repository, everything is working fine. But that is something I am trying to avoid since I mentioned previously needing this process to execute in one window and not being able to change the order of operations so that the modeling portion happens before trying to retrieve the stored model output.

  • Pavithra_Rao
    Pavithra_Rao New Altair Community Member

    Hi Kelly,

     

    Would you mind sharing the process XML along with sample data, so that we can take a look at it in depth and try to help fix this issue.

     

    Thanks,

  • KellyM
    KellyM New Altair Community Member

    Unfortunately, I cannot share my data or process as it contains information about the ODBC connection to SQL. I am not allowed to share this information outside of my organization. 

     

    Is there something else we can try? 

  • Pavithra_Rao
    Pavithra_Rao New Altair Community Member

    @KellyM

     

    Could you post the screenshot of the following, will see if I can help this way....

     

    1. Parameter settings of Apply Threshold, Create threshold operators.

    2. Also results  window screenshot of Apply model output (Place a breakpoint on Apply model 

     

    Cheers,

  • KellyM
    KellyM New Altair Community Member

    @Pavithra_Rao

     

    Here are the screenshots you requested. The Apply Threshold operator does not take any parameter inputs so I did not include. The attributes that I have blocked out consiste of 2 real datatypes, 2 nominal and 1 integer. Please let me know if I can provide any other information.

     

    CreateThreshold.png

     

    ApplyModel Output.png

  • Pavithra_Rao
    Pavithra_Rao New Altair Community Member

    @KellyM

     

    The screenshots suggest that operators are set up properly. But as you had mentioned in your earlier post;

    "

    The errors at the Apply Threshold operator are:

    • The input example set needs to contain an attribute fulfilling role prediction.
    • The input example set needs to contain an attribuneedslfilling role confidence.

     

    But again, even when I remove the thresholding and directly connect the Apply Model operator to the Set Role or Rename operators, no attributes are showing up. I think the issue is stemming from reading data in from a query file. When I remove this and just use a dataset that is stored in a repository, everything is working fine. But that is something I am trying to avoid since I mentioned previously needing this process to execute in one window and not being able to change the order of operations so that the modeling portion happens before trying to retrieve the stored model output."

     

    Seems like while reading data from database and apply model is having issue, where as reading from repository works fine.

     

    Could you place a Breakpoint on Read Database operator and confirm if required data is retrieved from the database?

    Also please share the results screenshot of this step here.

  • KellyM
    KellyM New Altair Community Member
    Answer ✓

    Hi @Pavithra_Rao

     

    I have done as you suggested and the Read Database operator is returning an ExampleSet. When I hover over the output port of the Read Database operator, though, no data is shown. 

     

    ReadDatabase Output.png

     

    ReadDatabase Output Port.png

     

    I am also feeding the Read Database operator into a Select Attributes operator before applying the model and no attributes show up here either. However, the attribute filter type I'm using is subset and I manually added the attributes that I want to select to feed into the model. This ends up working and I do not get an error. But when I try to manually add attributes to the Set Role or Rename operators, I do get an error that the attributes were not found in the exampleset. 

     

     

  • sgenzer
    sgenzer
    Altair Employee
    Hello @KellyM - I concur with @Thomas_Ott that it’s likely a metadata propagation problem from Read Database. I would suggest completely ignoring any pull-down menus for selecting attributes in ANY operators after Read Database and type the names of the attributes manually - EXACTLY as they are. There cannot be any differences (trailing or leading spaces, capitalization, etc.) Use breakpoints along the way as suggested by @Pavithra_Rao.

    Scott

  • Pavithra_Rao
    Pavithra_Rao New Altair Community Member

    @sgenzer This issue was resolved through our support team.

     

    Thanks,

    Pavithra