top of page

Case Based Reasoning Prototype

 

Case-Based Reasoning (CBR) is an AI problem-solving approach consisting of deciding what to do in your current situation based on what has worked for similar situations in the past. The roots of CBR are in Cognitive Science: it is clearly based on problem-solving approaches commonly used by humans. 

 

CBR Cycle: Retrieve, Reuse, Revise, and Retain. 

  • Retrieve: going back into memory to find scenarios that are similar to the current one. “Memory” is represented as a “case base”, each component “case” of which will, in the simplest form, contain a previously-solved problem and its solution.

  • Reusing: taking the retrieved similar scenario(s) and applying its/their associated solution(s) to the current problem. Adaptation will be conducted if necessary.

  • Revising: If inadequacies are found while testing retrieved (and, possibly, adapted) solutions on the new problem, the solutions are revised and reused again. 

  • Retain: storing the final solution, along with the problem it solves, back in the case base.

 

Prototype Overview: 

With case-based reasoning, we implemented a demonstration of recommender system. In the demonstration, a message which says “What kind of food do you want?” displays, and the program suggests 5 choices to a user: salty, sweet, sour, spicy, and bitter food. A user chooses one of them, and based on the choice, the 5 recommended food display.

 

Algorithm Used:

In this demonstration, we used Bounded Greedy, which is an algorithm of Case-Based Reasoning. With this algorithm, not only similarity but also diversity are considered when selecting recommendation so that a user can see diverse choices to a certain extent.

 

Implementation Details: 

To implement the algorithm, we created FoodRecommender class, where 15 variables for food are set, and each food variable has 6 properties: name and how salty, sweet, sour, spicy, and bitter the food is. Each taste of food has a number between 1 and 5. For example, for variable “sample” with data type food, “sample.spicy” returns a number between 1 to 5, and 5 is the most spicy, and 1 is the least spicy. When a program gets a user input, the program creates a sample food. For example, if a user chooses a sweet food, properties of the sample food are: salty is 1, sweet is 5, sour is 1, spicy is 1 and bitter is 1. Then, the sample food is compared with each prepared food, and similarity and diversity are calculated. For calculation of similarity, the program checks how close the values of properties of the sample food and each prepared food are. For diversity, the program checks how different the values of properties of the each food and food chosen already as recommendation are. After calculating similarity and diversity, the program sums them up to get the quality of the result, but there is a ratio to get the quality.

 

Similarity Threshold:

In the program, the ratio is set to 0.7. Therefore, 70% of similarity and 30% of diversity are summed to obtain the quality of the food. Then, food with the highest quality is selected as recommendation. After creating FoodRecommender class, we made a blueprint, and the blueprint connects key events and functions in the FoodRecommender class so that a user input triggers functions of FoodRecommneder class.

Food choices

Food choices

Food recommendations - Sweet

Food recommendations - Sweet

© 2015 Ohio Northern University

bottom of page