copulas 0.12.4.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- copulas/__init__.py +91 -0
- copulas/bivariate/__init__.py +175 -0
- copulas/bivariate/base.py +448 -0
- copulas/bivariate/clayton.py +163 -0
- copulas/bivariate/frank.py +170 -0
- copulas/bivariate/gumbel.py +144 -0
- copulas/bivariate/independence.py +81 -0
- copulas/bivariate/utils.py +19 -0
- copulas/datasets.py +214 -0
- copulas/errors.py +5 -0
- copulas/multivariate/__init__.py +8 -0
- copulas/multivariate/base.py +200 -0
- copulas/multivariate/gaussian.py +345 -0
- copulas/multivariate/tree.py +691 -0
- copulas/multivariate/vine.py +359 -0
- copulas/optimize/__init__.py +154 -0
- copulas/univariate/__init__.py +25 -0
- copulas/univariate/base.py +661 -0
- copulas/univariate/beta.py +48 -0
- copulas/univariate/gamma.py +38 -0
- copulas/univariate/gaussian.py +27 -0
- copulas/univariate/gaussian_kde.py +192 -0
- copulas/univariate/log_laplace.py +38 -0
- copulas/univariate/selection.py +36 -0
- copulas/univariate/student_t.py +31 -0
- copulas/univariate/truncated_gaussian.py +66 -0
- copulas/univariate/uniform.py +27 -0
- copulas/utils.py +248 -0
- copulas/visualization.py +345 -0
- copulas-0.12.4.dev3.dist-info/METADATA +215 -0
- copulas-0.12.4.dev3.dist-info/RECORD +34 -0
- copulas-0.12.4.dev3.dist-info/WHEEL +5 -0
- copulas-0.12.4.dev3.dist-info/licenses/LICENSE +106 -0
- copulas-0.12.4.dev3.dist-info/top_level.txt +1 -0
copulas/visualization.py
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
"""Visualization utilities for the Copulas library."""
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
import plotly.express as px
|
|
5
|
+
import plotly.figure_factory as ff
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PlotConfig:
|
|
9
|
+
"""Custom plot settings for visualizations."""
|
|
10
|
+
|
|
11
|
+
DATACEBO_DARK = '#000036'
|
|
12
|
+
DATACEBO_GREEN = '#01E0C9'
|
|
13
|
+
BACKGROUND_COLOR = '#F5F5F8'
|
|
14
|
+
FONT_SIZE = 18
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _generate_1d_plot(data, title, labels, colors):
|
|
18
|
+
"""Generate a density plot of an array-like structure.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
data (array-like structure):
|
|
22
|
+
The data to plot.
|
|
23
|
+
title (str):
|
|
24
|
+
The title of the plot.
|
|
25
|
+
labels (list[str]):
|
|
26
|
+
The labels of the data.
|
|
27
|
+
colors (list[str]):
|
|
28
|
+
The colors of the data.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
plotly.graph_objects._figure.Figure
|
|
32
|
+
"""
|
|
33
|
+
fig = ff.create_distplot(
|
|
34
|
+
hist_data=data, group_labels=labels, show_hist=False, show_rug=False, colors=colors
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
for i, name in enumerate(labels):
|
|
38
|
+
fig.update_traces(
|
|
39
|
+
x=fig.data[i].x,
|
|
40
|
+
hovertemplate=f'<b>{name}</b><br>Frequency: %{{y}}<extra></extra>',
|
|
41
|
+
selector={'name': name},
|
|
42
|
+
fill='tozeroy',
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
fig.update_layout(
|
|
46
|
+
title=title,
|
|
47
|
+
plot_bgcolor=PlotConfig.BACKGROUND_COLOR,
|
|
48
|
+
font={'size': PlotConfig.FONT_SIZE},
|
|
49
|
+
showlegend=True if labels[0] else False,
|
|
50
|
+
xaxis_title='value',
|
|
51
|
+
yaxis_title='frequency',
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return fig
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def dist_1d(data, title=None, label=None):
|
|
58
|
+
"""Plot the 1 dimensional data.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
data (array_like structure):
|
|
62
|
+
The table data.
|
|
63
|
+
title (str):
|
|
64
|
+
The title of the plot.
|
|
65
|
+
label (str):
|
|
66
|
+
The label of the plot.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
plotly.graph_objects._figure.Figure
|
|
70
|
+
"""
|
|
71
|
+
if not title:
|
|
72
|
+
title = 'Data'
|
|
73
|
+
if isinstance(data, pd.DataFrame):
|
|
74
|
+
title += f" for column '{data.columns[0]}'"
|
|
75
|
+
elif isinstance(data, pd.Series) and data.name:
|
|
76
|
+
title += f" for column '{data.name}'"
|
|
77
|
+
|
|
78
|
+
return _generate_1d_plot(
|
|
79
|
+
data=[data], title=title, labels=[label], colors=[PlotConfig.DATACEBO_DARK]
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def compare_1d(real, synth, title=None):
|
|
84
|
+
"""Plot the comparison between real and synthetic data.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
real (array_like):
|
|
88
|
+
The real data.
|
|
89
|
+
synth (array_like):
|
|
90
|
+
The synthetic data.
|
|
91
|
+
title (str):
|
|
92
|
+
The title of the plot.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
plotly.graph_objects._figure.Figure
|
|
96
|
+
"""
|
|
97
|
+
if not title:
|
|
98
|
+
title = 'Real vs. Synthetic Data'
|
|
99
|
+
if isinstance(real, pd.DataFrame):
|
|
100
|
+
title += f" for column '{real.columns[0]}'"
|
|
101
|
+
elif isinstance(real, pd.Series) and real.name:
|
|
102
|
+
title += f" for column '{real.name}'"
|
|
103
|
+
|
|
104
|
+
return _generate_1d_plot(
|
|
105
|
+
data=[real, synth],
|
|
106
|
+
title=title,
|
|
107
|
+
labels=['Real', 'Synthetic'],
|
|
108
|
+
colors=[PlotConfig.DATACEBO_DARK, PlotConfig.DATACEBO_GREEN],
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _generate_scatter_2d_plot(data, columns, color_discrete_map, title):
|
|
113
|
+
"""Generate a scatter plot for a pair of columns.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
data (pandas.DataFrame):
|
|
117
|
+
The data for the desired column pair containing a
|
|
118
|
+
``Data`` column indicating whether it is real or synthetic.
|
|
119
|
+
columns (list):
|
|
120
|
+
A list of the columns being plotted.
|
|
121
|
+
color_discrete_map (dict):
|
|
122
|
+
A dictionary mapping the values of the ``Data`` column to the colors
|
|
123
|
+
used to plot them.
|
|
124
|
+
title (str):
|
|
125
|
+
The title of the plot.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
plotly.graph_objects._figure.Figure
|
|
129
|
+
"""
|
|
130
|
+
if columns:
|
|
131
|
+
columns.append('Data')
|
|
132
|
+
else:
|
|
133
|
+
columns = data.columns
|
|
134
|
+
|
|
135
|
+
if len(columns) != 3: # includes the 'Data' column
|
|
136
|
+
raise ValueError('Only 2 columns can be plotted')
|
|
137
|
+
|
|
138
|
+
fig = px.scatter(
|
|
139
|
+
data,
|
|
140
|
+
x=columns[0],
|
|
141
|
+
y=columns[1],
|
|
142
|
+
color='Data',
|
|
143
|
+
color_discrete_map=color_discrete_map,
|
|
144
|
+
symbol='Data',
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
fig.update_layout(
|
|
148
|
+
title=title,
|
|
149
|
+
plot_bgcolor=PlotConfig.BACKGROUND_COLOR,
|
|
150
|
+
font={'size': PlotConfig.FONT_SIZE},
|
|
151
|
+
showlegend=False if len(color_discrete_map) == 1 else True,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
return fig
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def scatter_2d(data, columns=None, title=None):
|
|
158
|
+
"""Plot 2 dimensional data in a scatter plot.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
data (pandas.DataFrame):
|
|
162
|
+
The table data.
|
|
163
|
+
columns (list[string]):
|
|
164
|
+
The names of the two columns to plot.
|
|
165
|
+
title (str):
|
|
166
|
+
The title of the plot.
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
plotly.graph_objects._figure.Figure
|
|
170
|
+
"""
|
|
171
|
+
data = data.copy()
|
|
172
|
+
data['Data'] = 'Real'
|
|
173
|
+
|
|
174
|
+
if not title:
|
|
175
|
+
title = 'Data'
|
|
176
|
+
if columns:
|
|
177
|
+
title += f" for columns '{columns[0]}' and '{columns[1]}'"
|
|
178
|
+
elif isinstance(data, pd.DataFrame):
|
|
179
|
+
title += f" for columns '{data.columns[0]}' and '{data.columns[1]}'"
|
|
180
|
+
|
|
181
|
+
return _generate_scatter_2d_plot(
|
|
182
|
+
data=data,
|
|
183
|
+
columns=columns,
|
|
184
|
+
color_discrete_map={'Real': PlotConfig.DATACEBO_DARK},
|
|
185
|
+
title=title,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def compare_2d(real, synth, columns=None, title=None):
|
|
190
|
+
"""Plot the comparison between real and synthetic data for a given column pair.
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
real (pandas.DataFrame):
|
|
194
|
+
The real table data.
|
|
195
|
+
synth (pandas.Dataframe):
|
|
196
|
+
The synthetic table data.
|
|
197
|
+
columns (list[string]):
|
|
198
|
+
The names of the two columns to plot.
|
|
199
|
+
title (str):
|
|
200
|
+
The title of the plot.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
plotly.graph_objects._figure.Figure
|
|
204
|
+
"""
|
|
205
|
+
real, synth = real.copy(), synth.copy()
|
|
206
|
+
real['Data'] = 'Real'
|
|
207
|
+
synth['Data'] = 'Synthetic'
|
|
208
|
+
data = pd.concat([real, synth], axis=0, ignore_index=True)
|
|
209
|
+
|
|
210
|
+
if not title:
|
|
211
|
+
title = 'Real vs. Synthetic Data'
|
|
212
|
+
if columns:
|
|
213
|
+
title += f" for columns '{columns[0]}' and '{columns[1]}'"
|
|
214
|
+
elif isinstance(data, pd.DataFrame):
|
|
215
|
+
title += f" for columns '{data.columns[0]}' and '{data.columns[1]}'"
|
|
216
|
+
|
|
217
|
+
return _generate_scatter_2d_plot(
|
|
218
|
+
data=data,
|
|
219
|
+
columns=columns,
|
|
220
|
+
color_discrete_map={
|
|
221
|
+
'Real': PlotConfig.DATACEBO_DARK,
|
|
222
|
+
'Synthetic': PlotConfig.DATACEBO_GREEN,
|
|
223
|
+
},
|
|
224
|
+
title=title,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def _generate_scatter_3d_plot(data, columns, color_discrete_map, title):
|
|
229
|
+
"""Generate a scatter plot for column pair plot.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
data (pandas.DataFrame):
|
|
233
|
+
The data for the desired three columns containing a
|
|
234
|
+
``Data`` column that indicates whether it is real or synthetic.
|
|
235
|
+
columns (list):
|
|
236
|
+
A list of the columns being plotted.
|
|
237
|
+
color_discrete_map (dict):
|
|
238
|
+
A dictionary mapping the values of the ``Data`` column to the colors
|
|
239
|
+
used to plot them.
|
|
240
|
+
title (str):
|
|
241
|
+
The title of the plot.
|
|
242
|
+
|
|
243
|
+
Returns:
|
|
244
|
+
plotly.graph_objects._figure.Figure
|
|
245
|
+
"""
|
|
246
|
+
if columns:
|
|
247
|
+
columns.append('Data')
|
|
248
|
+
else:
|
|
249
|
+
columns = data.columns
|
|
250
|
+
|
|
251
|
+
if len(columns) != 4: # includes the 'Data' column
|
|
252
|
+
raise ValueError('Only 3 columns can be plotted')
|
|
253
|
+
|
|
254
|
+
fig = px.scatter_3d(
|
|
255
|
+
data,
|
|
256
|
+
x=columns[0],
|
|
257
|
+
y=columns[1],
|
|
258
|
+
z=columns[2],
|
|
259
|
+
color='Data',
|
|
260
|
+
color_discrete_map=color_discrete_map,
|
|
261
|
+
symbol='Data',
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
fig.update_traces(marker={'size': 5})
|
|
265
|
+
|
|
266
|
+
fig.update_layout(
|
|
267
|
+
title=title,
|
|
268
|
+
plot_bgcolor=PlotConfig.BACKGROUND_COLOR,
|
|
269
|
+
font={'size': PlotConfig.FONT_SIZE},
|
|
270
|
+
showlegend=False if len(color_discrete_map) == 1 else True,
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
return fig
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def scatter_3d(data, columns=None, title=None):
|
|
277
|
+
"""Plot 3 dimensional data in a scatter plot.
|
|
278
|
+
|
|
279
|
+
Args:
|
|
280
|
+
data (pandas.DataFrame):
|
|
281
|
+
The table data. Must have at least 3 columns.
|
|
282
|
+
columns (list[string]):
|
|
283
|
+
The names of the three columns to plot.
|
|
284
|
+
title (str):
|
|
285
|
+
The title of the plot.
|
|
286
|
+
|
|
287
|
+
Returns:
|
|
288
|
+
plotly.graph_objects._figure.Figure
|
|
289
|
+
"""
|
|
290
|
+
data = data.copy()
|
|
291
|
+
data['Data'] = 'Real'
|
|
292
|
+
|
|
293
|
+
if not title:
|
|
294
|
+
title = 'Data'
|
|
295
|
+
if columns:
|
|
296
|
+
title += f" for columns '{columns[0]}', '{columns[1]}' and '{columns[2]}'"
|
|
297
|
+
elif isinstance(data, pd.DataFrame):
|
|
298
|
+
title += (
|
|
299
|
+
f" for columns '{data.columns[0]}', '{data.columns[1]}' and '{data.columns[2]}'"
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
return _generate_scatter_3d_plot(
|
|
303
|
+
data=data,
|
|
304
|
+
columns=columns,
|
|
305
|
+
color_discrete_map={'Real': PlotConfig.DATACEBO_DARK},
|
|
306
|
+
title=title,
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def compare_3d(real, synth, columns=None, title=None):
|
|
311
|
+
"""Plot the comparison between real and synthetic data for a given column triplet.
|
|
312
|
+
|
|
313
|
+
Args:
|
|
314
|
+
real (pd.DataFrame):
|
|
315
|
+
The real data.
|
|
316
|
+
synth (pd.DataFrame):
|
|
317
|
+
The synthetic data.
|
|
318
|
+
columns (list):
|
|
319
|
+
The name of the columns to plot.
|
|
320
|
+
title (str):
|
|
321
|
+
The title of the plot.
|
|
322
|
+
"""
|
|
323
|
+
real, synth = real.copy(), synth.copy()
|
|
324
|
+
real['Data'] = 'Real'
|
|
325
|
+
synth['Data'] = 'Synthetic'
|
|
326
|
+
data = pd.concat([real, synth], axis=0, ignore_index=True)
|
|
327
|
+
|
|
328
|
+
if not title:
|
|
329
|
+
title = 'Real vs. Synthetic Data'
|
|
330
|
+
if columns:
|
|
331
|
+
title += f" for columns '{columns[0]}', '{columns[1]}' and '{columns[2]}'"
|
|
332
|
+
elif isinstance(data, pd.DataFrame):
|
|
333
|
+
title += (
|
|
334
|
+
f" for columns '{data.columns[0]}', '{data.columns[1]}' and '{data.columns[2]}'"
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
return _generate_scatter_3d_plot(
|
|
338
|
+
data=data,
|
|
339
|
+
columns=columns,
|
|
340
|
+
color_discrete_map={
|
|
341
|
+
'Real': PlotConfig.DATACEBO_DARK,
|
|
342
|
+
'Synthetic': PlotConfig.DATACEBO_GREEN,
|
|
343
|
+
},
|
|
344
|
+
title=title,
|
|
345
|
+
)
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: copulas
|
|
3
|
+
Version: 0.12.4.dev3
|
|
4
|
+
Summary: Create tabular synthetic data using copulas-based modeling.
|
|
5
|
+
Author-email: "DataCebo, Inc." <info@sdv.dev>
|
|
6
|
+
License: BSL-1.1
|
|
7
|
+
Project-URL: Source Code, https://github.com/sdv-dev/Copulas/
|
|
8
|
+
Project-URL: Issue Tracker, https://github.com/sdv-dev/Copulas/issues
|
|
9
|
+
Project-URL: Changes, https://github.com/sdv-dev/Copulas/blob/main/HISTORY.md
|
|
10
|
+
Project-URL: Twitter, https://twitter.com/sdv_dev
|
|
11
|
+
Project-URL: Chat, https://bit.ly/sdv-slack-invite
|
|
12
|
+
Keywords: copulas
|
|
13
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: Free for non-commercial use
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Requires-Python: <3.14,>=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: numpy>=1.21.0; python_version < "3.10"
|
|
28
|
+
Requires-Dist: numpy>=1.23.3; python_version >= "3.10" and python_version < "3.12"
|
|
29
|
+
Requires-Dist: numpy>=1.26.0; python_version >= "3.12" and python_version < "3.13"
|
|
30
|
+
Requires-Dist: numpy>=2.1.0; python_version >= "3.13"
|
|
31
|
+
Requires-Dist: pandas>=1.4.0; python_version < "3.11"
|
|
32
|
+
Requires-Dist: pandas>=1.5.0; python_version >= "3.11" and python_version < "3.12"
|
|
33
|
+
Requires-Dist: pandas>=2.1.1; python_version >= "3.12" and python_version < "3.13"
|
|
34
|
+
Requires-Dist: pandas>=2.2.3; python_version >= "3.13"
|
|
35
|
+
Requires-Dist: plotly>=5.10.0; python_version < "3.13"
|
|
36
|
+
Requires-Dist: plotly>=5.12.0; python_version >= "3.13"
|
|
37
|
+
Requires-Dist: scipy>=1.7.3; python_version < "3.10"
|
|
38
|
+
Requires-Dist: scipy>=1.9.2; python_version >= "3.10" and python_version < "3.12"
|
|
39
|
+
Requires-Dist: scipy>=1.12.0; python_version >= "3.12" and python_version < "3.13"
|
|
40
|
+
Requires-Dist: scipy>=1.14.1; python_version >= "3.13"
|
|
41
|
+
Provides-Extra: tutorials
|
|
42
|
+
Requires-Dist: markupsafe>=2.0.1; extra == "tutorials"
|
|
43
|
+
Requires-Dist: scikit-learn>=0.24; python_version < "3.12" and extra == "tutorials"
|
|
44
|
+
Requires-Dist: scikit-learn>=1.3.1; python_version >= "3.12" and extra == "tutorials"
|
|
45
|
+
Requires-Dist: jupyter>=1.0.0; extra == "tutorials"
|
|
46
|
+
Provides-Extra: test
|
|
47
|
+
Requires-Dist: copulas[tutorials]; extra == "test"
|
|
48
|
+
Requires-Dist: pytest>=6.2.5; extra == "test"
|
|
49
|
+
Requires-Dist: pytest-cov>=2.6.0; extra == "test"
|
|
50
|
+
Requires-Dist: pytest-rerunfailures>=10.3; extra == "test"
|
|
51
|
+
Requires-Dist: tomli>=2.0.0; extra == "test"
|
|
52
|
+
Provides-Extra: dev
|
|
53
|
+
Requires-Dist: copulas[test,tutorials]; extra == "dev"
|
|
54
|
+
Requires-Dist: pip>=9.0.1; extra == "dev"
|
|
55
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
56
|
+
Requires-Dist: bump-my-version>=0.18.3; extra == "dev"
|
|
57
|
+
Requires-Dist: watchdog>=1.0.1; extra == "dev"
|
|
58
|
+
Requires-Dist: nbsphinx<0.10,>=0.9.7; extra == "dev"
|
|
59
|
+
Requires-Dist: Sphinx<7.5,>=7.4.7; extra == "dev"
|
|
60
|
+
Requires-Dist: sphinx_rtd_theme<3.1,>=3.0.2; extra == "dev"
|
|
61
|
+
Requires-Dist: sphinxcontrib_applehelp<2.1,>=2.0.0; extra == "dev"
|
|
62
|
+
Requires-Dist: sphinxcontrib-devhelp<2.1,>=2.0.0; extra == "dev"
|
|
63
|
+
Requires-Dist: sphinxcontrib-htmlhelp<2.2,>=2.1.0; extra == "dev"
|
|
64
|
+
Requires-Dist: sphinxcontrib_serializinghtml<2.1,>=2.0.0; extra == "dev"
|
|
65
|
+
Requires-Dist: sphinxcontrib_qthelp<2.1,>=2.0.0; extra == "dev"
|
|
66
|
+
Requires-Dist: alabaster<0.8,>=0.7.16; extra == "dev"
|
|
67
|
+
Requires-Dist: lxml-html-clean<0.5,>=0.4.1; extra == "dev"
|
|
68
|
+
Requires-Dist: Jinja2<3.2,>=3.1.6; extra == "dev"
|
|
69
|
+
Requires-Dist: myst_parser<4.1,>=3.0.1; extra == "dev"
|
|
70
|
+
Requires-Dist: ruff<1,>=0.3.2; extra == "dev"
|
|
71
|
+
Requires-Dist: twine>=1.10.0; extra == "dev"
|
|
72
|
+
Requires-Dist: wheel>=0.30.0; extra == "dev"
|
|
73
|
+
Requires-Dist: coverage<7.8,>=7.7.1; extra == "dev"
|
|
74
|
+
Requires-Dist: invoke; extra == "dev"
|
|
75
|
+
Requires-Dist: urllib3<2.4,>=1.26.20; extra == "dev"
|
|
76
|
+
Requires-Dist: tabulate<0.10,>=0.9.0; extra == "dev"
|
|
77
|
+
Requires-Dist: boto3<1.38,>=1.37.18; extra == "dev"
|
|
78
|
+
Requires-Dist: docutils<0.22,>=0.21.2; extra == "dev"
|
|
79
|
+
Provides-Extra: readme
|
|
80
|
+
Requires-Dist: rundoc<0.5,>=0.4.3; extra == "readme"
|
|
81
|
+
Dynamic: license-file
|
|
82
|
+
|
|
83
|
+
<p style="text-align:center">
|
|
84
|
+
<i>This repository is part of <a href="https://sdv.dev">The Synthetic Data Vault Project</a>, a project from <a href="https://datacebo.com">DataCebo</a>.</i>
|
|
85
|
+
</p>
|
|
86
|
+
|
|
87
|
+
[](https://pypi.org/search/?c=Development+Status+%3A%3A+2+-+Pre-Alpha)
|
|
88
|
+
[](https://pypi.python.org/pypi/copulas)
|
|
89
|
+
[](https://pepy.tech/project/copulas)
|
|
90
|
+
[](https://github.com/sdv-dev/Copulas/actions/workflows/unit.yml)
|
|
91
|
+
[](https://codecov.io/gh/sdv-dev/Copulas)
|
|
92
|
+
[](https://bit.ly/sdv-slack-invite)
|
|
93
|
+
|
|
94
|
+
<br/>
|
|
95
|
+
<p align="center" style="text-align:center">
|
|
96
|
+
<a href="https://github.com/sdv-dev/Copulas">
|
|
97
|
+
<img width=40% src="https://github.com/sdv-dev/SDV/blob/stable/docs/images/Copulas-DataCebo.png?raw=true"></img>
|
|
98
|
+
</a>
|
|
99
|
+
</p>
|
|
100
|
+
|
|
101
|
+
# Overview
|
|
102
|
+
|
|
103
|
+
**Copulas** is a Python library for modeling multivariate distributions and sampling from them
|
|
104
|
+
using copula functions.
|
|
105
|
+
Given a table of numerical data, use Copulas to learn the distribution and
|
|
106
|
+
generate new synthetic data following the same statistical properties.
|
|
107
|
+
|
|
108
|
+
**Key Features:**
|
|
109
|
+
|
|
110
|
+
* **Model multivariate data.** Choose from a variety of univariate
|
|
111
|
+
distributions and copulas – including Archimedian Copulas, Gaussian Copulas and Vine Copulas.
|
|
112
|
+
|
|
113
|
+
* **Compare real and synthetic data visually** after building your model. Visualizations
|
|
114
|
+
are available as 1D histograms, 2D scatterplots and 3D scatterplots.
|
|
115
|
+
|
|
116
|
+
* **Access & manipulate learned parameters.** With complete access to the internals
|
|
117
|
+
of the model, set or tune parameters to your choosing.
|
|
118
|
+
|
|
119
|
+
# Install
|
|
120
|
+
|
|
121
|
+
Install the Copulas library using pip or conda.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pip install copulas
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
conda install -c conda-forge copulas
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
# Usage
|
|
132
|
+
|
|
133
|
+
Get started using a demo dataset. This dataset contains 3 numerical columns.
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from copulas.datasets import sample_trivariate_xyz
|
|
137
|
+
|
|
138
|
+
real_data = sample_trivariate_xyz()
|
|
139
|
+
real_data.head()
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
<img src="docs/images/copulas_sample_dataset.png" width="300">
|
|
143
|
+
|
|
144
|
+
Model the data using a copula and use it to create synthetic data.
|
|
145
|
+
The Copulas library offers many options including Gaussian Copula,
|
|
146
|
+
Vine Copulas and Archimedian Copulas.
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from copulas.multivariate import GaussianMultivariate
|
|
150
|
+
|
|
151
|
+
copula = GaussianMultivariate()
|
|
152
|
+
copula.fit(real_data)
|
|
153
|
+
|
|
154
|
+
synthetic_data = copula.sample(len(real_data))
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Visualize the real and synthetic data side-by-side. Let's do this in 3D so see our full dataset.
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
from copulas.visualization import compare_3d
|
|
161
|
+
|
|
162
|
+
compare_3d(real_data, synthetic_data)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+

|
|
166
|
+
|
|
167
|
+
# Tutorials
|
|
168
|
+
Click below to run the code yourself on a Colab Notebook and discover new features.
|
|
169
|
+
|
|
170
|
+
[](https://bit.ly/copulas-demo)
|
|
171
|
+
|
|
172
|
+
# Community & Support
|
|
173
|
+
|
|
174
|
+
Learn more about Copulas library from our [documentation](https://sdv.dev/Copulas/) site.
|
|
175
|
+
|
|
176
|
+
**Questions or issues?** Join our [Slack channel](https://bit.ly/sdv-slack-invite)
|
|
177
|
+
to discuss more about Copulas and synthetic data.
|
|
178
|
+
If you find a bug or have a feature request, you can also
|
|
179
|
+
[open an issue](https://github.com/sdv-dev/Copulas/issues/new/choose) on our GitHub.
|
|
180
|
+
|
|
181
|
+
**Interested in contributing to Copulas?** Read our
|
|
182
|
+
[Contribution Guide](https://sdv.dev/Copulas/contributing.html) to get started.
|
|
183
|
+
|
|
184
|
+
# Credits
|
|
185
|
+
|
|
186
|
+
The Copulas open source project first started at the Data to AI Lab at MIT in 2018.
|
|
187
|
+
Thank you to our team of contributors who have built and maintained the library over the years!
|
|
188
|
+
|
|
189
|
+
[View Contributors](https://github.com/sdv-dev/Copulas/graphs/contributors)
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<div align="center">
|
|
195
|
+
<a href="https://datacebo.com"><img align="center" width=40% src="https://github.com/sdv-dev/SDV/blob/stable/docs/images/DataCebo.png"></img></a>
|
|
196
|
+
</div>
|
|
197
|
+
<br/>
|
|
198
|
+
<br/>
|
|
199
|
+
|
|
200
|
+
[The Synthetic Data Vault Project](https://sdv.dev) was first created at MIT's [Data to AI Lab](
|
|
201
|
+
https://dai.lids.mit.edu/) in 2016. After 4 years of research and traction with enterprise, we
|
|
202
|
+
created [DataCebo](https://datacebo.com) in 2020 with the goal of growing the project.
|
|
203
|
+
Today, DataCebo is the proud developer of SDV, the largest ecosystem for
|
|
204
|
+
synthetic data generation & evaluation. It is home to multiple libraries that support synthetic
|
|
205
|
+
data, including:
|
|
206
|
+
|
|
207
|
+
* 🔄 Data discovery & transformation. Reverse the transforms to reproduce realistic data.
|
|
208
|
+
* 🧠Multiple machine learning models -- ranging from Copulas to Deep Learning -- to create tabular,
|
|
209
|
+
multi table and time series data.
|
|
210
|
+
* 📊 Measuring quality and privacy of synthetic data, and comparing different synthetic data
|
|
211
|
+
generation models.
|
|
212
|
+
|
|
213
|
+
[Get started using the SDV package](https://sdv.dev/SDV/getting_started/install.html) -- a fully
|
|
214
|
+
integrated solution and your one-stop shop for synthetic data. Or, use the standalone libraries
|
|
215
|
+
for specific needs.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
copulas/__init__.py,sha256=MWuwQ95v2FTG9csYVJU5c98tLxatU0Scxd5JD0_In3A,2929
|
|
2
|
+
copulas/datasets.py,sha256=uyiiEV2E_vztiIEIFR71yzMYXu_ZAlnP04Mhcv-me_0,6769
|
|
3
|
+
copulas/errors.py,sha256=YDb1uhFOsht_9ynu4MYyZJgdUQWoI_WoWzG1JfGdvzU,93
|
|
4
|
+
copulas/utils.py,sha256=2wWVVx-FMOhjPDt58ZgfFHQzVdLsMo44IPh7ccaIALE,6789
|
|
5
|
+
copulas/visualization.py,sha256=PJIa9ZiT8Px8owsZKVxy0LiTszDY3ymMDkvcgYTBzBk,9688
|
|
6
|
+
copulas/bivariate/__init__.py,sha256=CPt6D4Tae_hlqQ_cbhzMKf6m_xEQJms5ctfqt4ouZkQ,5097
|
|
7
|
+
copulas/bivariate/base.py,sha256=3TLrWLWTqpauClCXUVJb_2Wxfw-gTTAhALMH5Ztj9cE,13944
|
|
8
|
+
copulas/bivariate/clayton.py,sha256=5Hr90vrEMl2FdCcvxqeiWAt23ZQT41GKVQ0iHpmCmvA,4553
|
|
9
|
+
copulas/bivariate/frank.py,sha256=DI1kZLVYL2tVDTyZVIBfmqW7ZqCpuhwh5DwFQC5f-YQ,4655
|
|
10
|
+
copulas/bivariate/gumbel.py,sha256=OFKf0FM3w9EQuu2gCIBGZ_DYZIIc2pQl7XoCpgq5ToA,4216
|
|
11
|
+
copulas/bivariate/independence.py,sha256=S0mERdcveH9Hw_N8Dpn4_xR_pGT9B2FEn_Yvi6CLfIE,2069
|
|
12
|
+
copulas/bivariate/utils.py,sha256=iNTwVL-vlE6gWGDQUIdGO4bmhP3Bws9CyBCi8Y3ZezE,347
|
|
13
|
+
copulas/multivariate/__init__.py,sha256=KZT1L1PfdZnqR6942jDOyibg7tjmF_HDNaHRGOg0AGg,340
|
|
14
|
+
copulas/multivariate/base.py,sha256=GavPayD6gghpTzwV1NR8Fu97zY2fhtQaJyLMZHlfkcQ,5632
|
|
15
|
+
copulas/multivariate/gaussian.py,sha256=b__9UkgmzduGMJye0qmncGMx1jonNfsbn6wSgP2xh2c,12176
|
|
16
|
+
copulas/multivariate/tree.py,sha256=kxJ75LDUsqYoCKAo5wL2K8LJlxH5whz4w2shcs7tFWM,22019
|
|
17
|
+
copulas/multivariate/vine.py,sha256=Uc_XhrWlfjKNgpyJ3oB4_bsK6ek3BZQkJhwM_ecBIyw,12865
|
|
18
|
+
copulas/optimize/__init__.py,sha256=x3KLFTF3CoO3-7vCxAK8PRAkVKpVHhcoJW0oDwGkPvg,4941
|
|
19
|
+
copulas/univariate/__init__.py,sha256=5j1pTKG1hVEn9wmAumLnVghR7eKI_Wv5sceXTr-aOUY,826
|
|
20
|
+
copulas/univariate/base.py,sha256=Gz4dry15fI8yxB6tGLFkP8KSILizQCVeWDz2lS5_TYQ,20060
|
|
21
|
+
copulas/univariate/beta.py,sha256=8i1L7gmAdovEtd7X64SO2ujTTvEaZJIOVwzj6ylrqgE,1342
|
|
22
|
+
copulas/univariate/gamma.py,sha256=az8-3sMbp1-K16SxtW6qJ4fRKxoXg0XSyKNxH_x86tM,906
|
|
23
|
+
copulas/univariate/gaussian.py,sha256=ZRxwg-YNr8QHDGA0locVBYLKEi0dyOzoMZthRh3P0SA,660
|
|
24
|
+
copulas/univariate/gaussian_kde.py,sha256=vF7RY9KmOrnGlBUWBu34iubsJ9iLNAnJRgZTcbo7aIs,6077
|
|
25
|
+
copulas/univariate/log_laplace.py,sha256=1njkNjVc3-p3ZP6lkOA3fhc6wmr_70BQtm7pQuCAzTk,921
|
|
26
|
+
copulas/univariate/selection.py,sha256=nETHnLB89lTf5CPSEX28Xu2cNySQU7yhW2gZRu4Otic,950
|
|
27
|
+
copulas/univariate/student_t.py,sha256=r4_sHdEX4C74byC5_i60e8f2DT-J8RqGyjzeCtZkwbM,777
|
|
28
|
+
copulas/univariate/truncated_gaussian.py,sha256=ugr3Lm-rzadRIwsi1FTYpziNoNiP7t2iBQNGbfrFrKs,1999
|
|
29
|
+
copulas/univariate/uniform.py,sha256=BkGaEZkitKpDAEkMscvLVLJ4U-j6gZuZqnZiBtCVr8Y,686
|
|
30
|
+
copulas-0.12.4.dev3.dist-info/licenses/LICENSE,sha256=cORU2kpIo9Qyy7Kv2ZpYDIIcksrjqlNEL9c9Ic1ayo0,4822
|
|
31
|
+
copulas-0.12.4.dev3.dist-info/METADATA,sha256=Lqq5_KyIX7W4Y3juPOL5WKEhYd7P5UncyZXlWSrbfeY,9383
|
|
32
|
+
copulas-0.12.4.dev3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
33
|
+
copulas-0.12.4.dev3.dist-info/top_level.txt,sha256=xNXWuWoZ-U3Gb734WqQxkF5RIeGDVU3IstjD-RnWsk8,8
|
|
34
|
+
copulas-0.12.4.dev3.dist-info/RECORD,,
|