git: cf1652cc280a - main - misc/py-shap2: New port: Unified approach to explain the output of any machine learning model

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sat, 07 Jan 2023 03:21:16 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cf1652cc280a759e00f3a05ed2513f91814ee8e6

commit cf1652cc280a759e00f3a05ed2513f91814ee8e6
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-01-07 03:13:04 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-01-07 03:21:14 +0000

    misc/py-shap2: New port: Unified approach to explain the output of any machine learning model
---
 misc/Makefile                                     |  1 +
 misc/py-shap2/Makefile                            | 30 +++++++++++++++++++++++
 misc/py-shap2/distinfo                            |  3 +++
 misc/py-shap2/files/patch-shap2_cext_tree__shap.h | 11 +++++++++
 misc/py-shap2/pkg-descr                           |  4 +++
 5 files changed, 49 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index c78e5c76e165..a04c708946be 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -437,6 +437,7 @@
     SUBDIR += py-qiskit-machine-learning
     SUBDIR += py-scikit-fusion
     SUBDIR += py-serverfiles
+    SUBDIR += py-shap2
     SUBDIR += py-soapy_power
     SUBDIR += py-spdx
     SUBDIR += py-spdx-lookup
diff --git a/misc/py-shap2/Makefile b/misc/py-shap2/Makefile
new file mode 100644
index 000000000000..4ff449e64f1d
--- /dev/null
+++ b/misc/py-shap2/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	shap2
+DISTVERSION=	0.42.0
+CATEGORIES=	misc # machine-learning
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Unified approach to explain the output of any machine learning model
+WWW=		https://github.com/slundberg/shap
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+PY_DEPENDS=	${PYNUMPY} \
+		${PYTHON_PKGNAMEPREFIX}numba>0:devel/py-numba@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pandas>0:math/py-pandas@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}scikit-learn>0:science/py-scikit-learn@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}scipy>0:science/py-scipy@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}xgboost>0:misc/py-xgboost@${PY_FLAVOR}
+BUILD_DEPENDS=	${PY_DEPENDS}
+RUN_DEPENDS=	${PY_DEPENDS}
+
+USES=		python:3.6+
+USE_PYTHON=	distutils autoplist
+
+post-install:
+	@${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/shap2/_cext${PYTHON_EXT_SUFFIX}.so
+
+.include <bsd.port.mk>
diff --git a/misc/py-shap2/distinfo b/misc/py-shap2/distinfo
new file mode 100644
index 000000000000..6538f5c29e3a
--- /dev/null
+++ b/misc/py-shap2/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1673059649
+SHA256 (shap2-0.42.0.tar.gz) = a425c963131ea3e1f6c217e524821f9c2ae4d2e97d8ad5fd33f80fd175df5960
+SIZE (shap2-0.42.0.tar.gz) = 377323
diff --git a/misc/py-shap2/files/patch-shap2_cext_tree__shap.h b/misc/py-shap2/files/patch-shap2_cext_tree__shap.h
new file mode 100644
index 000000000000..d26268939600
--- /dev/null
+++ b/misc/py-shap2/files/patch-shap2_cext_tree__shap.h
@@ -0,0 +1,11 @@
+--- shap2/cext/tree_shap.h.orig	2023-01-07 02:47:51 UTC
++++ shap2/cext/tree_shap.h
+@@ -13,7 +13,7 @@
+ #include <ctime>
+ #if defined(_WIN32) || defined(WIN32)
+     #include <malloc.h>
+-#elif defined(__MVS__)
++#elif defined(__MVS__) || defined(__FreeBSD__)
+     #include <stdlib.h>
+ #else
+     #include <alloca.h>
diff --git a/misc/py-shap2/pkg-descr b/misc/py-shap2/pkg-descr
new file mode 100644
index 000000000000..0fb040562a62
--- /dev/null
+++ b/misc/py-shap2/pkg-descr
@@ -0,0 +1,4 @@
+SHAP (SHapley Additive exPlanations) is a game theoretic approach to explain
+the output of any machine learning model. It connects optimal credit
+allocation with local explanations using the classic Shapley values from game
+theory and their related extensions.