Using jess with java, I'm creating a movie recommender expert system, it relies on information about the user like his/her preferred genre, his/her age, and the movies he/she has downloaded, I'm looking to add more sources of information (like the lead actors and directors of movies) to help me end up with the four best recommendations my system can come up with...
here is my code so far:
(deftemplate User
(declare (from-class User)))
(deftemplate Movie
(declare (from-class Movie)))
(deftemplate Download
(declare (from-class Download)))
(deftemplate Recommendation
(declare (from-class Recommendation)))
(deftemplate similar
(slot movieId1)
(slot movieId2))
(defrule find-similar
?movie1<-(Movie (movieId ?id1)(movieGenre ?genre))
?movie2<-(Movie (movieId ?id2&:(<> ?id2 ?id1))(movieGenre ?genre))
=>
(assert (similar (movieId1 ?id1) (movieId2 ?id2))))
(defrule recommend-movie-based-on-user-genre
"Recommends movies that has the same genre the user prefers."
(User (userId ?userId) (preferredGenre ?genre))
(Movie (movieId ?movieId) (movieGenre ?genre))
(not (Download (userId ?userId) (movieId ?movieId)))
(not (Recommendation (userId ?userId) (movieId ?movieId)))
=>
(add (new Recommendation ?userId ?movieId)))
(defrule recommend-movie-based-on-downloads
"Recommends movies similar to the ones the user has downloaded."
(Download (userId ?userId) (movieId ?movieId))
(similar (movieId1 ?movieId) (movieId2 ?movieId2))
(not (Download (userId ?userId) (movieId ?movieId2)))
(not (Recommendation (userId ?userId) (movieId ?movieId2)))
=>
(add (new Recommendation ?userId ?movieId2)))
my question is: how do I combine my different rules, in a way that makes my system capable of combining the information it's learned from each individual rule, and using that accumulated knowledge to come up with a "perfect" recommendation