casebased


Namecasebased JSON
Version 0.1.6 PyPI version JSON
download
home_pageNone
SummaryCaseBased is a python library that implements the priciples of case-based reasoning.
upload_time2025-02-17 15:30:41
maintainerNone
docs_urlNone
authorJonas Liendl
requires_python<4.0,>=3.9
licenseThe MIT License (MIT) Copyright (c) 2024 casebased Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords cbr case-based reasoning ml machine learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="left">

[![Python Version](https://img.shields.io/pypi/pyversions/casebased.svg)](https://pypi.org/project/casebased/)
[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/Case-Based/casebased/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Security: bandit](https://img.shields.io/badge/security-bandit-green.svg)](https://github.com/PyCQA/bandit)
[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/Case-Based/casebased/blob/main/.pre-commit-config.yaml)
[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/Case-Based/casebased/releases)
[![License](https://img.shields.io/github/license/Case-Based/casebased)](https://github.com/Case-Based/casebased/blob/master/LICENSE)
![Coverage Report](assets/images/coverage.svg)

---

### [πŸ“ƒ Our Paper on CBR](https://github.com/user-attachments/files/16977337/SA-I_IT22_KlockenhoffLukas-KloettschenJannekLiendlJonas.pdf)

---

# Casebased - A Python Library for Case-Based Reasoning

[![PyPI Version](https://img.shields.io/pypi/v/casebased.svg)](https://pypi.org/project/casebased/)
[![Python Versions](https://img.shields.io/pypi/pyversions/casebased.svg)](https://pypi.org/project/casebased/)
[![License](https://img.shields.io/pypi/l/casebased.svg)](https://github.com/Case-Based/casebased/blob/main/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:

<antArtifact identifier="casebased-example" type="application/vnd.ant.code" language="python" title="Casebased Library Example">
from casebased.case_base import CaseBase
from casebased.retrieval import NearestNeighborRetriever

# Create a case base
case_base = CaseBase()

# Add cases to the case base
```python
case_base.add_case({
"problem": {
"symptoms": ["fever", "headache", "sore throat"],
"duration": 3
},
"solution": {
"medication": "paracetamol",
"dosage": "500mg every 6 hours"
}
})
```

```python
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
```python
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](https://github.com/casebased/casebased/releases) page.

We follow [Semantic Versions](https://semver.org/) specification.

We use [`Release Drafter`](https://github.com/marketplace/actions/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`](https://github.com/casebased/casebased/blob/main/.github/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](https://img.shields.io/github/license/Case-Based/casebased)](https://github.com/Case-Based/casebased/blob/main/LICENSE)

This project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/Case-Based/casebased/blob/main/LICENSE) for more details.

## πŸ“ƒ Citation

```bibtex
@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.](https://img.shields.io/badge/python--package--template-%F0%9F%9A%80-brightgreen)](https://github.com/TezRomacH/python-package-template)

This project was generated with [`python-package-template`](https://github.com/TezRomacH/python-package-template)


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "casebased",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "CBR, case-based reasoning, ML, Machine Learning",
    "author": "Jonas Liendl",
    "author_email": "casebased@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/79/a5/7522e609e56886fa9ba757aa0eea1889bba994bd38e95150858f032a5e50/casebased-0.1.6.tar.gz",
    "platform": null,
    "description": "<div align=\"left\">\n\n[![Python Version](https://img.shields.io/pypi/pyversions/casebased.svg)](https://pypi.org/project/casebased/)\n[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/Case-Based/casebased/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Security: bandit](https://img.shields.io/badge/security-bandit-green.svg)](https://github.com/PyCQA/bandit)\n[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/Case-Based/casebased/blob/main/.pre-commit-config.yaml)\n[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/Case-Based/casebased/releases)\n[![License](https://img.shields.io/github/license/Case-Based/casebased)](https://github.com/Case-Based/casebased/blob/master/LICENSE)\n![Coverage Report](assets/images/coverage.svg)\n\n---\n\n### [\ud83d\udcc3 Our Paper on CBR](https://github.com/user-attachments/files/16977337/SA-I_IT22_KlockenhoffLukas-KloettschenJannekLiendlJonas.pdf)\n\n---\n\n# Casebased - A Python Library for Case-Based Reasoning\n\n[![PyPI Version](https://img.shields.io/pypi/v/casebased.svg)](https://pypi.org/project/casebased/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/casebased.svg)](https://pypi.org/project/casebased/)\n[![License](https://img.shields.io/pypi/l/casebased.svg)](https://github.com/Case-Based/casebased/blob/main/LICENSE)\n\n**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.\n\n## Features\n\n| Feature                | Description                                                                |\n| ---------------------- | -------------------------------------------------------------------------- |\n| Case Representation    | Represent cases using a variety of data structures, including dictionaries, JSON, and custom classes. |\n| Case Retrieval         | Implement different case retrieval algorithms, such as nearest neighbor, fuzzy matching, and knowledge-guided search. |\n| Case Adaptation        | Provide functions to adapt retrieved cases to fit the current problem. |\n| Case Evaluation        | Assess the quality of the adapted solution and provide feedback to the system. |\n| Case Learning          | Automatically learn from successful and unsuccessful problem-solving experiences to improve future performance. |\n| Extensibility          | Easily integrate the library with your own domain-specific data and algorithms. |\n\n## Installation\n\nYou can install the `casebased` library using pip:\n\n```\npip install casebased\n```\n\n## Usage\n\nHere's a simple example of how to use the `casebased` library:\n\n<antArtifact identifier=\"casebased-example\" type=\"application/vnd.ant.code\" language=\"python\" title=\"Casebased Library Example\">\nfrom casebased.case_base import CaseBase\nfrom casebased.retrieval import NearestNeighborRetriever\n\n# Create a case base\ncase_base = CaseBase()\n\n# Add cases to the case base\n```python\ncase_base.add_case({\n\"problem\": {\n\"symptoms\": [\"fever\", \"headache\", \"sore throat\"],\n\"duration\": 3\n},\n\"solution\": {\n\"medication\": \"paracetamol\",\n\"dosage\": \"500mg every 6 hours\"\n}\n})\n```\n\n```python\ncase_base.add_case({\n\"problem\": {\n\"symptoms\": [\"cough\", \"runny nose\", \"fatigue\"],\n\"duration\": 5\n},\n\"solution\": {\n\"medication\": \"ibuprofen\",\n\"dosage\": \"400mg every 8 hours\"\n}\n})\n```\n# Retrieve the most similar case\n```python\nnew_problem = {\n\"symptoms\": [\"fever\", \"headache\", \"sore throat\"],\n\"duration\": 2\n}\n\nretriever = NearestNeighborRetriever()\nsimilar_case = retriever.retrieve(case_base, new_problem)\n\nprint(f\"Similar case: {similar_case}\")\nprint(f\"Suggested solution: {similar_case['solution']}\")\n```\n\n## \ud83d\udcc8 Releases\n\nYou can see the list of available releases on the [GitHub Releases](https://github.com/casebased/casebased/releases) page.\n\nWe follow [Semantic Versions](https://semver.org/) specification.\n\nWe use [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you\u2019re ready. With the categories option, you can categorize pull requests in release notes using labels.\n\n### List of labels and corresponding titles\n\n|               **Label**               |  **Title in Releases**  |\n| :-----------------------------------: | :---------------------: |\n|       `enhancement`, `feature`        |       \ud83d\ude80 Features       |\n| `bug`, `refactoring`, `bugfix`, `fix` | \ud83d\udd27 Fixes & Refactoring  |\n|       `build`, `ci`, `testing`        | \ud83d\udce6 Build System & CI/CD |\n|              `breaking`               |   \ud83d\udca5 Breaking Changes   |\n|            `documentation`            |    \ud83d\udcdd Documentation     |\n|            `dependencies`             | \u2b06\ufe0f Dependencies updates |\n\nYou can update it in [`release-drafter.yml`](https://github.com/casebased/casebased/blob/main/.github/release-drafter.yml).\n\nGitHub 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.\n\n## \ud83d\udee1 License\n[![License](https://img.shields.io/github/license/Case-Based/casebased)](https://github.com/Case-Based/casebased/blob/main/LICENSE)\n\nThis project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/Case-Based/casebased/blob/main/LICENSE) for more details.\n\n## \ud83d\udcc3 Citation\n\n```bibtex\n@misc{casebased,\n  author = {casebased},\n  title = {CaseBased is a python library that implements the priciples of case-based reasoning.},\n  year = {2024},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/casebased/casebased}}\n}\n```\n\n## Credits [![\ud83d\ude80 Your next Python package needs a bleeding-edge project structure.](https://img.shields.io/badge/python--package--template-%F0%9F%9A%80-brightgreen)](https://github.com/TezRomacH/python-package-template)\n\nThis project was generated with [`python-package-template`](https://github.com/TezRomacH/python-package-template)\n\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)\n         Copyright (c) 2024 casebased\n         \n         Permission is hereby granted, free of charge, to any person obtaining a copy\n         of this software and associated documentation files (the \"Software\"), to deal\n         in the Software without restriction, including without limitation the rights\n         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n         copies of the Software, and to permit persons to whom the Software is\n         furnished to do so, subject to the following conditions:\n         \n         The above copyright notice and this permission notice shall be included in all\n         copies or substantial portions of the Software.\n         \n         THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n         EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n         MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n         IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n         DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n         OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE\n         OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "CaseBased is a python library that implements the priciples of case-based reasoning.",
    "version": "0.1.6",
    "project_urls": {
        "Homepage": "https://www.casebased.org/",
        "Repository": "https://github.com/Case-Based/casebased"
    },
    "split_keywords": [
        "cbr",
        " case-based reasoning",
        " ml",
        " machine learning"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d760a2ae0cefdcd6051040ba6c521bd070abd88d127d3aa5c9e4f767cc17d3ac",
                "md5": "023e24ce68eee424b627510ca7c4a0b1",
                "sha256": "93af5fbd8b748ab0f7c16919632de43696d0d601a94fd5688939ecdf130f8ea5"
            },
            "downloads": -1,
            "filename": "casebased-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "023e24ce68eee424b627510ca7c4a0b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 28879,
            "upload_time": "2025-02-17T15:30:39",
            "upload_time_iso_8601": "2025-02-17T15:30:39.597377Z",
            "url": "https://files.pythonhosted.org/packages/d7/60/a2ae0cefdcd6051040ba6c521bd070abd88d127d3aa5c9e4f767cc17d3ac/casebased-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "79a57522e609e56886fa9ba757aa0eea1889bba994bd38e95150858f032a5e50",
                "md5": "bd15d4f9c6eff891284c950718e71e66",
                "sha256": "a45ddfbfe0eaec261985c197828944f135a29f1909a07020e3545c44ccefd1a4"
            },
            "downloads": -1,
            "filename": "casebased-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "bd15d4f9c6eff891284c950718e71e66",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 23065,
            "upload_time": "2025-02-17T15:30:41",
            "upload_time_iso_8601": "2025-02-17T15:30:41.217219Z",
            "url": "https://files.pythonhosted.org/packages/79/a5/7522e609e56886fa9ba757aa0eea1889bba994bd38e95150858f032a5e50/casebased-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-17 15:30:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Case-Based",
    "github_project": "casebased",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "casebased"
}
        
Elapsed time: 1.34816s