Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when model training #11

Open
Miso-K opened this issue Jul 29, 2022 · 1 comment
Open

Error when model training #11

Miso-K opened this issue Jul 29, 2022 · 1 comment

Comments

@Miso-K
Copy link

Miso-K commented Jul 29, 2022

Hello,

I am getting an error when trying to train a model with the main.py script.
It is working with a change line to this:
distance=np.sort(cdist(data.reshape(1, -1),PARAM[k]['Centre'],'euclidean'))[0]
However accuracy of the model is just 0.65.

Traceback (most recent call last):
File "/home/michal/Codes/xDNN/Projects/Python/1/main.py", line 103, in
Output2 = xDNN(Input2,Mode2)
File "/home/michal/Codes/xDNN/Projects/Python/1/Classes/xDNN_class.py", line 42, in xDNN
Test_Results = DecisionMaking(Params,datates)
File "/home/michal/Codes/xDNN/Projects/Python/1/Classes/xDNN_class.py", line 144, in DecisionMaking
distance=np.sort(cdist(data.reshape(1, -1),PARAM[k]['Centre'],'minkowski',6))[0]
TypeError: cdist() takes from 2 to 3 positional arguments but 4 were given

@nicoVascon
Copy link

The function only takes 2 parameters by default, 3 when you specify the distance metric that you want to use, when you use "Minkowski" distance you have to define the "p" parameter explicitly. You can do that with the following code line:
distance=np.sort(cdist(data.reshape(1, -1),PARAM[k]['Centre'],'minkowski',p=6))[0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants