to_categorical() missing 1 required positional argument nb_classes caused by tflearn version mismatch

TypeError: to_categorical() missing 1 required positional argument: 'nb_classes' was encountered while I was trying to run an example program based on it.

The function to_catagorical() used to require two arguments, where the second is called nb_classes and represents the total class numbers in classification as an integer.

It’s not until this pr that the second function is no longer needed but the support for the previous usage is dropped and all the examples are updated to adapt to the new usage.

However, until today, the default version installed directed from pip is not new enough to support this new feature, thus causing a problem.

To solve it, either try update to the newest version via pip install git+https://github.com/tflearn/tflearn.git or just add the class number.

2017/10/25