Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
leliel12 committed Apr 9, 2017
1 parent e2a0720 commit 39576d7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions skcriteria/dmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ def to_str(self, **params):
rows = self._iter_rows()
return tabulate(rows, **params)

def as_dict(self):
data = {
"data": self._data,
"kernel_": self._kernel,
"rank_": self._rank, "e_": self._e}
data = self.decision_maker.decision_as_dict(data)
data.update({"decision_maker": self._decision_maker})
return data

@property
def decision_maker(self):
return self._decision_maker
Expand Down Expand Up @@ -388,6 +397,15 @@ def __repr__(self):
"{}={}".format(k, v) for k, v in data)
return "<{} ({})>".format(cls_name, data)

def as_dict(self):
try:
return {"mnorm": norm.nameof(self._mnorm),
"wnorm": norm.nameof(self._wnorm)}
except norm.FunctionNotRegisteredAsNormalizer as err:
msg = ("All your normalization function must be registered with "
"'norm.register()' function. Invalid Function: {}")
raise norm.FunctionNotRegisteredAsNormalizer(msg.format(err))

def normalize(self, mtx, criteria, weights):
ncriteria = util.criteriarr(criteria)
nmtx = self._mnorm(mtx, criteria=criteria, axis=0)
Expand Down

0 comments on commit 39576d7

Please sign in to comment.