未提供项目描述
项目描述
Explingo
Explingo
将您的机器学习解释转换为人类友好的自然语言叙事。
注意:Explingo仍在积极开发中,目前仅支持几种基本解释类型和GPT-API模型。
安装
可以通过PIP安装Explingo
pip install explingo
使用方法
要将解释转换为叙事,您可以使用Narrator类。
from explingo import Narrator, Grader
example_narratives = [
("(Above ground living area square feet, 1256.00, -12527.46), (Overall material and finish of the house, 5.00, -10743.76), (Second floor square feet, 0.00, -10142.29)",
"The house's living area size of around 1,200 sq. ft., lower quality materials (5/10), and lack of a second floor are the main reasons for the low price."),
("(Second floor square feet, 854.00, 12757.84), (Original construction date, 2003.00, 9115.72)",
"The house's large second floor of around 850 sq. ft and recent construction date of 2003 increases its value."),
("(Overall material and finish of the house, 8.00, 10743.76), (Above ground living area square feet, 2000.00, 12527.46), (Second floor square feet, 1000.00, 10142.29)",
"The house's high quality materials (8/10), large living area size of around 2,000 sq. ft., and a second floor of around 1,000 sq. ft. are the main reasons for the high price."),
]
explanation_format = "(feature name, feature value, SHAP feature contribution)"
context = "The model predicts house prices"
narrator = Narrator(openai_api_key=[OPENAI_API_KEY],
explanation_format=explanation_format,
context=context,
labeled_train_data=example_narratives)
explanation = "(number of bathrooms, 3, 7020), (number of bedrooms, 4, 12903)"
narrative = narrator.narrate(explanation)
要评估生成的叙事的质量,您可以使用Grader类。
grader = Grader(openai_api_key=[OPENAI_API_KEY],
metrics="all",
sample_narratives=[narrative[1] for narrative in example_narratives])
metrics = grader(explanation=explanation,
explanation_format=explanation_format,
narrative=narrative)
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源分发
explingo-0.1.0.1.tar.gz (7.3 kB 查看哈希值)
构建分发
explingo-0.1.0.1-py3-none-any.whl (8.6 kB 查看哈希值)
关闭
explingo-0.1.0.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 31bbe2c6e103ad2e333ed51e10e7dd9893855922b70239738bc2e58cf4567f69 |
|
MD5 | f5b1fbabecb768f01b23f552a9f3431a |
|
BLAKE2b-256 | 000cc4a76142949732a58bf9223b8ee68ba2791737b3ddf6fc966fe75e9335a7 |