Generating rhythms is a problem that has been solved by arpeggiators, step sequencers, analog modular rigs and more sophisticated tools like KARMA. You don't need machine learning for it.
This is a greatly oversimplified view of rhythm. There are many rhythms and grooves that do not lock in with "the grid". These tools will most likely not produce a natural pattern of velocity that sounds appropriate for the generated rhythm. Step sequencers are a tool for inputting rhythm, not for generating it. Arpeggiators typically have a consistent rhythm (hitting on every one of some subdivision).
Modern step sequencers (for example, Elektron boxes) are way more than just a grid. They have microtiming, parametrized triggers, parameter sliding, probabilistic and conditional triggers, and are capable of running multiple patterns of varying lengths that reset at different rates.
Ok then tell me how to generate a drum part 30% of the way from Buddy Rich to Neil Peart.