In this brief contribution, I distinguish between code-driven and data-driven regulation as novel instantiations of legal regulation. Before moving deeper into data-driven regulation, I explain the difference between law and regulation, and the relevance of such a difference for the rule of law. I discuss artificial legal intelligence (ALI) as a means to enable quantified legal prediction and argumentation mining which are both based on machine learning. This raises the question of whether the implementation of such technologies should count as law or as regulation, and what this means for their further development. Finally, I propose the concept of `agonistic machine learning' as a means to bring data-driven regulation under the rule of law. This entails obligating developers, lawyers and those subject to the decisions of ALI to re-introduce adversarial interrogation at the level of its computational architecture.This article is part of a discussion meeting issue `The growing ubiquity of algorithms in society: implications, impacts and innovations'.