Rolling average over predictions
I think that, in rollingPrediction, you just need the maxIndex, once that you already can access the max in arr with it.
Also, since that you need the maxIndex to find the class, you can just store the classes in an array with every class stored in the correspondent index.

To find which array has the most predictions, you will receive an array and evaluate it to one value. In cases like this, I think that you can use Array.prototype.reduce():

In the callback function, check which array has the bigger length
The initial value will be [null, []],  to check if there's one bigger array and  to have an array to compare in the callback function.


In indexOfMax you can use Math.max with Array.prototype.indexOf() since performance it's not a problem in this case, but you can use reduce too.

Suggestion: In sumOfArray, you receive an array as parameter and want to evaluate to one value. Maybe you can use reduce once again.


// ...
const classesIndexed = ["0", "10", "5"];
// suggestion: once that you know the classes order, this could be:
// const classesIndexed = Object.keys(allPredictions); 

const rollingPrediction = arr =&gt; {
  const maxIndex = indexOfMax(arr);
  if(maxIndex === -1) {
    return;
  }
  const maxFixed = parseFloat(arr[maxIndex].toFixed(2));
  allPredictions[classesIndexed[maxIndex]].push(maxFixed);
  queueSize++;

  if (queueSize &lt;= 4) {
    const [className, bigger] = Object.entries(allPredictions)
      .reduce(
        (acc, act) =&gt; acc[1].length &gt;= act[1].length ? acc : act,
        [null, []]
      );
    if (!className) {
      const sum = sumOfArray(bigger);
      const prob = sum / bigger.length;
      console.log(`Awareness level ${className} | Probability: ${prob}`);
    } else {
      console.log("No rolling prediction");
    }
    // ...
};
// ...
const indexOfMax = (arr = []) =&gt; arr.indexOf(Math.max(arr))