Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ce6a83c
Update Main Branch (#279)
crismunoz Nov 19, 2024
1fb319a
Update version and changelog
github-actions[bot] Nov 19, 2024
4b1e639
chore: update release workflows (#282)
crismunoz Dec 12, 2024
d780055
Update version and changelog
github-actions[bot] Dec 12, 2024
bb51e35
fix: Update publish-workflow.yml (#283)
crismunoz Dec 12, 2024
d8b0cf3
chore: Update Workflow Names (#284)
crismunoz Dec 12, 2024
d9accfb
Update publish-slack-workflow.yml (#285)
crismunoz Dec 12, 2024
a868983
feat: adding attribute inference attacker codes to security module
fracarfer5 Dec 17, 2024
484dc9f
chore: adding tutorials for classification tasks in inference attribu…
fracarfer5 Dec 18, 2024
5b6dde0
refactor: updating attribute inference classification tutorials
fracarfer5 Dec 19, 2024
9224c0c
chore: adding tutorials for attribute inference for regression cases
fracarfer5 Dec 19, 2024
9ef597d
test: adding unit tests for attribute inference modules
fracarfer5 Dec 20, 2024
847f939
refactor: updating inits
fracarfer5 Dec 20, 2024
e9dd330
chore: fixing lint
fracarfer5 Dec 20, 2024
6ce7d6d
Develop (#292)
crismunoz Feb 10, 2025
893c949
Develop (#294)
crismunoz Feb 12, 2025
2bc4d3b
Update version and changelog
github-actions[bot] Feb 12, 2025
8c36b26
Develop (#297)
crismunoz Mar 3, 2025
7ff7e70
Update publish-testpypi-workflow.yml
crismunoz Mar 3, 2025
f96892b
Update version and changelog
github-actions[bot] Mar 3, 2025
ff2b35b
Update publish-testpypi-workflow.yml
crismunoz Mar 3, 2025
fbe9e3a
Update pyproject.toml
crismunoz Mar 3, 2025
bc37961
Update publish-testpypi-workflow.yml
crismunoz Mar 3, 2025
36c4399
Update publish-testpypi-workflow.yml
crismunoz Mar 3, 2025
c94c18a
Update pyproject.toml
crismunoz Mar 3, 2025
5612d64
Update publish-testpypi-workflow.yml
crismunoz Mar 3, 2025
a1546ee
Delete .github/workflows/publish-testpypi-workflow.yml
crismunoz Mar 3, 2025
fb80076
Create __init__.py
crismunoz Mar 3, 2025
5180a9b
Update pyproject.toml
crismunoz Mar 3, 2025
979fcdf
Update version and changelog
github-actions[bot] Mar 3, 2025
96b084f
chore: fixing lint and formatting (#304)
fracarfer5 May 3, 2025
3a8004b
chore: deleting unused files
fracarfer5 May 7, 2025
1ff41af
refactor: updating tutorials
fracarfer5 May 7, 2025
28c08b1
refactor: updating attribute inference attackers
fracarfer5 May 7, 2025
afe8199
Merge branch 'main' of github.com:holistic-ai/holisticai into feature…
fracarfer5 May 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/publish-pypi-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish PyPI

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APPLICATION_ID }}
private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v4.2.2
with:
fetch-tags: true
fetch-depth: 0
ref: main
token: ${{ steps.app-token.outputs.token }} # Needed to trigger other actions

- name: Set up Python
uses: actions/setup-python@v5.3.0
with:
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch

- name: Get Latest Release Version
id: get_release
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest release version: $latest_tag"
echo "tag=$latest_tag" >> $GITHUB_ENV # Save the tag to an environment variable

- name: Publish to PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
run: |
hatch build
hatch publish




Comment on lines +8 to +51

Check warning

Code scanning / CodeQL

Workflow does not contain permissions

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}

Copilot Autofix

AI about 1 year ago

To fix the issue, we will add a permissions block at the workflow level (root level) to restrict the permissions of the GITHUB_TOKEN. Based on the workflow's functionality, it primarily requires read access to repository contents (e.g., fetching tags and code). Therefore, we will set contents: read as the minimal required permission. If additional permissions are needed in the future, they can be added explicitly.


Suggested changeset 1
.github/workflows/publish-pypi-workflow.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/publish-pypi-workflow.yml b/.github/workflows/publish-pypi-workflow.yml
--- a/.github/workflows/publish-pypi-workflow.yml
+++ b/.github/workflows/publish-pypi-workflow.yml
@@ -5,2 +5,5 @@
 
+permissions:
+  contents: read
+
 jobs:
EOF
@@ -5,2 +5,5 @@

permissions:
contents: read

jobs:
Copilot is powered by AI and may make mistakes. Always verify output.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish and Notification
name: Slack Notification

on:
workflow_dispatch:
Expand All @@ -21,42 +21,26 @@ jobs:
ref: main
token: ${{ steps.app-token.outputs.token }} # Needed to trigger other actions

- name: Set up Python
uses: actions/setup-python@v5.3.0
with:
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch

- name: Get Latest Release Version
id: get_release
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest release version: $latest_tag"
echo "tag=$latest_tag" >> $GITHUB_ENV # Save the tag to an environment variable

- name: Publish to PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
run: |
hatch build
hatch publish

- name: Post to a Slack channel
id: slack
uses: slackapi/slack-github-action@v2.0.0
with:
channel-id: "${{ vars.SLACK_CHANNEL_ID }}"
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
{
"channel": "${{ vars.SLACK_CHANNEL_ID }}",
"text": "Release holisticai *v${{env.tag}}* is on the way :rocket:",
"attachments": [
{
"color": "#36a64f",
"pretext": "Release holisticai *v${{env.tag}}* is on the way :rocket:",
"fields": [
{
"title": "Release Notes",
Expand All @@ -77,9 +61,3 @@ jobs:
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}




36 changes: 26 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,28 @@

All notable changes to this project will be documented in this file.

## [1.0.12] - 2025-02-12

### 🐛 Bug Fixes

- Update publish-workflow.yml (#283)

### ⚙️ Miscellaneous Tasks

- Update Workflow Names (#284)

## [1.0.11] - 2024-12-12

### ⚙️ Miscellaneous Tasks

- Update release workflows (#282)

## [1.0.7] - 2024-11-01

### 💼 Other

- Develop -> main (#260)

### 📚 Documentation

- Update Documentation (#235)
Expand All @@ -12,10 +32,6 @@ All notable changes to this project will be documented in this file.

- Fix documentation (#233)

### Merge

- Develop -> main (#260)

## [1.0.6] - 2024-09-23

### 🚀 Features
Expand Down Expand Up @@ -216,7 +232,7 @@ All notable changes to this project will be documented in this file.

- Release new mitigation techniques (#4)

### Bump
### 💼 Other

- Version 0.2.0 → 0.3.0

Expand All @@ -226,7 +242,7 @@ All notable changes to this project will be documented in this file.

- Test new version

### Bump
### 💼 Other

- Version 0.1.3 → 0.1.4

Expand All @@ -240,13 +256,13 @@ All notable changes to this project will be documented in this file.
- Remove unused imports
- Test new version

### 💼 Other

- Version 0.1.1 → 0.1.2

### 🚜 Refactor

- Second commit
- Remove .idea directory

### Bump

- Version 0.1.1 → 0.1.2

<!-- generated by git-cliff -->
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Holistic AI currently focuses on five verticals of AI trustworthiness:

```bash
pip install holisticai # Basic installation
pip install holisticai[datasets] # add datasets and plot dependencies
pip install holisticai[bias] # Bias mitigation support
pip install holisticai[explainability] # For explainability metrics and plots
pip install holisticai[all] # Install all packages for bias and explainability
Expand Down
5 changes: 4 additions & 1 deletion docs/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ You can install the library with `pip` using the following command:

# Basic installation of the library
pip install holisticai


# Additional packages for handle datasets and visualization
pip install holisticai[datasets]

# bias mitigation support
pip install holisticai[bias]

Expand Down
15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,17 @@ classifiers = [
dependencies = [
"scikit-learn>=1.0.2",
"pandas",
"matplotlib",
"networkx>=3.1",
"seaborn",
"numpy>=1.25",
"pybind11>=2.12",
"pyarrow"
]

[project.optional-dependencies]
datasets = ["networkx>=3.1", "matplotlib", "seaborn", "pybind11>=2.12", "pyarrow", "fastparquet"]
bias = ["networkx>=3.1", "pygad==3.3.1", "jax>=0.4.30", "jaxopt>=0.8.3", "optax>=0.2.3", "flax>=0.8.5"]
explainability = ["lime>=0.2.0.1", "shap>=0.42.1"]
security = ["jax>=0.4.30", "jaxopt>=0.8.3"]
all = ["networkx>=3.1", "pygad==3.3.1", "lime>=0.2.0.1", "shap>=0.42.1", "jax>=0.4.30", "jaxopt>=0.8.3", "optax>=0.2.3", "flax>=0.8.5"]
all = ["networkx>=3.1", "pygad==3.3.1", "lime>=0.2.0.1", "shap>=0.42.1", "jax>=0.4.30", "jaxopt>=0.8.3", "optax>=0.2.3", "flax>=0.8.5", "networkx>=3.1", "matplotlib", "seaborn", "pybind11>=2.12", "pyarrow", "fastparquet"]

[project.urls]
Documentation = "https://github.com/holistic-ai/holisticai#readme"
Expand Down Expand Up @@ -118,7 +116,9 @@ dependencies = [
"jax",
"jaxopt",
"optax",
"flax"
"flax",
"pyarrow==19.0.0",
"fastparquet"
]
env-vars = { PYTHONPATH = "src" }

Expand All @@ -130,4 +130,7 @@ foo = ["which python"]
env-vars = { PYTHONPATH = "src" }

[tool.hatch.build.targets.wheel]
packages = ["src/holisticai"]
packages = [
"src/holisticai",
]

2 changes: 1 addition & 1 deletion ruff_default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ select = [
"ICN001",
"ICN002",
"ICN003",
"INP001",
#"INP001",
"INT001",
"INT002",
"INT003",
Expand Down
2 changes: 1 addition & 1 deletion src/holisticai/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.9"
__version__ = "1.0.14"
1 change: 1 addition & 0 deletions src/holisticai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file.
8 changes: 4 additions & 4 deletions src/holisticai/bias/metrics/_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import numpy as np
import pandas as pd

# Efficacy metrics
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score
from sklearn.neighbors import NearestNeighbors

# utils
from holisticai.utils._validation import (
_array_like_to_numpy,
Expand All @@ -13,10 +17,6 @@
_regression_checks,
)

# Efficacy metrics
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score
from sklearn.neighbors import NearestNeighbors


def _group_success_rate(g, y):
"""Group success rate.
Expand Down
5 changes: 3 additions & 2 deletions src/holisticai/bias/metrics/_clustering.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import numpy as np
import pandas as pd
from holisticai.utils._recommender_tools import entropy
from holisticai.utils._validation import _clustering_checks

# sklearn imports
from sklearn.metrics import (
Expand All @@ -10,6 +8,9 @@
silhouette_samples,
)

from holisticai.utils._recommender_tools import entropy
from holisticai.utils._validation import _clustering_checks


def cluster_balance(group_a, group_b, y_pred):
"""Cluster Balance
Expand Down
6 changes: 3 additions & 3 deletions src/holisticai/bias/metrics/_recommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import numpy as np
import pandas as pd

# sklearn imports
from sklearn.metrics import mean_absolute_error

# utils
from holisticai.utils import mat_to_binary, normalize_tensor

Expand All @@ -16,9 +19,6 @@
)
from holisticai.utils._validation import _recommender_checks

# sklearn imports
from sklearn.metrics import mean_absolute_error


def aggregate_diversity(mat_pred, top=None, thresh=0.5, normalize=False):
r"""Aggregate Diversity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

from typing import Optional

from holisticai.bias.mitigation.commons.disparate_impact_remover._categorical_repairer import CategoricalRepairer
from holisticai.bias.mitigation.commons.disparate_impact_remover._utils import (
freedman_diaconis_bin_size as bin_calculator,
Expand Down Expand Up @@ -46,7 +44,7 @@ def __init__(
feature_to_repair: int,
repair_level: float,
kdd: bool = False,
features_to_ignore: Optional[list[str]] = None,
features_to_ignore: list[str] | None = None,
):
if features_to_ignore is None:
features_to_ignore = []
Expand Down
Loading