updated machine learning functions