SDV icon indicating copy to clipboard operation
SDV copied to clipboard

Evaluate function not working

Open JeroenVerboom opened this issue 4 years ago • 2 comments

Environment Details

Please indicate the following details about the environment in which you found the bug:

  • SDV version: 0.13.0
  • Python version: 3.6.9
  • Operating System: Google Collab

Error Description

Trying to run the evaluation framework, but the function doesn't return any values for the statistcal tests. Synthetic data is generated though.

Warnings when fitting the GausianCopula:

/usr/local/lib/python3.7/dist-packages/scipy/stats/_continuous_distns.py:5320: RuntimeWarning: divide by zero encountered in true_divide
  return c**2 / (c**2 - n**2)
/usr/local/lib/python3.7/dist-packages/scipy/stats/_distn_infrastructure.py:2606: RuntimeWarning: invalid value encountered in double_scalars
  Lhat = muhat - Shat*mu
/usr/local/lib/python3.7/dist-packages/scipy/stats/_continuous_distns.py:639: RuntimeWarning: invalid value encountered in sqrt
  sk = 2*(b-a)*np.sqrt(a + b + 1) / (a + b + 2) / np.sqrt(a*b)
/usr/local/lib/python3.7/dist-packages/scipy/optimize/minpack.py:175: RuntimeWarning: The iteration is not making good progress, as measured by the 
  improvement from the last ten iterations.
  warnings.warn(msg, RuntimeWarning)

Steps to reproduce

Follow the steps in the user guide.

from sdv.demo import load_tabular_demo
from sdv.tabular import GaussianCopula
from sdv.evaluation import evaluate

real_data = load_tabular_demo('student_placements')

model = GaussianCopula()
model.fit(real_data)
synthetic_data = model.sample()

real_data.head()

synthetic_data.head()


evaluate(synthetic_data, real_data, aggregate=False)

/usr/local/lib/python3.7/dist-packages/sklearn/mixture/_base.py:282: ConvergenceWarning: Initialization 1 did not converge. Try different init parameters, or increase max_iter, tol or check for degenerate data.
  ConvergenceWarning,
/usr/local/lib/python3.7/dist-packages/sklearn/mixture/_base.py:282: ConvergenceWarning: Initialization 1 did not converge. Try different init parameters, or increase max_iter, tol or check for degenerate data.
  ConvergenceWarning,
/usr/local/lib/python3.7/dist-packages/sdmetrics/column_pairs/statistical/kl_divergence.py:51: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  real_data[pd.isna(real_data)] = 0.0
/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py:3093: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self._where(-key, value, inplace=True)
/usr/local/lib/python3.7/dist-packages/sdmetrics/column_pairs/statistical/kl_divergence.py:52: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  synthetic_data[pd.isna(synthetic_data)] = 0.0
/usr/local/lib/python3.7/dist-packages/sdmetrics/utils.py:62: UserWarning: Unexpected value Pandas(high_spec='Arts', degree_type='Sci&Tech') in synthetic data.
  warnings.warn(f'Unexpected value {value} in synthetic data.')
nan

JeroenVerboom avatar Dec 21 '21 20:12 JeroenVerboom

Hi @JeroenVerboom, please try re-running the Evaluation Framework with SDV v0.13.1, which was released earlier today. I believe there was an incompatibility with SDV v0.13.0 and the newest version of the SDMetrics library.

The warnings you see are issued by third party libraries, and are expected. If you want to silence them, you can to add these two lines in your code (or notebook) before running the model:

import warnings

warnings.filterwarnings('ignore')

katxiao avatar Dec 22 '21 21:12 katxiao

Hi @katxiao, thanks for the prompt response.

I've tried it with v0.13.1 and it works!

Keep up the good work! :)

JeroenVerboom avatar Dec 23 '21 17:12 JeroenVerboom