ML algorithm implementation