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

TypeError during Fitting #37

Closed
negmos opened this issue Oct 5, 2019 · 1 comment
Closed

TypeError during Fitting #37

negmos opened this issue Oct 5, 2019 · 1 comment

Comments

@negmos
Copy link

negmos commented Oct 5, 2019

I can't fit my data (it works on sklearn though).
I keep getting this

AttributeError: 'float' object has no attribute 'exp'
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/negm/PycharmProjects/testa2/a2_1.py", line 47, in
nn_model.fit(x_train, y_train)
File "/home/negm/PycharmProjects/testa2/venv/lib/python3.6/site-packages/mlrose/neural.py", line 528, in fit
restarts=0, init_state=init_weights)
File "/home/negm/PycharmProjects/testa2/venv/lib/python3.6/site-packages/mlrose/algorithms.py", line 188, in random_hill_climb
problem.set_state(init_state)
File "/home/negm/PycharmProjects/testa2/venv/lib/python3.6/site-packages/mlrose/opt_probs.py", line 224, in set_state
self.fitness = self.eval_fitness(self.state)
File "/home/negm/PycharmProjects/testa2/venv/lib/python3.6/site-packages/mlrose/opt_probs.py", line 98, in eval_fitness
fitness = self.maximize*self.fitness_fn.evaluate(state)
File "/home/negm/PycharmProjects/testa2/venv/lib/python3.6/site-packages/mlrose/neural.py", line 290, in evaluate
self.y_pred = self.output_activation(outputs)
File "/home/negm/PycharmProjects/testa2/venv/lib/python3.6/site-packages/mlrose/activation.py", line 77, in sigmoid
fx = 1/(1 + np.exp(-x))
TypeError: loop of ufunc does not support argument 0 of type float which has no callable exp method`

The weird thing is i tried different activation functions, but it always maps back to 'sigmoid' !!

@gkhayes
Copy link
Owner

gkhayes commented Oct 6, 2019

I'm not quite sure what is causing this issue. I haven't come across it before, but would be interested to hear if anyone else has and if they have found a way of solving it.

@gkhayes gkhayes closed this as completed Nov 1, 2019
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