blent-ai / pycopula Goto Github PK
View Code? Open in Web Editor NEWPython copulas library for dependency modeling
License: Apache License 2.0
Python copulas library for dependency modeling
License: Apache License 2.0
The pdf (method pdf_param) of Archimedian copulas seems to be incorrect if the dimension is 3 or higher, since I am getting negative and complex results.
I see that for n>2 a numeric differentiation with scipy is used.
I am a researcher on hydrology. In the field of hydrology, the marginal distribution is known as Pearson-III. So my question is how can I got the joint distributions by pycopulas with the known marginal distribution.
Is the data the value of Probability density function ,or the value of random variable?
Need to improve nearest Positive Definite Matrix function with BLAS subroutines.
UnboundLocalError Traceback (most recent call last)
in ()
7 cop = StudentCopula(dim=2)
8 print(X.shape)
----> 9 cop.fit(X, method='clme')
10
11 # Visualization of CDF and PDF
/usr/local/lib/python3.6/dist-packages/pycopula/copula.py in fit(self, X, method, df_fixed, verbose, **kwargs)
809 rho = fitted_params
810 else:
--> 811 nu = fitted_params[0]
812 rho = fitted_params[1:]
813
UnboundLocalError: local variable 'fitted_params' referenced before assignment
Hi, I'm curious that why GaussianCopula can't do with IFM estimation and StudentCopula can't do with MLE and IFM estimation.
I am very appreciate that you build up this package but just can't understand how it works?
Is there any detailed document?
Thanks
Hello!
I think there is some problems with freshness of documentation, because code from examples did not work. So, for example, I am trying to run this code: https://blent-ai.github.io/pycopula/build/html/examples.html#sampling
And I get the following errors:
---------------------------------------------------------------------------
TypeError
Traceback (most recent call last)
<ipython-input-40-bb6934b931b1> in <module>()
----> 1 gaussian = GaussianCopula(dim=2, sigma=[[1, 0.8], [0.8, 1]])
TypeError: __init__() got an unexpected keyword argument 'sigma'
And after removing 'sigma' from arguments I've got a different error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-38-a14416189e8d> in <module>()
----> 1 sim = simulate(archimedean, 100)
/usr/local/lib/python3.5/dist-packages/pycopula/simulation.py in simulate(copula, n)
19 The size of the sample.
20 """
---> 21 d = copula.getDimension()
22
23 X = []
AttributeError: 'GaussianCopula' object has no attribute 'getDimension'
I'm using Python 3.5.2 and downloaded PyCopula using pip.
If you need any help, please, let me know.
Hi there, your package works well in Python 3.7.1 on Windows.
For plotting, instead of giving examples in the documentation page, perhaps put plotting tools inside the visualization module / library.
For instance,
def plot_copula_3d(copula,plot_type='pdf',subplot=None):
"""Plots a pycopula copula object's pdf or cdf.
Usage:
plt.figure()
plot_copula_3d(copula,'pdf')
plt.figure()
plt.subplot(2,1,1)
plot_copula_3d(copula, 'pdf', (2,1,1))
plt.subplot(2,1,2)
plot_copula_3d(copula, 'cdf', (2,1,2))
plt.show()
"""
if subplot is None: ax = plt.gca(projection='3d')
else: # Overwrites the entire figure with single plot
fig = plt.gcf()
ax = fig.add_subplot(*subplot,projection='3d')
if plot_type=='pdf':
u,v,C = pycopula.visualization.pdf_2d(copula)
elif plot_type=='cdf':
u,v,C = pycopula.visualization.cdf_2d(copula)
X, Y = np.meshgrid(u,v)
ax.plot_surface(X,Y,C)
ax.plot_wireframe(X,Y,C,color='black',alpha=0.3)
pycopula/pycopula/estimation.py
Line 76 in 697e2fb
This gives an error if the number of hyperparameters that require estimation exceeds the number of dimensions (d). I think this might be an easy fix:
h=0
for dic in hyper_param:
h+=len(dic)
start_vector = np.repeat(1, h + thetaOffset)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.