Hello,I defined my own preprocessor and extractor according to the example of the documentation in the following webpage:I wrote the preprocessor and extractor in different python files. The class of preprocessor and the class of extractor both have the 'transform' method. I tested them by one image, and both work fine.Here is my testing:I loaded an image data X, then put X into the preprocessor, and got the preprocessed data. preprocessed_X = PerturbTransformer().transform(X)Then I fed the preprocessed_X into my extractor AFFFE().transform(preprocessed_X), and it works fine as well.Below is my config file, the pipeline. I loaded the preprocessor and extractor, then wrap them by make_pipeline...define an algorithm, then wrap all.. just as the documentation shows.
As the preprocessor and extractor work fine, and the pipeline seems fine as well. What is this Error? How can I solve it?If you need more information to locate the problem, please tell me.Thank you so much!
---- You received this message because you are subscribed to the Google Groups bob-devel group. To post to this group, send email to bob-...@googlegroups.com. To unsubscribe from this group, send email to bob-devel+...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/bob-devel or directly the project website at http://idiap.github.com/bob/---You received this message because you are subscribed to the Google Groups "bob-devel" group.To unsubscribe from this group and stop receiving emails from it, send an email to bob-devel+...@googlegroups.com.To view this discussion on the web, visit https://groups.google.com/d/msgid/bob-devel/effb53b0-c772-4e99-8ccd-829ba828c490n%40googlegroups.com.
Here is the complete error message
To view this discussion on the web, visit https://groups.google.com/d/msgid/bob-devel/f44e51e2-efca-4be9-9183-0e42faa08fc3n%40googlegroups.com.
from sklearn.base import TransformerMixin, BaseEstimator
class CustomTransformer(TransformerMixin, BaseEstimator):
def transform(self, X):
transformed_X = my_function(X)
return transformed_X
def fit(self, X, y=None):
return self
from sklearn.preprocessing import FunctionTransformer
def CustomTransformer(**kwargs):
return FunctionTransformer(my_function, **kwargs)
The error log said my preprocessor has no attribute 'fit', but it has.I defined the 'fit' inside the transform method just as the sample code.
To view this discussion on the web, visit https://groups.google.com/d/msgid/bob-devel/4b79d7f6-5bd9-42bf-aee2-6a07a341c918n%40googlegroups.com.
X = X/255.
TypeError: unsupported operand type(s) for /: 'SampleBatch' and 'float'
Here is the gitlab sample code:
It doesn't matter whether it's 255 (int) or 255. (float), both raised the TypeError.
Below is the complete error log:
Sorry to bother you again, but could you check what is this problem?
Thank you.
I revised and run the pipeline again, it seems the data has passed the preprocessor successfully, but an error raised whengoing through my feature extractor.I have a calculation X = X/225. in my extractor code. According to what I see in the gitlab feature-extractor template, this calculation should be supported, but it raised an error:
X = X/255.TypeError: unsupported operand type(s) for /: 'SampleBatch' and 'float'Here is the gitlab sample code:
To view this discussion on the web, visit https://groups.google.com/d/msgid/bob-devel/cf822a82-247c-4282-b633-156b2e85c0aan%40googlegroups.com.