A docassemble package for case outcome prediction using the analogical reasoning features of openlcbr.
This post is a primer on what an analogical reasoner does, and why it's important to have one in the open-source toolkit.
This post provides a full explanation of how the IBP algorith, which docassemble-openlcbr implements, works.
Use the docassemble package manager to add the package from https://github.com/Gauntlet173/docassemble-openlcbr
Load the db_builder.yml interview for an interview that will assist you in building your own analogical reasoning tools for use with docassemble-openlcbr. That interview will provide you with a leave-one-out accuracy rating when the interview is complete.
In order to debug your reasoner, use the deep_reasoner_test.yml interview to view the detailed results of all leave-one-out tests of the prediction algorithm.
Once you have a working reasoner, implement it in your docassemble interview by following these steps:
.ibp_data
in the modules
block of your interview.objects
block of your interview, replacing
reasoner_name.yml
with the name of the file you uploaded:
objects:
- reasoner: DAIBPData
- database: DAStaticFile.using(filename="data/sources/reasoner_name.yml")
- test_case: DAIBPCase
test_case.factors
with the factor IDs from your
reasoner that are relevant to your test case.reasoner.load(database)
to initialize the reasoner. If you do not want to
include the cases listed in your database, you can call reasoner.load_model_only(database)
,
and then cases can be added to the reasoner using reasoner.add_precedent_case(case)
where case
is a DAIBPCase object with attributes of .id
, .winner
(either 'p'
or 'd'), and .factors
as in a test case.reasons = reasoner.predict(test_case, issue="id of root issue")
, replacing
"id of root issue" with the id you gave to the root issue in your database. It will
return a DATree object which is the explanation of the result.reasons.prediction
. The value 'p'
indicates that the outcome was predicted for the plaintiff, 'd' for the defendant,
and 'a' indicates that the reasoner abstained. To display a user-friendly version
call prediction_word(reasons.prediction)
, but be aware that what the reasoner
considers 'plaintiff' may represent 'true' in your interview, so prediction_word
is not always appropriate.features
block of your interview:
features:
javascript: docassemble.openlcbr:data/static/list_collapse.js
css: docassemble.openlcbr:data/static/list_collapse.css
reasons.display_tree()
to display a collapsing tree interface of
the reasoner's results.There are four live demos of docassemble-openlcbr functionality available. The source code for all the demos is included in the package:
Thanks to Clio's sponsorship of the ABA Fellowship Project, there is also a version of the Trade Secret interview which uses information obtained from a live Clio account, demonstrating the possibility of integrating docassemble-openlcbr with live data acquired over the Clio API.
In this demo, both the information from the test case and the precedents are obtained from the live Clio account. Only the factors and the issue model need to be specified in the database.
Click here for a live demo of the integration between Clio and docassemble-openlcbr.
A number of blog posts about the project are available at Jason Morris' Medium page.
Documentation for docassemble-openlcbr is still a work in progress, and will be available at https://gauntlet173.github.io/docassemble-openlcbr/.
Please report issues at the docassemble-openlcbr GitHub.
For support, join the #analogyproject channel at the docassemble slack.
To offer feedback, contact Jason Morris.