diff --git a/README.md b/README.md index c59088f..5ca44d8 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/docs/source/conf.py b/docs/source/conf.py index 83b0047..e9e1d12 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,8 +15,6 @@ import os import sys -import pytorch_sphinx_theme - sys.path.insert(0, os.path.abspath("../..")) diff --git a/lumin/data_processing/hep_proc.py b/lumin/data_processing/hep_proc.py index 39e64b7..9a27339 100644 --- a/lumin/data_processing/hep_proc.py +++ b/lumin/data_processing/hep_proc.py @@ -1,4 +1,3 @@ -import warnings from typing import Dict, List, Optional, Set, Tuple, Union import numpy as np @@ -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 diff --git a/lumin/nn/data/fold_yielder.py b/lumin/nn/data/fold_yielder.py index 8f93374..74a6823 100644 --- a/lumin/nn/data/fold_yielder.py +++ b/lumin/nn/data/fold_yielder.py @@ -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 diff --git a/lumin/optimisation/features.py b/lumin/optimisation/features.py index 91fc0ef..fbaada1 100644 --- a/lumin/optimisation/features.py +++ b/lumin/optimisation/features.py @@ -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 diff --git a/lumin/optimisation/threshold.py b/lumin/optimisation/threshold.py index 5a2c5a6..d52ca87 100644 --- a/lumin/optimisation/threshold.py +++ b/lumin/optimisation/threshold.py @@ -1,4 +1,3 @@ -import warnings from typing import Tuple import matplotlib.pyplot as plt diff --git a/lumin/plotting/interpretation.py b/lumin/plotting/interpretation.py index e8c8359..377b00f 100644 --- a/lumin/plotting/interpretation.py +++ b/lumin/plotting/interpretation.py @@ -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 diff --git a/poetry.lock b/poetry.lock index 0b4c549..7ef4d2a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3313,8 +3313,8 @@ xgboost = ">=1.7.1" [package.source] type = "git" url = "https://github.com/GilesStrong/PDPbox.git" -reference = "refactor_requirements" -resolved_reference = "519849d2613cf0111779b20b65d968fbc4d020c2" +reference = "HEAD" +resolved_reference = "1ad2c9eb3da880339b831948b80b5378eeb5fc2b" [[package]] name = "pexpect" @@ -5698,4 +5698,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "8d6fb70e577970b32fe4692adac72101b9d8ec19ea6d8be8dfef230cbd268da8" +content-hash = "35d78ac690118ae204849273b36a7bfbff4cc27e917acd813c012e3c065dfee3" diff --git a/pyproject.toml b/pyproject.toml index 3701810..f01d32b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ @@ -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" @@ -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" diff --git a/requirements.txt b/requirements.txt index 5738afa..97cb8de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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" diff --git a/setup.cfg b/setup.cfg index 3e13a6d..cc93a07 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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