Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
[Research Environment] Security Violations(s): Accessing sm.distributions

I seem to be running into an error in the research environment when trying to access the function for sm.distributions.empirical_distribution.ECDF.

I am able to run locally outside of your system (using python 2.7.10), so it is only an issue with the Research environment.

Is this an intended security measure or is there another way to call this function that does not run into this issue?

Thanks!

import statsmodels.api as sm  
import numpy as np  
import matplotlib.pyplot as plt  
#Emperical Distribution Function  
sample = np.random.uniform(0, 1, 50)  
ecdf = sm.distributions.empirical_distribution.ECDF(sample)

x = np.linspace(min(sample), max(sample))  
y = ecdf(x)  
plt.step(x, y)  
plt.show()  

SecurityViolation Traceback (most recent call
last) in ()
1 #Emperical Distribution Function
2 sample = np.random.uniform(0, 1, 50)
----> 3 ecdf = sm.distributions.empirical_distribution.ECDF(sample)
4
5 x = np.linspace(min(sample), max(sample))

/home/qexec/src/qexec_repo/qexec/algo/safety.py in
getattribute(self, attr)
137 mute_greylist=mute_greylist,
138 module=module,
--> 139 module_wrapper=self,
140 )
141 finally:

/home/qexec/src/qexec_repo/qexec/algo/safety.py in
check_attribute_access(full_path, whitelist, name_blacklist,
caller_fr, module, module_wrapper, msg, mute_greylist)
87 violations=[{'message': strip_qexec_module_path(error_message),
88 'lineno': caller_fr.f_lineno,
---> 89 'extra': extra}])
90
91

SecurityViolation: 0002 Security Violations(s): Accessing
sm.distributions raised an AttributeError. No attributes with a
similar name were found.

1 response

It looks like that submodule isn't available in research. Thanks for the request and we'll take a look at adding it.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.