Skip to main content

CPR Python Package

Project description

Causal Process Knowledge-Infused Reasoning (CPR)

CPR is a novel approach that combines machine learning models with causal process knowledge structures to create explainable and reliable AI systems. By infusing domain-specific causal knowledge into the learning process, CPR enables the generation of interpretable predictions that can be audited and refined by subject matter experts.

Overview

The CPR framework consists of the following components:

  1. Causal Process Knowledge Structure: A representation of the domain-specific causal processes and relationships between concepts, typically in the form of a tree or graph structure.
  2. CPR Function Approximation: A machine learning model that learns to map the input data to target outcomes while being constrained by the causal process knowledge structure.

By leveraging the causal process knowledge structure, CPR can provide human-understandable explanations for its predictions, tracing the causal reasoning process and enabling iterative refinement with domain experts in the loop.

Key Features

  • Explainable Predictions: CPR generates predictions accompanied by explanations that follow the causal process knowledge structure, making the reasoning process transparent and interpretable.
  • Domain Knowledge Integration: CPR incorporates domain-specific causal knowledge into the learning process, ensuring that the model's predictions align with established domain principles and frameworks.
  • Open-Source and Extensible: The CPR library is open-source and designed to be extensible, allowing researchers and practitioners to build upon and contribute to its development.

Installation

To install the CPR library, you can use pip: pip install cpkil

Usage

Import the PKiL library First, ensure that you have installed the PKiL (Process Knowledge-infused Learning) library.

from PKiL import ProKnow

Prepare the concept and annotation files The PKiL library requires two files to load the causal process knowledge: concepts_file.txt: This file should contain a list of concepts or entities relevant to your domain, each on a new line. annotatation.txt: This file should contain the causal relationships or annotations between the concepts, represented in a structured format specified by the library documentation. Modify the code snippet Replace 'concepts_file.txt' and 'annotatation.txt' in the process_knowledge method call with the actual filenames of your concept and annotation files, respectively.

pk1.process_knowledge('your_concepts_file.txt', 'your_annotation_file.txt')

Provide the input data Modify the test_point variable to hold the input data you want to evaluate using the causal process knowledge. This could be a text string, a file path, or any other data format supported by the library.

test_point = 'This is a sample input text.'

Run the code Execute the code snippet, which will load the causal process knowledge, evaluate the input data (test_point), and return the predicted label and explanation (if explanation=True).

label = pk1.evaluate_pk(test_point, explanation=True)
print(f"Predicted label: {label}")

Interpret the results The label variable will contain the predicted label for the input data based on the causal process knowledge. If explanation=True, the evaluate_pk method should also provide an explanation for the predicted label, which you can print or analyze as needed.

test_point = "This is a sample input text."  

from PKiL import ProKnow

pk1 = ProKnow()
pk1.process_knowledge('your_concepts_file.txt', 'your_annotation_file.txt')

#test_point = test_point

label = pk1.evaluate_pk(test_point,explanation=True)

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

cpkil-0.2.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

cpkil-0.2.3-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file cpkil-0.2.3.tar.gz.

File metadata

  • Download URL: cpkil-0.2.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for cpkil-0.2.3.tar.gz
Algorithm Hash digest
SHA256 36a529febb16d586cc311c87f0baed105b2a066feafc4cb41b513f28981d9d37
MD5 37aeef621b36358d13f040ca6591f6c4
BLAKE2b-256 da87ec4d819df277db0a939a0ac2914771334a90d04e37d72e1f06b71e689ba4

See more details on using hashes here.

File details

Details for the file cpkil-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: cpkil-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for cpkil-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 13d972929b0cb1d545ec1bb752abfc87da6efcd6f237aa19de21d07fd3dff531
MD5 08ca5422e60c44d58d210d56f0b32212
BLAKE2b-256 e671395944a3e4c65f85b1d82adbd8ac303b99ace2aba2564d3d2a6491c8b934

See more details on using hashes here.

Supported by

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