Skip to content

tohojo/cbr-system

Repository files navigation

cbr-system

An implementation of a Case Based Reasoning (CBR) system for assignment one of COMPSCI767, semester 1 2012, University of Auckland.

Written in Python, using the travel case base.

See design-notes.org for further information on application design. For more information on CBR see Ian Watson’s page on CBR.

Installation

The application runs on Python 3. Apart from the standard library, the application depends on the geopy library. See the project website for installation details (or just try issuing sudo easy_install geopy).

Running

To run the application, simply run ./main.py (on unix) or python2 main.py (on any platform). The application runs as a command-line console, and uses the readline library (if available) to provide command line history and completion.

A typical workflow for using the application is to set query parameters using the query set command, which will (by default) also run a query against the case-base.

The application strives to be self-documenting via the built-in help command. Simply type help when inside the application, to get a list of commands. The following is the output of the help command (>> is the application prompt):

>> help
These are the accepted commands.
Type help <command> to get help on a specific command.

status    Show summary of system status.
query     Manipulate and run query.
result    Show result of a query.
config    Set config variables.
exit      Exit application.

Running in batch mode

Commands can be run in batch-mode by piping multiple commands (one on each line) to the standard input of the application. When run in batch mode, automatic running of queries is turned off by default. Thus, an explicit command of query run is needed to run the query and show the results. This allows multiple query parameters to be set, while only printing the final result.

If desired, the automatic behaviour can be turned back on by the config command.

Loading the case-base

If found, the case-base is loaded from ‘cases.pickle’ in the current directory, which contains a parsed case-base. The case-base can be (re)parsed by running parser.py, which can parse either a .csv file, or a .cases file (from the travel case base) and writes the result to cases.pickle. Examples of both files are provided with the application. The parsed case-base contains the cases from reise.cases.

Location search

To provide similarity metrics, a location-based search (provided by the geopy library) is used. This searches maps.google.co.nz for the provided place-name (a correction table is provided to ensure useful matches for all locations in the travel case base), and uses the first match for the similarity metric.

For this to work, an internet connection must be available. Looked up names are stored in a cache, saved between program runs. Provided with the application, is a cache containing all place names in the travel case base (clear this by removing location_cache.pickle). If no internet connection is available, lookup only works on already cached items.

About

CBR system for COMPSCI767 assignment, semester 1 2012, University of Auckland

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published