PyCon X


2nd - 5th May 2019

Test-Driven Machine Learning with scikit-learn

Machine learning is an amazing research and application field, which perfectly matches math skills with coding abilities in order to define programs that are able to learn from data.

Therefore, after having defined our own (mathematical) model, machine learning is about writing code - sometimes a lot of - to actually make the model to work.

However, one point usually underestimated or omitted when dealing with machine learning algorithms is how to write good quality code.

Test-driven development (TDD) is one of the most popular agile methods, specifically designed to support developers in producing (potential) less-buggy code by writing tests before the actual code under test.

The application of test-first programming principles to the implementation of Naive Bayes classifiers or Neural networks looks like a daunting challenge. Conversely, the test-code-refactor cycle strategy founds its principles in the scientific method: make a proposition of validity, share results, work in feedback loops. Moreover, this kind of approach to tackle problems, in this particular case would also allow for a better understanding of how the whole learning model works under the hood.

In this talk, examples of Test-Driven implementations of some of the most famous machine learning algorithms will be presented using scikit-learn.

The talk is intended for an intermediate audience. The content of the talk is intended to be mostly practical, and code oriented. Thus a good proficiency with the Python language is required. Conversely, no prior knowledge about TDD nor Machine Learning algorithms is necessary to attend this talk.


  1. Gravatar
    Sounds great.. Have you thinked about a way to integrate this in an MBT environment?
    — Aniello Barletta,
  2. Gravatar
    Hi Aniello, thanks for your comment! :)
    With MBT you mean *Model Based Testing*, right?

    Not really, indeed. But any suggestion is always highly appreciated!


    — Valerio Maggio,
  3. Gravatar
    Hi Valerio,

    was the talk recorded? or can you share the slides? I just reached to this web and the topic you describe seems very interesting for me.

    — Ricardo,

New comment