-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
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
Got a AttributeError: 'Rule' object has no attribute '__name__' #39
Comments
Hi, the error you are receiving is due to the usage of partial functions in the RHS of the rule. You can solve this using a closure instead of a partial function: def _add_partial(score, weight):
def _add(self, **kwargs):
s, w = int(score), float(weight)
self.score += s * w
return _add
R = Rule(AND(Fact(**rule, value=MATCH.value &
_cond(rule_item['value'], rule_item['symbol']))),
salience=sal)(_add_partial(score=rule_item['score'],
weight=rule_item['weight'])) Hope this help! |
Wow. It DOES WORK. |
wangyingsm
added a commit
to EmbryoAI/EmbryoAI-System
that referenced
this issue
Nov 9, 2018
buguroo/pyknow#39 修改自动评分实现
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background, I am new to Pyknow. I want to build a expert system to auto calculate a cell quality score based on some parameters. The score algorithm should be loaded from a json data, such like:
Here are my codes for this,
It raises a AttributeError: 'Rule' object has no attribute 'name' when engine.run() on engine.py line 162
I can't find out what the problem is. Wonder if I can get some help here. THANKS.
The text was updated successfully, but these errors were encountered: