One of the reasons that scikit-learn is so popular is due to its ease of use. There are only a few, well thought-out API designs in the scikit-learn library and they are applied in a sweeping manner across many different methods and routines. This chapter will make use of the transformer API. It's extremely straightforward and once you understand how to use it, you can try our new transformer methods with ease because they all work the same (that is, they all make use of the transformer API).
The steps for transforming data are given as follows:
- Import the module.
- Instantiate the transformer object (model in the following diagram).
- Fit the model to input the training data (X_train in the following diagram).
- Transform the new test data (X_test in the following diagram).
These steps can also be represented as a workflow diagram, as follows...