JESS: [EXTERNAL] Problems with fuzzy jess implementations

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JESS: [EXTERNAL] Problems with fuzzy jess implementations

Martín Rodríguez
Dear Doctor Orchar,

Hi my name is Martin Rodriguez and Im studen of engineering. As final project Im developing a system with Jade, Jess and fuzzy jess.
The purpose of the system is to provide medical diagnosis.
Thats why i needed a rules based system with backward chaining, and I choose Jess.

Well, my problem is when I begin to use FuzzyJ on my Jess files.

I send you as an attachment, a short file with the code complete.

My first problem occurs when I write the next rule:

(defrule intensidad_tos
(declare (auto-focus TRUE))
        (check diagnostico-b)
        (answer (ident fuzzy_tos) (text ?ht&:(fuzzy-match ?ht "secaContinua")))
=>
        (assert (tos (new nrc.fuzzy.FuzzyValue ?*fuzzyTos* "secaContinua")))
)

this code does not even compile and send me the next error message:

Jess reported an error in routine ReteCompiler.addRule.  Message: Can't use funcalls in backchained patterns text.

Well, my next and last problem is when I remove de line  (answer (ident fuzzy_tos) (text ?ht&:(fuzzy-match ?ht "secaContinua"))) on the rule before, and I replace with
(answer (ident fuzzy_tos) (text 5)).
I response with a number 5 and the rule asserts the tos FuzzyValue. That trigger the next rule:

(defrule intensidad_dolor_cabeza
(declare (auto-focus TRUE))
        (check diagnostico-b)
        (tos ?t&:(fuzzy-match ?t "secaContinua"))
        (answer (ident fuzzy_dolor_cabeza) (text 5))
=>
        (assert (dolor_de_cabeza (new nrc.fuzzy.FuzzyValue ?*fuzzyDolorCabeza* "intenso")))
)

but when this rule trigger, send me the next error:

Jess reported an error in routine fuzzy-match
while executing (fuzzy-match ?t(0,0,0) "secaContinua")
while executing rule LHS (MTEQ)
while executing rule LHS (MTELN)
while executing rule LHS (TECT)
while executing (assert (interview::tos (new nrc.fuzzy.FuzzyValue ?*fuzzyTos* "secaContinua")))
while executing defrule interview::intensidad_tos.
  Message: Error during execution.

Please, I send you the clp file complete on the attachment, and if you can help me I'll be very grateful, because Im stuck with this problem.
Thanks again for your time!!

regards!!

Martin Rodriguez


Motor_Diagnostico_General.clp (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JESS: [EXTERNAL] Fwd: Problems with fuzzy jess implementations

Martín Rodríguez
Hi, I could overcome some problems with FuzzyJess implementation, and now I have a fuzzy rule that never executes when it should.
My Clip run using BackwardChaining, Im sure that the intensidad_tos rule assert the gripe fuzzyvalue fine, but the global_influenza rule never trigger,

Somebody can help me with that??

Thanks!!!!

The code is the next:

(defglobal ?*fuzzyDiagnosticoGripe* = (new FuzzyVariable "Diagnostico_gripal" 0.0 5.0 "integer"))

(defrule diagnostico_init
=>
        ;; the nrc FuzzyJess functions are loaded
        (load-package nrc.fuzzy.jess.FuzzyFunctions)
        (bind ?rlf (new RightLinearFunction))
        (bind ?llf (new LeftLinearFunction))
        ;; terms
        (?*fuzzyDiagnosticoGripe* addTerm "Comun" (new RFuzzySet 0.0 2.5 ?rlf))
        (?*fuzzyDiagnosticoGripe* addTerm "N1H1" (new LFuzzySet 2.5 5.0 ?llf))
)

(defrule intensidad_tos
(declare (auto-focus TRUE))
        (check diagnostico-b)
        (answer (ident fuzzy_tos) (text yes))
=>
        (assert (gripe (new nrc.fuzzy.FuzzyValue ?*fuzzyDiagnosticoGripe* "N1H1")))
)

(defrule global_influenza
    (gripeGlobal ?gg&:(fuzzy-match ?gg "N1H1")) 
 => 
   (MAIN::recommend-action "N1H1")
   (halt)
)

Motor_Diagnostico_General.clp (10K) Download Attachment
Loading...