Skip to content
Advertisement

inverse_transform() takes 2 positional arguments but 3 were given

I’m trying to use Canonical Correlation Analysis (CCA) in scikit-learn. Still, I’m getting a TypeError, which asserts inverse_transform() takes 2 positional arguments but 3 were given.

Here is my code:

JavaScript

And the last line throws a TypeError:

JavaScript

It’s ridiculous since I passed two arguments exactly, named x_test and predicted. If you’re curious about shape of x_test and predicted:

JavaScript

How to fix this?

Advertisement

Answer

You are not counting the “self” argument that is given to the method when calling it. This means the third argument is the instance of CCA class which is “mycca”. try:

JavaScript

If your are using version 1.0.2 then you will get an error as this is not supported in that version.This is for version 1.0.2:enter image description here

This one is the newest version: enter image description here

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement