Skip to main content

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)

Release files for cpkil 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cpkil 0.2.3
File Size Uploaded
cpkil-0.2.3.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cpkil 0.2.3
File Interpreter ABI Platform
cpkil-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / cpkil-0.2.3.tar.gz

Download URL cpkil-0.2.3.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
36a529febb16d586cc311c87f0baed105b2a066feafc4cb41b513f28981d9d37
BLAKE2b-256 checksum
How to use checksums
da87ec4d819df277db0a939a0ac2914771334a90d04e37d72e1f06b71e689ba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.12

Release files / cpkil-0.2.3-py3-none-any.whl

Download URL cpkil-0.2.3-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13d972929b0cb1d545ec1bb752abfc87da6efcd6f237aa19de21d07fd3dff531
BLAKE2b-256 checksum
How to use checksums
e671395944a3e4c65f85b1d82adbd8ac303b99ace2aba2564d3d2a6491c8b934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page