convert data to numpy matrices