Commit b2a96592 authored by Vincent POLLET's avatar Vincent POLLET

Update doc vanilla_pad doc with example of decision function

parent 3878c736
Pipeline #49310 passed with stage
in 3 minutes and 38 seconds
...@@ -107,6 +107,9 @@ Here is the minimal structure of a classifier: ...@@ -107,6 +107,9 @@ Here is the minimal structure of a classifier:
def predict(self, X): def predict(self, X):
return do_prediction(self.state, X) return do_prediction(self.state, X)
def score(self, X):
return score(self.state, X)
.. note:: .. note::
...@@ -142,15 +145,16 @@ To build such a pipeline, the following configuration file can be created: ...@@ -142,15 +145,16 @@ To build such a pipeline, the following configuration file can be created:
The pipeline can then be executed with the command:: The pipeline can then be executed with the command::
$ bob pad vanilla-pad -d my_database_config.py -p my_pipeline_config.py -f predict -o output_dir $ bob pad vanilla-pad -d my_database_config.py -p my_pipeline_config.py -f score -o output_dir
When executed with vanilla-pad, every training sample will pass through the pipeline, executing the ``fit`` methods. When executed with vanilla-pad, every training sample will pass through the pipeline, executing the ``fit`` methods.
Then, every sample of the `dev` set (and/or the `eval` set) will be given to the `transform` method of ``my_transformer`` and the result is passed to the `predict` method of ``my_classifier``. Then, every sample of the `dev` set (and/or the `eval` set) will be given to the `transform` method of ``my_transformer`` and the result is passed to the ``decision_function`` method of ``my_classifier``.
The output of the classifier (scores) is written to a file. The output of the classifier (scores) is written to a file.
.. note:: .. note::
By default, vanilla-pad expects the classifier to have a `decision_function` method to call for the prediction step. It can be changed with the '-f' switch to the prediction method of your classifier, in our case the `predict` method. By default, vanilla-pad expects the classifier to have a `decision_function` method to call for the prediction step. It can be changed with the '-f' switch to the prediction method of your classifier, in our case the `score` method.
The usual `decision_function` of scikit-learn is their `predict_proba` method.
.. _bob.pad.base.using_sklearn_classifiers: .. _bob.pad.base.using_sklearn_classifiers:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment