Updates python packages whitelist

Adds arch
This commit is contained in:
AlexCatarino
2017-05-20 00:24:04 +01:00
parent 9de02c9eaa
commit 38b550509c
2 changed files with 29 additions and 4 deletions
+26 -1
View File
@@ -49,6 +49,7 @@ import talib
from copulalib.copulalib import Copula
import theano
import xgboost
from arch import arch_model
class PythonPackageTestAlgorithm(QCAlgorithm):
'''Algorithm to test third party libraries'''
@@ -94,6 +95,9 @@ class PythonPackageTestAlgorithm(QCAlgorithm):
# xgboost test
xgboost_test()
# arch test
arch_test()
def OnData(self, data): pass
def blaze_test():
@@ -161,4 +165,25 @@ def theano_test():
def xgboost_test():
data = numpy.random.rand(5,10) # 5 entities, each contains 10 features
label = numpy.random.randint(2, size=5) # binary target
print "xgboost test >>>", xgboost.DMatrix( data, label=label)
print "xgboost test >>>", xgboost.DMatrix( data, label=label)
def arch_test():
r = numpy.array([0.945532630498276,
0.614772790142383,
0.834417758890680,
0.862344782601800,
0.555858715401929,
0.641058419842652,
0.720118656981704,
0.643948007732270,
0.138790608092353,
0.279264178231250,
0.993836948076485,
0.531967023876420,
0.964455754192395,
0.873171802181126,
0.937828816793698])
garch11 = arch_model(r, p=1, q=1)
res = garch11.fit(update_freq=10)
print "arch test >>>", res.summary()