Help wanted with how to train a model

Hey there,

I am new to developing in the Apple ecosystem, as well as a novice in the field of ML. I have dabbled a little bit in ML with face recognition in Python, but that's about it.

The thing I've found is that there is quite a lot of training algorithms and such for computer vision related things, but for my use case I don't really know what I am looking for, from a ML perspective.

Thing is, I have real time telemetry data where I have to determine the CURRENT (or near-current) state based on historic data (from NOW and BACKWARDS for 0 to something like 20 seconds, or more). The initial state is pretty easy to determine based on a few values, basically a UInt16 is set to 65535. Most of the possible states can be determined over time from the telemetry, but there are certain cases that can vary quite a lot. These cases are very likely possible to pick up as a human examining the logs, but it's something that seems hard or impossible to create a programmatic logic around. The sample rate in real time is pretty steady at 60 Hz.

Basically, I'm curious about what kind of ML model would be suitable to train around this kind of data, and how?

Generally, it shouldn't be a huge problem creating the training data. Even if it takes a while to manually mark up the various state changes, it is far from infeasible. Much of the data will differ wildly from dataset to dataset, while some will be very similar from one dataset to another.

So, basically I would need a model that can take several datasets of telemetry data (including when the state changes), run it through the ML to train a model that can, using real time data for the last 0-10 seconds or so, determine what state we're in at the moment. In most cases it can even have a "delay" of a second or so. The state change itself is not time critical as such, but it should be able to determine state with a very high confidence as possible within the space of at most 3 seconds.

As I understand it the Create ML app can be used for training a model, for use with the app in question. But as mentioned, I have no real idea what is most suitable for training a model with this kind of data that is supposed to analyze data over time. Tabular Regression, Recommendation? Something else entirely?

I'm guessing that real time data in production code would be supplied as a dataset with the last 20-30 seconds of data as input to the model, rather than just the last packet of telemetry data. But this is just my assumption.

I am attaching a text file with comma separated values from sample telemetry, somewhat truncated for brevity. There are a variety of fields, including coordinates in XYZ space, which have some relation to the state, but can vary wildly from one dataset to another (depending on location). But I assume that the training would automatically give those fields less weight?

If anyone can point me in the right direction, I would be really grateful. The finished model will eventually be used in an iOS app that will display the real time telemetry data.

Thanks in advance,

/Peter

Hey Peter, this is a really cool problem, and you've set it up well! The model you ideally would want to build for this is a temporal forecasting model. You might look at setting something up using a Temporal Transformer within CreateML Components: https://developer.apple.com/documentation/createmlcomponents/. See last year's WWDC session here: https://developer.apple.com/videos/play/wwdc2022/10019/.

If that's a bit daunting, another option that might get you many of the results you're looking for is to use a conventional tabular classifier to predict the state, but prior to training and inference do a data transformation so that parameters in the past are brought into the present. For example, looking just at X and Y coordinates, suppose you had:

TimeXYState
T000State1
T-101State1
T-212State2
...

Where T0 is the present, T-1 is 1 step in the past, etc. What you could do is refactor this as:

TimeXYStateXT-1YT-1StateT-2XT-2YT-2StateT-2
T000State101State112State2

This way, using a conventional linear classifier, you can use the information from previous states to help understand where it is and might be going. So that's two approaches you might take hope this helps!

Thanks @jcackler, appreciate the reply!

I will definitely check out the Temporal Transformer, if not for anything else than to learn something :D

As for the Tabular Classifier, and I'm not sure if the formatting of your post is messed up, but am I correct in assuming that you're saying that (for example) the last 10 samples are refactored into a single data row (or sequence, if you will)? Yeah, I think that may be worth a look as well.

I think I've managed to discard a few features, so I'm down to 8 where the timestamp/packet id is one, but in this case I think it may well be discarded.

However, let's say for the sake of argument that I need to examine the last 10 seconds @ 60Hz, that would be (target state + 7 features times 600) 4201 entries per row. Will the sheer amount of data cause any issues?

Anyway, I will look into these approaches!

Help wanted with how to train a model
 
 
Q