Skip to content

Commit

Permalink
chore: pdpbox deps
Browse files Browse the repository at this point in the history
  • Loading branch information
GilesStrong committed Oct 29, 2024
1 parent 2a47d1d commit ba373f8
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 32 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ And for a live tutorial, checkout my talk at PyHEP 2021: https://www.youtube.com

Several examples are present in the form of Jupyter Notebooks in the `examples` folder. These can be run also on Google Colab to allow you to quickly try out the package.

1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Simple_Binary_Classification_of_earnings.ipynb) `examples/Simple_Binary_Classification_of_earnings.ipynb`: Very basic binary-classification example
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Binary_Classification_Signal_versus_Background.ipynb) `examples/Binary_Classification_Signal_versus_Background.ipynb`: Binary-classification example in a high-energy physics context
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Multiclass_Classification_Signal_versus_Backgrounds.ipynb) `examples/Multiclass_Classification_Signal_versus_Backgrounds.ipynb`: Multiclass-classification example in a high-energy physics context
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Single_Target_Regression_Di-Higgs_mass_prediction.ipynb) `examples/Single_Target_Regression_Di-Higgs_mass_prediction.ipynb`: Single-target regression example in a high-energy physics context
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Multi_Target_Regression_Di-tau_momenta.ipynb) `examples/Multi_Target_Regression_Di-tau_momenta.ipynb`: Multi-target regression example in a high-energy physics context
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Feature_Selection.ipynb) `examples/Feature_Selection.ipynb`: In-depth walkthrough for automated feature-selection
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Advanced_Model_Building.ipynb) `examples/Advanced_Model_Building.ipynb`: In-depth look at building more complicated models and a few advanced interpretation techniques
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Model_Exporting.ipynb) `examples/Model_Exporting.ipynb`: Walkthough for exporting a trained model to ONNX and TensorFlow
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/RNNs_CNNs_and_GNNs_for_matrix_data.ipynb) `examples/RNNs_CNNs_and_GNNs_for_matrix_data.ipynb`: Various examples of applying RNNs, CNNs, and GNNs to matrix data (top-tagging on jet constituents)
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.0/examples/Learning_To_Pivot.ipynb) `examples/Learning_To_Pivot.ipynb`: Example of adversarial training for parameter invariance
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Simple_Binary_Classification_of_earnings.ipynb) `examples/Simple_Binary_Classification_of_earnings.ipynb`: Very basic binary-classification example
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Binary_Classification_Signal_versus_Background.ipynb) `examples/Binary_Classification_Signal_versus_Background.ipynb`: Binary-classification example in a high-energy physics context
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Multiclass_Classification_Signal_versus_Backgrounds.ipynb) `examples/Multiclass_Classification_Signal_versus_Backgrounds.ipynb`: Multiclass-classification example in a high-energy physics context
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Single_Target_Regression_Di-Higgs_mass_prediction.ipynb) `examples/Single_Target_Regression_Di-Higgs_mass_prediction.ipynb`: Single-target regression example in a high-energy physics context
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Multi_Target_Regression_Di-tau_momenta.ipynb) `examples/Multi_Target_Regression_Di-tau_momenta.ipynb`: Multi-target regression example in a high-energy physics context
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Feature_Selection.ipynb) `examples/Feature_Selection.ipynb`: In-depth walkthrough for automated feature-selection
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Advanced_Model_Building.ipynb) `examples/Advanced_Model_Building.ipynb`: In-depth look at building more complicated models and a few advanced interpretation techniques
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Model_Exporting.ipynb) `examples/Model_Exporting.ipynb`: Walkthough for exporting a trained model to ONNX and TensorFlow
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/RNNs_CNNs_and_GNNs_for_matrix_data.ipynb) `examples/RNNs_CNNs_and_GNNs_for_matrix_data.ipynb`: Various examples of applying RNNs, CNNs, and GNNs to matrix data (top-tagging on jet constituents)
1. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GilesStrong/lumin/blob/v0.9.1/examples/Learning_To_Pivot.ipynb) `examples/Learning_To_Pivot.ipynb`: Example of adversarial training for parameter invariance

## Installation

Expand Down Expand Up @@ -172,6 +172,8 @@ poetry run pre-commit install
### Optional requirements

- sparse: enables loading on COO sparse-format tensors, install via e.g. `pip install sparse`
- pdpbox: enables partial dependency plots, install via e.g. `pip install pdpbox`
- **Note**: `pdpbox` includes docs dependencies in its build environment, which can result in conflicts. A fork of `pdpbox` which removes these dependencies can be installed from [https://github.com/GilesStrong/PDPbox]

## Notes

Expand Down
2 changes: 0 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import os
import sys

import pytorch_sphinx_theme

sys.path.insert(0, os.path.abspath("../.."))


Expand Down
16 changes: 8 additions & 8 deletions lumin/data_processing/hep_proc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from typing import Dict, List, Optional, Set, Tuple, Union

import numpy as np
Expand Down Expand Up @@ -404,15 +403,16 @@ def calc_pair_mass(
df: pd.DataFrame, masses: Union[Tuple[float, float], Tuple[np.ndarray, np.ndarray]], feat_map: Dict[str, str]
) -> np.ndarray:
r"""
Vectorised computation of invarient mass of pair of particles with given masses, using 3-momenta. Only works for vectors defined in Cartesian coordinates.
Vectorised computation of invarient mass o
f pair of particles with given masses, using 3-momenta. Only works for vectors defined in Cartesian coordinates.
Arguments:
df: DataFrame vector components
masses: tuple of masses of particles (either constant or different pair of masses per pair of particles)
feat_map: dictionary mapping of requested momentum components to the features in df
Arguments:
df: DataFrame vector components
masses: tuple of masses of particles (either constant or different pair of masses per pair of particles)
feat_map: dictionary mapping of requested momentum components to the features in df
Returns:
np.ndarray of invarient masses
Returns:
np.ndarray of invarient masses
"""

# TODO: rewrite to not use a DataFrame for holding parent vector
Expand Down
1 change: 0 additions & 1 deletion lumin/nn/data/fold_yielder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from sklearn.model_selection import KFold
from sklearn.pipeline import Pipeline
from torch_geometric.data import Dataset as PyGDataset
from torch_geometric.loader import DataLoader as PyGDataLoader

from .batch_yielder import BatchYielder, TorchGeometricBatchYielder

Expand Down
1 change: 0 additions & 1 deletion lumin/optimisation/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import numpy as np
import pandas as pd
import pkg_resources
import rfpimp
from fastprogress import progress_bar
from prettytable import PrettyTable
from rfpimp import feature_dependence_matrix, importances, plot_dependence_heatmap
Expand Down
1 change: 0 additions & 1 deletion lumin/optimisation/threshold.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from typing import Tuple

import matplotlib.pyplot as plt
Expand Down
3 changes: 1 addition & 2 deletions lumin/plotting/interpretation.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from __future__ import annotations

from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
from typing import Any, Dict, List, Optional, Tuple, Union

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
from pdpbox import pdp
from pdpbox.pdp import PDPInteract, PDPIsolate
from sklearn.pipeline import Pipeline
from torch import Tensor
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[tool.poetry]
name = "lumin"
version = "0.9.0"
version = "0.9.1"
description = "LUMIN Unifies Many Improvements for Networks: A PyTorch wrapper to make deep learning more accessable to scientists."
license = "Apache Software License 2.0"
authors = [
Expand Down Expand Up @@ -41,7 +41,6 @@ pandas = "<2.1.0"
matplotlib = "^3.8.0"
seaborn = "^0.13.0"
poetry-plugin-export = "^1.8.0"
pdpbox = { git = "https://github.com/GilesStrong/PDPbox.git", branch = "refactor_requirements" }
torch-geometric = "^2.6.1"
plotly = ">=5.9.0"

Expand All @@ -58,6 +57,7 @@ black = "^24.2.0"
pandas-stubs = "^2.2.2"
uproot = "^5.4.1"
lxml-html-clean = "^0.3.1"
pdpbox = { git = "https://github.com/GilesStrong/PDPbox.git" }

[tool.poetry.group.docs.dependencies]
sphinx = "<7.0.0"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pandocfilters==1.5.1 ; python_version >= "3.10" and python_version < "4.0"
parso==0.8.4 ; python_version >= "3.10" and python_version < "4.0"
pathspec==0.12.1 ; python_version >= "3.10" and python_version < "4.0"
patsy==0.5.6 ; python_version >= "3.10" and python_version < "4.0"
pdpbox @ git+https://github.com/GilesStrong/PDPbox.git@519849d2613cf0111779b20b65d968fbc4d020c2 ; python_version >= "3.10" and python_version < "4.0"
pdpbox @ git+https://github.com/GilesStrong/PDPbox.git@1ad2c9eb3da880339b831948b80b5378eeb5fc2b ; python_version >= "3.10" and python_version < "4.0"
pexpect==4.9.0 ; python_version >= "3.10" and python_version < "4.0"
pillow==11.0.0 ; python_version >= "3.10" and python_version < "4.0"
pip==24.3.1 ; python_version >= "3.10" and python_version < "4.0"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ no_strict_optional = True
disable_error_code = attr-defined, override, union-attr

[flake8]
ignore = E203, E266, E501, W503, F403, F401, E741, C901, W405, E402, E211
ignore = E203, E266, E501, W503, E741, C901, W405, E402, E211
max-line-length = 120
max-complexity = 18
select = B,C,E,F,W,T4,B9
Expand Down

0 comments on commit ba373f8

Please sign in to comment.