Recursive algorithm realization fulfilled but problems with sklearn integration