You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I read your paper on DP_CGAN and installed DP_CGAN on pytorch. But I got an error when I ran the code example you gave me. I would like to know what solutions you have?
My code:
from dp_cgans import DP_CGAN
import pandas as pd
Hello, I read your paper on DP_CGAN and installed DP_CGAN on pytorch. But I got an error when I ran the code example you gave me. I would like to know what solutions you have?
My code:
from dp_cgans import DP_CGAN
import pandas as pd
tabular_data=pd.read_csv("C:/Users/lenovo/Desktop/workbook1.csv")
model = DP_CGAN(epochs=100)
print("Start training model")
model.fit(tabular_data)
#Generate 100 synthetic rows
syn_data = model.sample(100)
syn_data.to_csv("C:/Users/lenovo/Desktop/workbook.csv")
Error content:
TypeError Traceback (most recent call last)
Cell In[4], line 10
7 model = DP_CGAN(epochs=100)
9 print("Start training model")
---> 10 model.fit(tabular_data)
12 # Generate 100 synthetic rows
13 syn_data = model.sample(100)
File E:\anaconda3\envs\pytorch\lib\site-packages\dp_cgans\base.py:143, in BaseTabularModel.fit(self, data)
140 if self.metadata.get_dtypes(ids=False):
141 LOGGER.debug(
142 'Fitting %s model to table %s', self.class.name, self.metadata.name)
--> 143 self._fit(transformed)
File E:\anaconda3\envs\pytorch\lib\site-packages\dp_cgans\dp_cgan_init.py:59, in DPCGANModel._fit(self, table_data)
55 categories.append(field)
57 # print(table_data[categoricals])
---> 59 self._model.fit(
60 table_data,
61 discrete_columns=categoricals
62)
File E:\anaconda3\envs\pytorch\lib\site-packages\dp_cgans\synthesizers\dp_cgan.py:488, in DPCGANSynthesizer.fit(self, train_data, discrete_columns, epochs)
485 # condvec = self._data_sampler.sample_condvec(self._batch_size)
487 condvec_pair = self._data_sampler.sample_condvec_pair(self._batch_size)
--> 488 c_pair_1, m_pair_1, col_pair_1, opt_pair_1 = condvec_pair
490 # if condvec is None:
491 # c1, m1, col, opt = None, None, None, None
492 # real = self._data_sampler.sample_data(self._batch_size, col, opt)
(...)
502 # self._batch_size, col[perm], opt[perm])
503 # c2 = c1[perm]
505 if condvec_pair is None:
TypeError: cannot unpack non-iterable NoneType object
Looking forward to your reply!
The text was updated successfully, but these errors were encountered: