{"action":"closed","issue":{"url":"https://api.github.com/repos/tBuLi/symfit/issues/161","repository_url":"https://api.github.com/repos/tBuLi/symfit","labels_url":"https://api.github.com/repos/tBuLi/symfit/issues/161/labels{/name}","comments_url":"https://api.github.com/repos/tBuLi/symfit/issues/161/comments","events_url":"https://api.github.com/repos/tBuLi/symfit/issues/161/events","html_url":"https://github.com/tBuLi/symfit/issues/161","id":332354387,"node_id":"MDU6SXNzdWUzMzIzNTQzODc=","number":161,"title":"shape mismatch for sum","user":{"login":"jbarnoud","id":1382074,"node_id":"MDQ6VXNlcjEzODIwNzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1382074?v=4","gravatar_id":"","url":"https://api.github.com/users/jbarnoud","html_url":"https://github.com/jbarnoud","followers_url":"https://api.github.com/users/jbarnoud/followers","following_url":"https://api.github.com/users/jbarnoud/following{/other_user}","gists_url":"https://api.github.com/users/jbarnoud/gists{/gist_id}","starred_url":"https://api.github.com/users/jbarnoud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbarnoud/subscriptions","organizations_url":"https://api.github.com/users/jbarnoud/orgs","repos_url":"https://api.github.com/users/jbarnoud/repos","events_url":"https://api.github.com/users/jbarnoud/events{/privacy}","received_events_url":"https://api.github.com/users/jbarnoud/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-06-14T11:03:56Z","updated_at":"2018-07-05T10:03:07Z","closed_at":"2018-07-05T10:03:07Z","author_association":"CONTRIBUTOR","body":"I try to run the following snippet but get an exception:\r\n\r\n```python\r\nimport symfit\r\n\r\ntemperature = symfit.Variable('temperature')\r\nlength = symfit.Variable('length')\r\nshift = symfit.Parameter('s', value=300)\r\nmodel = {length: shift + 1 / (1 + symfit.exp(- temperature))}\r\n\r\ntemp_data = [270, 280, 285, 290, 295, 300, 310, 320]\r\nlength_data = [8.33, 8.41, 8.45, 8.5, 8.54, 9.13, 9.27, 9.4]\r\nfit = symfit.Fit(model, length=length_data, temperature=temp_data)\r\nfir_result = fit.execute()\r\n```\r\n\r\nThe exception:\r\n\r\n```\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-4-47e2b6349ab2> in <module>()\r\n      9 length_data = [8.33, 8.41, 8.45, 8.5, 8.54, 9.13, 9.27, 9.4]\r\n     10 fit = symfit.Fit(model, length=length_data, temperature=temp_data)\r\n---> 11 fir_result = fit.execute()\r\n\r\n~/dev/symfit/symfit/core/fit.py in execute(self, **minimize_options)\r\n   1389         else:\r\n   1390             if cov_matrix is None:\r\n-> 1391                 cov_matrix = self.covariance_matrix(dict(zip(self.model.params, minimizer_ans._popt)))\r\n   1392         finally:\r\n   1393             minimizer_ans.covariance_matrix = cov_matrix\r\n\r\n~/dev/symfit/symfit/core/fit.py in covariance_matrix(self, best_fit_params)\r\n    873             if len(set(arr.shape for arr in self.sigma_data.values())) == 1:\r\n    874                 # Shapes of all sigma data identical\r\n--> 875                 return self._cov_mat_equal_lenghts(best_fit_params=best_fit_params)\r\n    876             else:\r\n    877                 return self._cov_mat_unequal_lenghts(best_fit_params=best_fit_params)\r\n\r\n~/dev/symfit/symfit/core/fit.py in _cov_mat_equal_lenghts(self, best_fit_params)\r\n    951             jac = jac * np.ones_like(W)\r\n    952         # Dot away all but the parameter dimension!\r\n--> 953         cov_matrix_inv = np.tensordot(W*jac, jac, (range(1, jac.ndim), range(1, jac.ndim)))\r\n    954         cov_matrix = np.linalg.inv(cov_matrix_inv)\r\n    955         return cov_matrix\r\n\r\n/coarse/jon/Envs/apricot/lib/python3.6/site-packages/numpy/core/numeric.py in tensordot(a, b, axes)\r\n   1281                 axes_b[k] += ndb\r\n   1282     if not equal:\r\n-> 1283         raise ValueError(\"shape-mismatch for sum\")\r\n   1284 \r\n   1285     # Move the axes to sum over to the end of \"a\"\r\n\r\nValueError: shape-mismatch for sum\r\n```\r\n\r\nAccording to `pip show` I am using version  0.3.3.dev487 of symfit, version 1.1.1 of sympy, and 1.14.3 of numpy.\r\n\r\nI try to simplify the model to `{length: shift - temperature}` and I get the same error."}}
{"actor":{"display_login":"pckroon"}}