The invention relates to a method for training a
machine learning model for an autonomous driving function, in particular for behavior prediction and / or behavior planning and / or for tracking one or more vehicles, the method comprising the steps of: providing (S1) a training
data set with training data elements, each comprising
scenario data (204) as training input data and associated
ground truth data; determining (S2) latent feature vectors for the
scenario data (204) using a feature embedding unit; clustering (S3) the training data elements based on the latent feature vectors into
scenario clusters (202) using a clustering
algorithm;Determine (S4) scenario cluster weights by applying the scenario data of the training data elements to the
machine learning model to be trained and comparing the output data of the
machine learning model thus generated with the
ground truth data of the respective training data elements; determine a performance measure and / or a
loss function based on the comparisons between the output data and the
ground truth data and determine or adjust the scenario cluster weights based on the performance measure and / or the
loss function;
train (S5) the
machine learning model with the training
data set sampled taking into account the scenario cluster weights; and deploy (S6) the trained
machine learning model.