We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The implementation is not correct. It reads
d = X.shape[0] for i in range(0,d): res = np.prod(np.sum([i * np.cos((j+1)*X[i] + j) for j in range(1, 5+1)])) return res
I'm guessing the intention was
d = X.shape[0] res = np.prod([ np.sum([i * np.cos((j+1)*X[i] + j) for j in range(1, 5+1)])) for i in range(d) ]) return res
I suggest the following implementation which avoids loops (inefficient in numpy), and is IMO more readable (it does allocate a bigger array)
def f(self, X): j = np.arange(1, 6)[None, :] res = np.cos((j + 1) * X[:, None] + j) \ .sum(axis=1) \ .prod() return res
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The implementation is not correct. It reads
I'm guessing the intention was
I suggest the following implementation which avoids loops (inefficient in numpy), and is IMO more readable (it does allocate a bigger array)
The text was updated successfully, but these errors were encountered: