Make prepareData function to reshape input