Skip to content

Commit 1c7d762

Browse files
committed
use uv instead of poetry as dependency manager
1 parent 7209b77 commit 1c7d762

File tree

7 files changed

+55
-44
lines changed

7 files changed

+55
-44
lines changed

notebooks/autofeat_benchmark_classification.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
"import os\n",
1010
"import sys\n",
1111
"import warnings\n",
12+
"\n",
1213
"import numpy as np\n",
1314
"import pandas as pd\n",
14-
"from sklearn.datasets import load_iris, load_wine, load_breast_cancer\n",
15-
"from sklearn.model_selection import train_test_split, GridSearchCV\n",
15+
"from sklearn.datasets import load_breast_cancer, load_iris, load_wine\n",
16+
"from sklearn.ensemble import RandomForestClassifier\n",
17+
"from sklearn.linear_model import LogisticRegression\n",
1618
"from sklearn.metrics import accuracy_score\n",
19+
"from sklearn.model_selection import GridSearchCV, train_test_split\n",
1720
"from sklearn.preprocessing import StandardScaler\n",
18-
"from sklearn.linear_model import LogisticRegression\n",
1921
"from sklearn.svm import SVC\n",
20-
"from sklearn.ensemble import RandomForestClassifier\n",
2122
"\n",
2223
"from autofeat import AutoFeatClassifier\n",
2324
"\n",

notebooks/autofeat_benchmark_regression.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
"import os\n",
1010
"import sys\n",
1111
"import warnings\n",
12+
"\n",
1213
"import numpy as np\n",
1314
"import pandas as pd\n",
1415
"from sklearn.datasets import fetch_california_housing, load_diabetes\n",
15-
"from sklearn.model_selection import train_test_split, GridSearchCV\n",
16+
"from sklearn.ensemble import RandomForestRegressor\n",
17+
"from sklearn.linear_model import Ridge\n",
1618
"from sklearn.metrics import mean_squared_error, r2_score\n",
19+
"from sklearn.model_selection import GridSearchCV, train_test_split\n",
1720
"from sklearn.preprocessing import StandardScaler\n",
18-
"from sklearn.linear_model import Ridge\n",
1921
"from sklearn.svm import SVR\n",
20-
"from sklearn.ensemble import RandomForestRegressor\n",
2122
"\n",
2223
"from autofeat import AutoFeatRegressor\n",
2324
"\n",

notebooks/autofeat_examples.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9+
"import matplotlib.pyplot as plt\n",
910
"import numpy as np\n",
1011
"import pandas as pd\n",
11-
"import matplotlib.pyplot as plt\n",
1212
"\n",
13-
"from autofeat import FeatureSelector, AutoFeatRegressor\n",
13+
"from autofeat import AutoFeatRegressor, FeatureSelector\n",
1414
"\n",
1515
"%load_ext autoreload\n",
1616
"%autoreload 2"

notebooks/featsel_benchmark_linearmodels.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
2323
"source": [
2424
"import colorsys\n",
2525
"import warnings\n",
26+
"from time import time\n",
27+
"\n",
2628
"import matplotlib.pyplot as plt\n",
2729
"import numpy as np\n",
2830
"import pandas as pd\n",
2931
"import sklearn.linear_model as lm\n",
30-
"from time import time\n",
3132
"from sklearn import svm\n",
32-
"from sklearn.preprocessing import StandardScaler\n",
3333
"from sklearn.datasets import make_classification\n",
3434
"from sklearn.model_selection import GridSearchCV\n",
35+
"from sklearn.preprocessing import StandardScaler\n",
3536
"\n",
3637
"from autofeat import AutoFeatModel\n",
3738
"\n",

pyproject.toml

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
[build-system]
2-
requires = ["poetry-core"]
3-
build-backend = "poetry.core.masonry.api"
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"
44

5-
[tool.poetry]
5+
[project]
66
name = "autofeat"
77
version = "2.1.3"
88
description = "Automatic Feature Engineering and Selection Linear Prediction Model"
9-
authors = ["Franziska Horn <[email protected]>"]
9+
authors = [{ name = "Franziska Horn", email = "[email protected]" }]
1010
readme = "README.md"
11-
packages = [{include = "autofeat", from = "src"}]
1211
license = "MIT"
1312
keywords = ["automl", "feature engineering", "feature selection", "linear model"]
14-
repository = "https://github.com/cod3licious/autofeat"
15-
homepage = "https://franziskahorn.de/autofeat"
16-
17-
[tool.poetry.dependencies]
18-
python = "^3.8.1,<3.13"
19-
numpy = "^1.20.3"
20-
numba = ">=0.53.1"
21-
joblib = "^1.2.0"
22-
pandas = ">=1.3.5,<3.0.0"
23-
pint = ">=0.17,<1.0"
24-
scipy = "^1.7.3"
25-
scikit-learn = "^1.2.0"
26-
sympy = "^1.7.1"
27-
28-
[tool.poetry.group.dev.dependencies]
29-
bandit = "^1.7.7"
30-
ipython = ">=8.0.0"
31-
notebook = "^6.5.0"
32-
matplotlib = "^3.7.2"
33-
mkdocs-material = "^9.5.28"
34-
mypy = "^1.7.1"
35-
poethepoet = ">=0.24.4"
36-
pytest = "^7.4.0"
37-
pyupgrade = "^3.9.0"
38-
ruff = ">=0.2.1"
13+
requires-python = ">=3.8.1,<3.13"
14+
dependencies = [
15+
"joblib>=1.2.0",
16+
"numba>=0.53.1",
17+
"numpy>=1.21.0,<2.0",
18+
"pandas>=1.3.5,<3.0",
19+
"pint>=0.17,<1.0",
20+
"scikit-learn>=1.2.0,<1.6",
21+
"scipy>=1.7.3",
22+
"sympy>=1.7.1",
23+
]
24+
25+
[dependency-groups]
26+
dev = [
27+
"bandit>=1.7.7",
28+
"ipython>=8.0.0",
29+
"matplotlib>=3.7.2",
30+
"mkdocs-material>=9.5.28",
31+
"mypy>=1.7.1",
32+
"notebook>=6.5.0,<7.0",
33+
"poethepoet>=0.24.4",
34+
"pytest>=7.4.0",
35+
"pyupgrade>=3.9.0",
36+
"ruff>=0.2.1",
37+
]
38+
39+
[project.urls]
40+
Repository = "https://github.com/cod3licious/autofeat"
41+
Documentation = "https://franziskahorn.de/autofeat"
42+
43+
[tool.uv]
44+
required-version = ">=0.5.31"
3945

4046

4147
[tool.poe.tasks]
@@ -63,6 +69,7 @@ exclude = [
6369
"__pycache__",
6470
"build",
6571
"dist",
72+
"*.ipynb",
6673
]
6774

6875
[tool.ruff.lint]
@@ -86,6 +93,7 @@ ignore = ["E501", # Line too long
8693
"D203", "D204", "D205", # required blank lines
8794
"G004", # Logging statement uses f-string
8895
"PIE790", # Unnecessary `pass` statement
96+
"PLC0206", # Extracting value from dictionary without calling `.items()`
8997
"PLR2004", # Magic value used in comparison, consider replacing 0.999 with a constant variable
9098
"PLR09", # Too many arguments to function call
9199
"COM812", # trailing comma - don't use together with formatter

src/autofeat/autofeat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ def _apply_pi_theorem(self, df: pd.DataFrame) -> pd.DataFrame:
162162
for i, r in enumerate(pi_theorem_results, 1):
163163
if self.verbose:
164164
logging.info(f"[AutoFeat] Pi Theorem {i}: ")
165-
logging.info(pint.formatter(r.items()))
165+
logging.info(pint.formatter(r.items(), denominator=[]))
166166
# compute the final result by multiplying and taking the power of
167167
cols = sorted(r)
168168
# only use data points where non of the affected columns are NaNs
169169
not_na_idx = df[cols].notna().all(axis=1)
170170
ptr = df[cols[0]].to_numpy()[not_na_idx] ** r[cols[0]]
171171
for c in cols[1:]:
172172
ptr *= df[c].to_numpy()[not_na_idx] ** r[c]
173-
df.loc[not_na_idx, f"PT{i}_{pint.formatter(r.items()).replace(' ', '')}"] = ptr
173+
df.loc[not_na_idx, f"PT{i}_{pint.formatter(r.items(), denominator=[]).replace(' ', '')}"] = ptr
174174
return df
175175

176176
def _generate_features(self, df: pd.DataFrame, new_feat_cols: list) -> pd.DataFrame:

src/autofeat/feateng.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def ncr(n: int, r: int) -> int:
4545

4646
def n_cols_generated(n_features: int, max_steps: int, n_transformations: int = 7, n_combinations: int = 4) -> int:
4747
"""
48-
computes the upper bound of how many features will be generated based on n_features to start with
48+
Computes the upper bound of how many features will be generated based on n_features to start with
4949
and max_steps feateng steps.
5050
"""
5151
# n_transformations is 1-len(func_transform) because either abs() or sqrt and log will be applied

0 commit comments

Comments
 (0)