Hi @116dreamer
If you are trying to build a working PoC/demo, I recommend using the data generator for this tutorial.
https://learn.microsoft.com/en-us/azure/stream-analytics/stream-analytics-machine-learning-anomaly-detection#model-behavior
I suspect there might be some problems with the number of inputs your example generates and how you have invoked the AD functions in your query. This documentation page shows a working example that you can experiment with: https://learn.microsoft.com/en-us/azure/stream-analytics/stream-analytics-machine-learning-anomaly-detection#model-behavior