Skip to content

Commit 5683e66

Browse files
Merge pull request #136 from scikit-learn-contrib/dev
Dev
2 parents c4b7773 + e59e1e0 commit 5683e66

File tree

18 files changed

+366
-1408
lines changed

18 files changed

+366
-1408
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.1.4
2+
current_version = 0.1.5
33
commit = True
44
tag = True
55

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
omit = qolmat/_version.py

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- name: Set up Python
16-
uses: actions/setup-python@v3
16+
uses: actions/setup-python@v3.12.0
1717
with:
1818
python-version: '3.10'
1919
- name: Install dependencies

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ examples/*.ipynb
5959
examples/figures/*
6060
examples/data/*
6161
examples/local
62-
62+
data/data_local/*
6363

6464
# VSCode
6565
.vscode

AUTHORS.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Credits
55
Development Team
66
----------------
77

8-
* Julien Roussel <jroussel@quantmetry.com>
9-
* Anh Khoa Ngo Ho <angoho@quantmetry.com>
10-
* Charles-Henri Prat <chprat@quantmetry.com>
11-
* Guillaume Saës <gsaes@quantmetry.com>
8+
* Julien Roussel <julien.a.roussel@capgemini.com>
9+
* Anh Khoa Ngo Ho <anh-khoa.ngo-ho@capgemini.com>
10+
* Guillaume Saës <guillaume.saes@capgemini.com>
11+
* Yasser Zidani <yasser.zidani@capgemini.com>
1212

1313
Past Contributors
1414
-----------------
@@ -19,3 +19,4 @@ Past Contributors
1919
* Mikaïl Duran
2020
* Rima Hajou
2121
* Thomas Morzadec
22+
* Charles-Henri Prat

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
author = "Quantmetry"
2828

2929
# The full version, including alpha/beta/rc tags
30-
version = "0.1.4"
30+
version = "0.1.5"
3131
release = version
3232

3333
# -- General configuration ---------------------------------------------------

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = --cov=qolmat

qolmat/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.4"
1+
__version__ = "0.1.5"

qolmat/benchmark/comparator.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_errors(
5252
df_origin: pd.DataFrame,
5353
df_imputed: pd.DataFrame,
5454
df_mask: pd.DataFrame,
55-
) -> pd.Series:
55+
) -> pd.DataFrame:
5656
"""Functions evaluating the reconstruction's quality
5757
5858
Parameters
@@ -64,15 +64,15 @@ def get_errors(
6464
6565
Returns
6666
-------
67-
dictionary
68-
dictionay of results obtained via different metrics
67+
pd.DataFrame
68+
DataFrame of results obtained via different metrics
6969
"""
7070
dict_errors = {}
7171
for name_metric in self.metrics:
7272
fun_metric = metrics.get_metric(name_metric)
7373
dict_errors[name_metric] = fun_metric(df_origin, df_imputed, df_mask)
74-
errors = pd.concat(dict_errors.values(), keys=dict_errors.keys())
75-
return errors
74+
df_errors = pd.concat(dict_errors.values(), keys=dict_errors.keys())
75+
return df_errors
7676

7777
def evaluate_errors_sample(
7878
self,
@@ -96,8 +96,8 @@ def evaluate_errors_sample(
9696
9797
Returns
9898
-------
99-
pd.DataFrame
100-
DataFrame with the errors for each metric (in column) and at each fold (in index)
99+
pd.Series
100+
Series with the errors for each metric and each variable
101101
"""
102102
list_errors = []
103103
df_origin = df[self.selected_columns].copy()
@@ -115,8 +115,12 @@ def evaluate_errors_sample(
115115
)
116116
df_imputed = imputer_opti.fit_transform(df_corrupted)
117117
subset = self.generator_holes.subset
118-
errors = self.get_errors(df_origin[subset], df_imputed[subset], df_mask[subset])
119-
list_errors.append(errors)
118+
if subset is None:
119+
raise ValueError(
120+
"HoleGenerator `subset` should be overwritten in split but it is none!"
121+
)
122+
df_errors = self.get_errors(df_origin[subset], df_imputed[subset], df_mask[subset])
123+
list_errors.append(df_errors)
120124
df_errors = pd.DataFrame(list_errors)
121125
errors_mean = df_errors.mean(axis=0)
122126

@@ -136,7 +140,8 @@ def compare(
136140
Returns
137141
-------
138142
pd.DataFrame
139-
dataframe with imputation
143+
Dataframe with the metrics results, imputers are in columns and indices represent
144+
metrics and variables.
140145
"""
141146

142147
dict_errors = {}

qolmat/benchmark/metrics.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from functools import partial
2-
from typing import Callable, Dict, List, Optional
2+
from typing import Callable, Dict, List
33

44
import numpy as np
55
import pandas as pd
@@ -1030,7 +1030,9 @@ def pattern_based_weighted_mean_metric(
10301030
return pd.Series(sum([s * w for s, w in zip(scores, weights)]), index=["All"])
10311031

10321032

1033-
def get_metric(name: str) -> Callable:
1033+
def get_metric(
1034+
name: str,
1035+
) -> Callable[[pd.DataFrame, pd.DataFrame, pd.DataFrame], pd.Series]:
10341036
dict_metrics: Dict[str, Callable] = {
10351037
"mse": mean_squared_error,
10361038
"rmse": root_mean_squared_error,

0 commit comments

Comments
 (0)