oracle / tribuo

Tribuo - A Java machine learning library
https://tribuo.org
Apache License 2.0
1.27k stars 175 forks source link

How do you do trajectory prediction? What model is used? #159

Closed qianxkun closed 3 years ago

qianxkun commented 3 years ago

Ask the question

Is your question about a specific ML algorithm or approach? Please describe the ML algorithm, with appropriate links or references.

Is your question about a specific Tribuo class? List the classes involved.

System details

Additional context Add any other context or screenshots about the question

qianxkun commented 3 years ago

Are there any examples?

Craigacp commented 3 years ago

If by trajectory prediction you mean predicting the motion of objects/people in images then Tribuo probably isn't the best tool for that job. You could implement an RNN & CNN based solution using Tribuo's TensorFlow sequence API, but Tribuo's support for image inputs is minimal, and the internal representation of large dense feature spaces is suboptimal in terms of memory and compute footprint. We're working on improving the performance of dense feature spaces, but it's not ready yet (and won't be in the next release).

If you want to deploy a pretrained model for this task then that's technically possible if it's in ONNX or TF Saved Model format, but you'll still hit the performance issues with image feature space representations.

I'd recommend that you use ONNX Runtime or TensorFlow-Java directly rather than through Tribuo as it'll be easier to work with the video/image structured input.

qianxkun commented 3 years ago

If by trajectory prediction you mean predicting the motion of objects/people in images then Tribuo probably isn't the best tool for that job. You could implement an RNN & CNN based solution using Tribuo's TensorFlow sequence API, but Tribuo's support for image inputs is minimal, and the internal representation of large dense feature spaces is suboptimal in terms of memory and compute footprint. We're working on improving the performance of dense feature spaces, but it's not ready yet (and won't be in the next release).

If you want to deploy a pretrained model for this task then that's technically possible if it's in ONNX or TF Saved Model format, but you'll still hit the performance issues with image feature space representations.

I'd recommend that you use ONNX Runtime or TensorFlow-Java directly rather than through Tribuo as it'll be easier to work with the video/image structured input.

What if I just use the data set format?

Craigacp commented 3 years ago

I'm not sure what you mean. Tribuo doesn't have any loaders for image datasets (other than IDX format), so you'd need to write one.

qianxkun commented 3 years ago

I'm not sure what you mean. Tribuo doesn't have any loaders for image datasets (other than IDX format), so you'd need to write one.

I want to use a data file similar to CSV for trajectory prediction, and I want continuous results. I hope to get your suggestions, thanks!

Craigacp commented 3 years ago

Could you describe your problem in more detail? My understanding of trajectory prediction is that it's usually performed on video or still images, and those are formats which Tribuo doesn't have native support for.

If your data is tabular and stored in a CSV or similar then you might mean time-series prediction? Tribuo supports multioutput regression which you could use for this task but most of the regressors predict each output dimension independently which would not constrain the dynamics properly. Tribuo does have regressors which predict the dimensions jointly, but those are based on regression trees which are known to be poor at extrapolation. We've not added more complex joint regressors though they are further down our roadmap.

qianxkun commented 3 years ago

Could you describe your problem in more detail? My understanding of trajectory prediction is that it's usually performed on video or still images, and those are formats which Tribuo doesn't have native support for.

If your data is tabular and stored in a CSV or similar then you might mean time-series prediction? Tribuo supports multioutput regression which you could use for this task but most of the regressors predict each output dimension independently which would not constrain the dynamics properly. Tribuo does have regressors which predict the dimensions jointly, but those are based on regression trees which are known to be poor at extrapolation. We've not added more complex joint regressors though they are further down our roadmap.

Thank you very much for your patience. I use historical data for training, including CSV file data with parameters such as longitude, latitude, altitude and time. Now I use regression algorithm, and the prediction result is only a group of data output. How to obtain continuous data? Repeat this action? At present, it is just learning to realize simple functions.

Craigacp commented 3 years ago

Ah ok. Tribuo is going to make predictions at whatever time interval the training data target value was after the input features (assuming it's constant and not encoded as a feature). It doesn't natively support time series predictions that would allow adjustable forecasting, though if you add the time interval as a feature then it might be able to generate different predictions as you vary that feature. As I mentioned no algorithm currently implemented in Tribuo can do joint predictions and extrapolation, so I'm not sure you'd get particularly good results this way.

I think using something that can understand the dynamics a little might work better (e.g. a Gaussian Process or a deep neural net). You could implement the deep neural net in Tribuo via the TensorFlow-Java interface, but you'll still end up fighting the Tribuo interface a little.

qianxkun commented 3 years ago

Ah ok. Tribuo is going to make predictions at whatever time interval the training data target value was after the input features (assuming it's constant and not encoded as a feature). It doesn't natively support time series predictions that would allow adjustable forecasting, though if you add the time interval as a feature then it might be able to generate different predictions as you vary that feature. As I mentioned no algorithm currently implemented in Tribuo can do joint predictions and extrapolation, so I'm not sure you'd get particularly good results this way.

I think using something that can understand the dynamics a little might work better (e.g. a Gaussian Process or a deep neural net). You could implement the deep neural net in Tribuo via the TensorFlow-Java interface, but you'll still end up fighting the Tribuo interface a little.

Thank you very much for your patience.