Convert Apply Model.Labelled Data to ExampleSet

KellyMKellyM Member Posts: 21 Maven
edited December 2018 in Help

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

Best Answer

  • KellyMKellyM Member Posts: 21 Maven
    Solution Accepted

    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

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,503 RM Data Scientist

    Hi Kelly,

     

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

     

    Best,

    Martin

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • KellyMKellyM Member Posts: 21 Maven

    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_RaoPavithra_Rao Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 123 RM Data Scientist

     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,

  • KellyMKellyM Member Posts: 21 Maven

    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_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    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. 

  • KellyMKellyM Member Posts: 21 Maven

    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_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    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. 

  • KellyMKellyM Member Posts: 21 Maven

    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_RaoPavithra_Rao Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 123 RM Data Scientist

    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,

  • KellyMKellyM Member Posts: 21 Maven

    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_RaoPavithra_Rao Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 123 RM Data Scientist

    @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,

  • KellyMKellyM Member Posts: 21 Maven

    @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_RaoPavithra_Rao Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 123 RM Data Scientist

    @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.

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
    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_RaoPavithra_Rao Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 123 RM Data Scientist

    @sgenzer This issue was resolved through our support team.

     

    Thanks,

    Pavithra

Sign In or Register to comment.