Dr. James McCaffrey of Microsoft Research explains how to programmatically split a file of data into a training file and a test file, for use in a machine learning neural network for scenarios like ...
A Python implementation of this technique is presented in Listing 1. Function file_split_rows () calls a program-defined helper function line_count () and uses a NumPy (aliased as np) array object.