Train and Test function with use of Map.Map