Skip to main content
19-Tanzanite
March 28, 2018

How to work with ordinal and categorical data in ThingWorx Analytics ?

  • March 28, 2018
  • 3 replies
  • 29333 views

Datasets with ordinal or categorical goal cannot currently be used in ThingWorx Analytics Builder.

However this is only a UI limitation, ThingWorx Analytics Server can handle those data.

It does simply require to use the services from the AnalyticsServer-Training and AnalyticsServer-Prediction things to perform the operations.

 

This can be done using a mashup or via Rest API call (see https://www.ptc.com/en/support/article?n=CS271485 ) .

The below video expands on the mashup solution.

Attached are also the entities used during the video and a sample dataset with ordinal goal.

 

 

Update for ThingWorx 9.0 

The API has changed in 9.0, use the entities Entities-90-3Jun2020.xml for release 9.0

 

3 replies

17-Peridot
July 23, 2018

Chris @cmorfin , this doesn't seem to work with 8.3 (getting error from CMOCreateModelLearner service - "Please select at least one learner" on the first step, when creating the model)

Do I miss something, or could you please provide a list of parameters for a REST call?

cmorfin19-TanzaniteAuthor
19-Tanzanite
July 23, 2018

Hi Dmitry

 

I did test it recently in 8.3 and that was working.

However there were some other issues, so I have attached anew version of entities that corrected some of those problems. It would be best if you reuse this new ones.

 

Regarding the error you get on Learners, the service reads the value from a property named Learner, by default it is empty, so you would get this error.

You need to first set some value in this Learner property to define at least one learner, then you can execute it.

Note that the services also calls some other properties for the training and scoring thing , if I recall correctly, so you need to set those properties with the correct value for your environment.

The properties are on the thing  cmo_Helper

 

Kind regards

Christophe

 

17-Peridot
July 24, 2018

Hi Chris

 

Uhh... Those properties were not mentioned in the video.

Now, after setting them (Learner, PredictionThing and TrainingThing), I'm getting

 

[context: com.thingworx.webservices.context.HttpExecutionContext@2dde78b5][message: Execution error in service script [CMOCreateModelLearner] :: TypeError: Cannot call method "CreateJob" of null (CMOCreateModelLearner#109)] 

 

Do I miss some other properties / should I edit something inside the services?

17-Peridot
July 25, 2018

One more question regarding the categorical data...

Are AnalyticsServer_SignalsThing and ProfilingThing supposed to work with models generated for categorical data?

cmorfin19-TanzaniteAuthor
19-Tanzanite
July 25, 2018

Hi

 

Ordinal and categorical goal are currently  supported for training and scoring only.

 

Kind regards

Christophe

 

 

1-Visitor
August 24, 2020

Hi Christophe,

 

I was not able to find 'CMOCreateModel' as service and its associated fields in cmo_helper thing.

 

I was tried to replicate this model and services in my local, and stuck in mapping for CMOCreateModel and modelOutputs as field.

 

Please let me know from where i can find CMOCreateModel as service and find modelOutputs fleld.

 

Regards,

Mayank

 

14-Alexandrite
May 11, 2021

Hi @cmorfin Cris,

 

Thanks for this post!

It was quite helpful as a reference when working with categorical data.

 

I uploaded a dataset and then created a model but when executing the RealtimeScore service of the PredictionThing I get the following answer.

image

The value in the Internal_Pump_Leakage field is a String that looks like a JSON object but in fact it's not. It requires further processing to access the keys in it.

Is this the expected behavior?

cmorfin19-TanzaniteAuthor
19-Tanzanite
May 12, 2021

Hi @nahuel 

 

Yes this is the expected output for categorical goal, the format is different than for ordinal and output the probability of each category - This is indicated in Help Center: Interpreting Predictive Scoring Results (ptc.com)

 

Thanks

Christophe

 

14-Alexandrite
May 12, 2021

@cmorfin Thank you!