Skip to main content

CaseBased is a python library that implements the priciples of case-based reasoning.

Project description

Python Version Dependencies Status

Code style: black Security: bandit Pre-commit Semantic Versions License Coverage Report


📃 Our Paper on CBR


Casebased - A Python Library for Case-Based Reasoning

PyPI Version Python Versions License

Casebased is a Python library that provides a flexible and extensible framework for implementing case-based reasoning (CBR) systems. CBR is a problem-solving paradigm that focuses on solving new problems by adapting solutions that were used to solve similar past problems.

Features

Feature Description
Case Representation Represent cases using a variety of data structures, including dictionaries, JSON, and custom classes.
Case Retrieval Implement different case retrieval algorithms, such as nearest neighbor, fuzzy matching, and knowledge-guided search.
Case Adaptation Provide functions to adapt retrieved cases to fit the current problem.
Case Evaluation Assess the quality of the adapted solution and provide feedback to the system.
Case Learning Automatically learn from successful and unsuccessful problem-solving experiences to improve future performance.
Extensibility Easily integrate the library with your own domain-specific data and algorithms.

Installation

You can install the casebased library using pip:

pip install casebased

Usage

Here's a simple example of how to use the casebased library:

from casebased.case_base import CaseBase from casebased.retrieval import NearestNeighborRetriever

Create a case base

case_base = CaseBase()

Add cases to the case base

case_base.add_case({
"problem": {
"symptoms": ["fever", "headache", "sore throat"],
"duration": 3
},
"solution": {
"medication": "paracetamol",
"dosage": "500mg every 6 hours"
}
})
case_base.add_case({
"problem": {
"symptoms": ["cough", "runny nose", "fatigue"],
"duration": 5
},
"solution": {
"medication": "ibuprofen",
"dosage": "400mg every 8 hours"
}
})

Retrieve the most similar case

new_problem = {
"symptoms": ["fever", "headache", "sore throat"],
"duration": 2
}

retriever = NearestNeighborRetriever()
similar_case = retriever.retrieve(case_base, new_problem)

print(f"Similar case: {similar_case}")
print(f"Suggested solution: {similar_case['solution']}")

📈 Releases

You can see the list of available releases on the GitHub Releases page.

We follow Semantic Versions specification.

We use Release Drafter. As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready. With the categories option, you can categorize pull requests in release notes using labels.

List of labels and corresponding titles

Label Title in Releases
enhancement, feature 🚀 Features
bug, refactoring, bugfix, fix 🔧 Fixes & Refactoring
build, ci, testing 📦 Build System & CI/CD
breaking 💥 Breaking Changes
documentation 📝 Documentation
dependencies ⬆️ Dependencies updates

You can update it in release-drafter.yml.

GitHub creates the bug, enhancement, and documentation labels for you. Dependabot creates the dependencies label. Create the remaining labels on the Issues tab of your GitHub repository, when you need them.

🛡 License

License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

📃 Citation

@misc{casebased,
  author = {casebased},
  title = {CaseBased is a python library that implements the priciples of case-based reasoning.},
  year = {2024},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/casebased/casebased}}
}

Credits 🚀 Your next Python package needs a bleeding-edge project structure.

This project was generated with python-package-template

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

casebased-0.1.6.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

casebased-0.1.6-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file casebased-0.1.6.tar.gz.

File metadata

  • Download URL: casebased-0.1.6.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for casebased-0.1.6.tar.gz
Algorithm Hash digest
SHA256 a45ddfbfe0eaec261985c197828944f135a29f1909a07020e3545c44ccefd1a4
MD5 bd15d4f9c6eff891284c950718e71e66
BLAKE2b-256 79a57522e609e56886fa9ba757aa0eea1889bba994bd38e95150858f032a5e50

See more details on using hashes here.

Provenance

The following attestation bundles were made for casebased-0.1.6.tar.gz:

Publisher: publish_to_pip.yml on Case-Based/casebased

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file casebased-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: casebased-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for casebased-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 93af5fbd8b748ab0f7c16919632de43696d0d601a94fd5688939ecdf130f8ea5
MD5 023e24ce68eee424b627510ca7c4a0b1
BLAKE2b-256 d760a2ae0cefdcd6051040ba6c521bd070abd88d127d3aa5c9e4f767cc17d3ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for casebased-0.1.6-py3-none-any.whl:

Publisher: publish_to_pip.yml on Case-Based/casebased

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page