cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Predicting number of people

drmtc
6-Contributor

Predicting number of people

Hi,
I am currently developing a project for a client where I need to apply Thingworx Analytics.

 

I need to predict the number of people in a room every hour for the next 7 days.

To create the model I am gathering the following data:

  • a UTC timestamp, which I exclude from the model but include in the dataset for a later timeseries representation on the mashup.
  • Hour (1-24) dataType: Integer, opType: Categorical
  • Weekday (1-7) dataType: Integer, opType: Categorical
  • Month (1-12) dataType: Integer, opType: Categorical
  • Holiday (boolean) dataType: Boolean, opType: Boolean
  • Number of people, dataType: Integer, opType: Continuous

I exclude the timestamp because it has no relevance to the model.

The room has a sensor which sends the # of people every hour.

 

To make the process automatic I created a thing which receives the data onto an infotable. Now I will make a service which uses CreateJob() from "analytics_TrainingThing". There is no parameter to exclude fields from data on the service as there are on the Analytics Builder mashup. I have noticed that the thing "TW_ML_Toolkit_Helper" has a service "CreateModelAMS" which has the desired fields.

My question are:

  1. Is the data schema correct?
  2. Should I create a value stream instead of an infotable?
  3. Should I be using the "TW_ML_Toolkit" template on the thing I am invoking the services from? If not, how do I exclude data fields from training the model without Analytics Builder?
  4. On CreateJob() from "analytics_TrainingThing", how do I refer the dataset? Should I create it from the infotable first and call my DataThing to create the dataset?
  5. Once I have the model can I simply use RealtimeScore() from "analytics_PredictionThing" to predict the number of people, given the rest of the fields (hour, day, month, holiday)?

Thank you!

1 REPLY 1
cmorfin
19-Tanzanite
(To:drmtc)

Hi

 

Here are some answers that I hope will help you:

 

- You should not use the TW_ML_Toolkit_Helper. If you need to define exclusion those can be define inside the DatasetRef infotable. This infotable has got a nested one named exclusions.

- you can refer the datset in different way, posisbly the easiest is to upload it first to Analytics Server and then set the rui (of type dataset://<datasetid>) in the datasetUri field

- once the model is created you can score new fields using RealtimeScore service indeed. You will need to specify the new rows to score in the datasetRef info table of RealtimeScore

 

You might find the following post of interest as they show some example of how this can be done:

- simple using OOTB service: https://community.ptc.com/t5/IoT-Tech-Tips/How-to-work-with-ordinal-and-categorical-data-in-ThingWorx/m-p/542406

- a bit more complex/advanced: https://community.ptc.com/t5/IoT-Tech-Tips/Example-ThingWorx-Analytics-8-1-Mashup/m-p/535029

 

Hope this helps

Christophe

 

 

Announcements


Top Tags