Skip to main content
19-Tanzanite
Mar 28, 2018 12:29 PM UTC

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

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

 

19 replies

17-Peridot
Jul 23, 2018 1:04 PM UTC

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?

Translate
cmorfin19-TanzaniteAuthor
19-Tanzanite
Jul 23, 2018 1:29 PM UTC

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

 

Translate
17-Peridot
Jul 24, 2018 11:07 AM UTC

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?

Translate
17-Peridot
Jul 25, 2018 12:30 PM UTC

One more question regarding the categorical data...

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

Translate
cmorfin19-TanzaniteAuthor
19-Tanzanite
Jul 25, 2018 2:07 PM UTC

Hi

 

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

 

Kind regards

Christophe

 

 

Translate
1-Visitor
Aug 24, 2020 8:34 AM UTC

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

 

Translate
14-Alexandrite
May 11, 2021 6:34 PM UTC

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?

Translate
cmorfin19-TanzaniteAuthor
19-Tanzanite
May 12, 2021 12:52 PM UTC

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

 

Translate
14-Alexandrite
May 12, 2021 9:45 PM UTC

@cmorfin Thank you!

Translate