{"action":"closed","issue":{"url":"https://api.github.com/repos/hammerlab/fancyimpute/issues/18","repository_url":"https://api.github.com/repos/hammerlab/fancyimpute","labels_url":"https://api.github.com/repos/hammerlab/fancyimpute/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/hammerlab/fancyimpute/issues/18/comments","events_url":"https://api.github.com/repos/hammerlab/fancyimpute/issues/18/events","html_url":"https://github.com/hammerlab/fancyimpute/issues/18","id":185079919,"number":18,"title":"LinAlgError: Singular matrix in MICE","user":{"login":"drorhilman","id":1249605,"avatar_url":"https://avatars.githubusercontent.com/u/1249605?v=3","gravatar_id":"","url":"https://api.github.com/users/drorhilman","html_url":"https://github.com/drorhilman","followers_url":"https://api.github.com/users/drorhilman/followers","following_url":"https://api.github.com/users/drorhilman/following{/other_user}","gists_url":"https://api.github.com/users/drorhilman/gists{/gist_id}","starred_url":"https://api.github.com/users/drorhilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drorhilman/subscriptions","organizations_url":"https://api.github.com/users/drorhilman/orgs","repos_url":"https://api.github.com/users/drorhilman/repos","events_url":"https://api.github.com/users/drorhilman/events{/privacy}","received_events_url":"https://api.github.com/users/drorhilman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-25T10:38:43Z","updated_at":"2016-12-10T13:00:51Z","closed_at":"2016-12-10T13:00:51Z","body":"I am getting a LinAlgError: Singular matrix Error when trying to impute with MICE..\n\n```\nfrom fancyimpute import MICE\nvals = df[cols].copy()\nvals = (vals /  vals.max()).values #important - make the max value as 1.0\nimps = MICE(n_imputations = 50, impute_type =\"col\", verbose=1, min_value=0.0, max_value=1.0).complete(vals)\n```\n\n```\n\n> /usr/local/lib/python2.7/dist-packages/fancyimpute/mice.pyc in complete(self, X)\n>     364             print(\"[MICE] Completing matrix with shape %s\" % (X.shape,))\n>     365         X_completed = X.copy()\n> --> 366         imputed_arrays, missing_mask = self.multiple_imputations(X)\n>     367         # average the imputed values for each feature\n>     368         average_imputated_values = imputed_arrays.mean(axis=0)\n> \n> /usr/local/lib/python2.7/dist-packages/fancyimpute/mice.pyc in multiple_imputations(self, X)\n>     352                 missing_mask=missing_mask,\n>     353                 observed_mask=observed_mask,\n> --> 354                 visit_indices=visit_indices)\n>     355             if m >= self.n_burn_in:\n>     356                 results_list.append(X_filled[missing_mask])\n> \n> /usr/local/lib/python2.7/dist-packages/fancyimpute/mice.pyc in perform_imputation_round(self, X_filled, missing_mask, observed_mask, visit_indices)\n>     220                     X_other_cols_observed,\n>     221                     column_values_observed,\n> --> 222                     inverse_covariance=None)\n>     223 \n>     224                 # Now we choose the row method (PMM) or the column method.\n> \n> /usr/local/lib/python2.7/dist-packages/fancyimpute/bayesian_ridge_regression.pyc in fit(self, X, y, inverse_covariance)\n>      66                 # interpreter with a savings of allocated arrays.\n>      67                 outer_product[i, i] += lambda_reg\n> ---> 68             self.inverse_covariance = inv(outer_product)\n>      69         else:\n>      70             self.inverse_covariance = inverse_covariance\n> \n> /usr/local/lib/python2.7/dist-packages/numpy/linalg/linalg.pyc in inv(a)\n>     524     signature = 'D->D' if isComplexType(t) else 'd->d'\n>     525     extobj = get_linalg_error_extobj(_raise_linalgerror_singular)\n> --> 526     ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj)\n>     527     return wrap(ainv.astype(result_t, copy=False))\n>     528 \n> \n> /usr/local/lib/python2.7/dist-packages/numpy/linalg/linalg.pyc in _raise_linalgerror_singular(err, flag)\n>      88 \n>      89 def _raise_linalgerror_singular(err, flag):\n> ---> 90     raise LinAlgError(\"Singular matrix\")\n>      91 \n>      92 def _raise_linalgerror_nonposdef(err, flag):\n> \n> LinAlgError: Singular matrix\n> \n\n```\n\nNot getting into a similar problem with other imputation methods other than MICE, on same data. \n"}}
{"actor":{"display_login":"iskandr"}}