O'Reilly logo

Test-Driven Machine Learning by Justin Bozonier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting choosey

Next, let's explore hooking up the classifiers that we developed previously. We'll do it within our test framework, but we won't make it a true test yet. Let's just hook it up and poke at it with a stick to start off.

To do so, we can construct a test that must fail so that we can see the output of the strategically placed print statements within our test and ClassifierChooser. This test will be more complex, since it will more closely mimic a real-world scenario. Here it is:

def given_real_classifiers_and_random_data_test(): class_a_variable_a = numpy.random.normal(loc=51, scale=5, size=1000) class_a_variable_b = numpy.random.normal(loc=5, scale=1, size=1000) class_a_input = zip(class_a_variable_a, class_a_variable_b) class_a_label ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required