Skip to content

Commit

Permalink
Merge pull request #20 from SCAI-BIO/tiadams-patch-1
Browse files Browse the repository at this point in the history
feat: add method as optional param
  • Loading branch information
tiadams authored Jan 25, 2025
2 parents 3b7c2da + b5c006f commit fa35b70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions syndat/scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def distribution(real: pd.DataFrame, synthetic: pd.DataFrame, aggregate_results:
return int((1 - jsd_aggregated) * 100)


def correlation(real: pd.DataFrame, synthetic: pd.DataFrame, score=True) -> float:
def correlation(real: pd.DataFrame, synthetic: pd.DataFrame, score=True, method='spearman' ) -> float:
"""
Computes the correlation similarity of real and synthetic data.
Expand Down Expand Up @@ -210,8 +210,8 @@ def correlation(real: pd.DataFrame, synthetic: pd.DataFrame, score=True) -> floa
real_numerical = real_numerical.drop(columns=constant_columns, errors="ignore")
synthetic_numerical = synthetic_numerical.drop(columns=constant_columns, errors="ignore")
# Compute correlation matrices
corr_real = real_numerical.corr(method='spearman')
corr_synthetic = synthetic_numerical.corr(method='spearman')
corr_real = real_numerical.corr(method=method)
corr_synthetic = synthetic_numerical.corr(method=method)
# Remove one-hot-encoded categories from one dimension - otherwise we compute correlations within the same column
# which would distort results
one_hot_encoded_columns = list(set(real_encoded.columns) - set(real.columns))
Expand Down

0 comments on commit fa35b70

Please sign in to comment.