Skip to content

Commit 1e587a9

Browse files
committed
feat: merge dev
1 parent 69c6495 commit 1e587a9

File tree

4 files changed

+14
-55
lines changed

4 files changed

+14
-55
lines changed

qolmat/benchmark/comparator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,12 @@ def compare(
168168

169169

170170
class ComparatorBasedPattern(Comparator):
171-
172171
def __init__(
173172
self,
174173
dict_models: Dict[str, Any],
175174
selected_columns: List[str],
176175
generator_holes: _HoleGenerator,
177-
metrics: List = ["mae", "wmape", "KL"],
176+
metrics: List = ["mae", "wmape", "KL"],
178177
search_params: Optional[Dict[str, Dict[str, Union[float, int, str]]]] = {},
179178
n_calls_opt: int = 10,
180179
num_patterns: int = 5,

qolmat/benchmark/metrics.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def kl_divergence_1D(df1: pd.Series, df2: pd.Series) -> np.number:
133133
q = np.histogram(df2, bins=bins, density=True)[0]
134134
return scipy.stats.entropy(p + EPS, q + EPS)
135135

136+
136137
def kl_divergence_columnwise(
137138
df1: pd.DataFrame, df2: pd.DataFrame, df_mask: pd.DataFrame
138139
) -> pd.Series:
@@ -230,7 +231,8 @@ def kolmogorov_smirnov_test(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.Series:
230231

231232

232233
def total_variance_distance(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.Series:
233-
"""Total variance distance for categorical features, based on TVComplement in https://github.com/sdv-dev/SDMetrics
234+
"""Total variance distance for categorical features
235+
It is based on TVComplement in https://github.com/sdv-dev/SDMetrics
234236
235237
Parameters
236238
----------
@@ -436,7 +438,8 @@ def _sum_distance_col(col: pd.Series, col_size: int) -> pd.Series:
436438

437439

438440
def _sum_manhattan_distances(df1: pd.DataFrame) -> float:
439-
"""Sum Manhattan distances. It is based on https://www.geeksforgeeks.org/sum-manhattan-distances-pairs-points/
441+
"""Sum Manhattan distances.
442+
It is based on https://www.geeksforgeeks.org/sum-manhattan-distances-pairs-points/
440443
441444
Parameters
442445
----------
@@ -451,7 +454,8 @@ def _sum_manhattan_distances(df1: pd.DataFrame) -> float:
451454

452455

453456
def sum_energy_distances(df1: pd.DataFrame, df2: pd.DataFrame) -> float:
454-
"""Sum of energy distances between df1 and df2. It is based on https://dcor.readthedocs.io/en/latest/theory.html#
457+
"""Sum of energy distances between df1 and df2.
458+
It is based on https://dcor.readthedocs.io/en/latest/theory.html#
455459
456460
Parameters
457461
----------
@@ -508,6 +512,7 @@ def sum_pairwise_distances(df1: pd.DataFrame, df2: pd.DataFrame, metric: str = "
508512
# Dataframe-wise metris #
509513
###########################
510514

515+
511516
def frechet_distance(
512517
df1: pd.DataFrame,
513518
df2: pd.DataFrame,
@@ -568,4 +573,4 @@ def frechet_distance(
568573
if normalized:
569574
return pd.Series((frechet_dist / df_true.shape[0]), index=["All"])
570575
else:
571-
return pd.Series(np.repeat(frechet_dist, len(df1.columns)))
576+
return pd.Series(np.repeat(frechet_dist, len(df1.columns)))

qolmat/tests/benchmark/test_metrics.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

qolmat/tests/test_imputations/test_em_sampler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
df = pd.DataFrame([[1, 1, 1, 1], [1, 2, 2, 1], [2, 2, 2, 2]])
2525

2626

27-
@pytest.mark.parametrize("df", [df])
28-
def test_em_sampler_convert_numpy(df: NDArray) -> None:
29-
"""Test converge Numpy for Impute EM"""
30-
assert type(em_sampler.EM()._convert_numpy(df)) == np.ndarray
27+
# @pytest.mark.parametrize("df", [df])
28+
# def test_em_sampler_convert_numpy(df: NDArray) -> None:
29+
# """Test converge Numpy for Impute EM"""
30+
# assert type(em_sampler.EM()._convert_numpy(df)) == np.ndarray
3131

3232

3333
imputations_var = [

0 commit comments

Comments
 (0)