KrishnaswamyLab / MAGIC

MAGIC (Markov Affinity-based Graph Imputation of Cells), is a method for imputing missing values restoring structure of large biological datasets.
GNU General Public License v2.0
341 stars 97 forks source link

magic_op.set_params(knn=5) and showed: AttributeError: 'MAGIC' object has no attribute 'a' #194

Closed Roger-GOAT closed 3 years ago

Roger-GOAT commented 3 years ago

Hi team! When I run magic_op.set_params(knn=5) (or knn=3, or leave empty), it comes out 'AttributeError: 'MAGIC' object has no attribute 'a'' python=3.7 image image image magic_op.set_params(knn=5)

AttributeError Traceback (most recent call last) ~/miniconda3/envs/py3.7/lib/python3.7/site-packages/IPython/core/formatters.py in call(self, obj, include, exclude) 968 969 if method is not None: --> 970 return method(include=include, exclude=exclude) 971 return None 972 else:

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/base.py in _reprmimebundle(self, kwargs) 462 def _reprmimebundle(self, kwargs): 463 """Mime bundle used by jupyter kernels to display estimator""" --> 464 output = {"text/plain": repr(self)} 465 if get_config()["display"] == 'diagram': 466 output["text/html"] = estimator_html_repr(self)

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/base.py in repr(self, N_CHAR_MAX) 258 n_max_elements_to_show=N_MAX_ELEMENTS_TOSHOW) 259 --> 260 repr = pp.pformat(self) 261 262 # Use bruteforce ellipsis when there are a lot of non-blank characters

~/miniconda3/envs/py3.7/lib/python3.7/pprint.py in pformat(self, object) 142 def pformat(self, object): 143 sio = _StringIO() --> 144 self._format(object, sio, 0, 0, {}, 0) 145 return sio.getvalue() 146

~/miniconda3/envs/py3.7/lib/python3.7/pprint.py in _format(self, object, stream, indent, allowance, context, level) 159 self._readable = False 160 return --> 161 rep = self._repr(object, context, level) 162 max_width = self._width - indent - allowance 163 if len(rep) > max_width:

~/miniconda3/envs/py3.7/lib/python3.7/pprint.py in _repr(self, object, context, level) 391 def _repr(self, object, context, level): 392 repr, readable, recursive = self.format(object, context.copy(), --> 393 self._depth, level) 394 if not readable: 395 self._readable = False

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/utils/_pprint.py in format(self, object, context, maxlevels, level) 179 def format(self, object, context, maxlevels, level): 180 return _safe_repr(object, context, maxlevels, level, --> 181 changed_only=self._changed_only) 182 183 def _pprint_estimator(self, object, stream, indent, allowance, context,

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/utils/_pprint.py in _safe_repr(object, context, maxlevels, level, changed_only) 423 recursive = False 424 if changed_only: --> 425 params = _changed_params(object) 426 else: 427 params = object.get_params(deep=False)

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/utils/_pprint.py in _changed_params(estimator) 89 estimator with non-default values.""" 90 ---> 91 params = estimator.get_params(deep=False) 92 init_func = getattr(estimator.init, 'deprecated_original', 93 estimator.init)

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/base.py in get_params(self, deep) 193 out = dict() 194 for key in self._get_param_names(): --> 195 value = getattr(self, key) 196 if deep and hasattr(value, 'get_params'): 197 deep_items = value.get_params().items()

AttributeError: 'MAGIC' object has no attribute 'a'

AttributeError Traceback (most recent call last) ~/miniconda3/envs/py3.7/lib/python3.7/site-packages/IPython/core/formatters.py in call(self, obj) 700 type_pprinters=self.type_printers, 701 deferred_pprinters=self.deferred_printers) --> 702 printer.pretty(obj) 703 printer.flush() 704 return stream.getvalue()

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/IPython/lib/pretty.py in pretty(self, obj) 392 if cls is not object \ 393 and callable(cls.dict.get('repr')): --> 394 return _repr_pprint(obj, self, cycle) 395 396 return _default_pprint(obj, self, cycle)

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/IPython/lib/pretty.py in _reprpprint(obj, p, cycle) 698 """A pprint that just redirects to the normal repr function.""" 699 # Find newlines and replace them with p.break() --> 700 output = repr(obj) 701 lines = output.splitlines() 702 with p.group():

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/base.py in repr(self, N_CHAR_MAX) 258 n_max_elements_to_show=N_MAX_ELEMENTS_TOSHOW) 259 --> 260 repr = pp.pformat(self) 261 262 # Use bruteforce ellipsis when there are a lot of non-blank characters

~/miniconda3/envs/py3.7/lib/python3.7/pprint.py in pformat(self, object) 142 def pformat(self, object): 143 sio = _StringIO() --> 144 self._format(object, sio, 0, 0, {}, 0) 145 return sio.getvalue() 146

~/miniconda3/envs/py3.7/lib/python3.7/pprint.py in _format(self, object, stream, indent, allowance, context, level) 159 self._readable = False 160 return --> 161 rep = self._repr(object, context, level) 162 max_width = self._width - indent - allowance 163 if len(rep) > max_width:

~/miniconda3/envs/py3.7/lib/python3.7/pprint.py in _repr(self, object, context, level) 391 def _repr(self, object, context, level): 392 repr, readable, recursive = self.format(object, context.copy(), --> 393 self._depth, level) 394 if not readable: 395 self._readable = False

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/utils/_pprint.py in format(self, object, context, maxlevels, level) 179 def format(self, object, context, maxlevels, level): 180 return _safe_repr(object, context, maxlevels, level, --> 181 changed_only=self._changed_only) 182 183 def _pprint_estimator(self, object, stream, indent, allowance, context,

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/utils/_pprint.py in _safe_repr(object, context, maxlevels, level, changed_only) 423 recursive = False 424 if changed_only: --> 425 params = _changed_params(object) 426 else: 427 params = object.get_params(deep=False)

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/utils/_pprint.py in _changed_params(estimator) 89 estimator with non-default values.""" 90 ---> 91 params = estimator.get_params(deep=False) 92 init_func = getattr(estimator.init, 'deprecated_original', 93 estimator.init)

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/sklearn/base.py in get_params(self, deep) 193 out = dict() 194 for key in self._get_param_names(): --> 195 value = getattr(self, key) 196 if deep and hasattr(value, 'get_params'): 197 deep_items = value.get_params().items()

AttributeError: 'MAGIC' object has no attribute 'a'

scottgigante commented 3 years ago

This should be resolved in the latest version.