I think you are right. Moreover, a transformer already exists here <https://github.com/scikit-learn/scikit-learn/blob/85ec0fd1ae904f275f608b11044a2476ed4723e6/sklearn/feature_extraction/image.py#L380>.

I see two solutions:

 * The transform() method could return the coordinates and the
   inverse_transform() method could take them as argument. The
   Transformer API
   <http://scikit-learn.org/0.13/developers/index.html#different-objects>
   doesn't specify if the transform() method can take more than one
   argument (two, to be exact) and I didn't find inverse_transform() in
   the API page. So I don't know if this approach would be consistent
   with all the others estimators/transformers.
 * The transformer could also retain the coordinates but then:
     o It would be specific to images of a certain size.
     o What kind of behaviour would be expected if the transform()
       method is called more than once? Use the same coordinates to
       extract patches in the new set of images?
     o If the transform() method was used to extract patches from
       various images, these images would need to be reconstructed
       together.

Another question for later:

 * The two functions extract_patches_2d and reconstruct_from_patches_2d
   are part of the public API (they are not prefixed with _). I think
   they sould be deprecated if a create a more complex transformer.
   What do you think?


On 04/22/2013 12:38 AM, Gael Varoquaux wrote:
Would a transformer, with an associated inverse_transform, be useful
here? It seems to me that it would be the right pattern, however I don't
have the code in mind, so I may be wrong.

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to