test func represent flow basic function

This commit is contained in:
Remi Ehounou
2021-05-21 23:12:10 -04:00
parent bcf73992f0
commit 89bf06da6c
4 changed files with 29 additions and 25 deletions

View File

@ -111,7 +111,7 @@ def writerepresentation(funcpath, charas):
# create a string format of the representation variables
representation = ''
for line in list(charas):
representation += '\n\t#_# ' + line + ': ' + str(charas[line])
representation += '\n\t#_# ' + line + ': ' + str(charas[line]).replace('\n', ',')
representation+='\n'
# Creating the new docstring to be inserted into the file
@ -159,18 +159,23 @@ def representfunc(funcpath):
###
lower =-10
upper = 10
X = flacco.createInitialSample(n_obs = 500, dim = 2, control = rlist(init_sample_type = 'lhs', init_sample_lower = lower, init_sample_upper = upper))
X = flacco.createInitialSample(n_obs = 500, dim = n, control = rlist(init_sample_type = 'lhs', init_sample_lower = lower, init_sample_upper = upper))
y = rapply(X, 1, rtestfunc)
testfuncobj = flacco.createFeatureObject(X = X, y = y, fun = rtestfunc, lower = lower, upper = upper, blocks = 10)
rawfeats = flacco.calculateFeatureSet(testfuncobj, set='ela_meta')
pyfeat = asarray(rawfeats)
# these are the retained features. Note that some features are being excluded for being problematic and to avoid overcomplicating the neural network
# the excluded feature sets are: 'bt', 'ela_level'
# feature sets that require special attention: 'cm_angle', 'cm_grad', 'limo', 'gcm' (soo big with some nans),
featureset = ['cm_angle','cm_conv','cm_grad','ela_conv','ela_curv','ela_distr','ela_local','ela_meta','basic','disp','limo','nbc','pca','gcm','ic']
pyfeats = dict()
for feature in featureset:
rawfeats = flacco.calculateFeatureSet(testfuncobj, set=feature)
pyfeats[feature] = asarray(rawfeats)
writerepresentation(funcpath, results)
writerepresentation(funcpath, pyfeats)
return results

View File

@ -7,25 +7,21 @@ def main(args):
#_# dimmensions: 2
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# dimmensions: 2.0
#_# cm_angle: [[1.33897501e+01], [ nan], [1.40464922e+01], [ nan], [3.10339907e+00], [ nan], [1.00000000e+00], [ nan], [0.00000000e+00], [1.40000000e-02]]
#_# cm_conv: [[0.0297619 ], [0.00595238], [0.22619048], [0.33333333], [0. ], [0.062 ]]
#_# cm_grad: [[0.64254617], [ nan], [0. ], [0.01 ]]
#_# ela_conv: [[0.00000000e+00], [0.00000000e+00], [2.77028225e-02], [2.77028225e-02], [1.00000000e+03], [1.31000000e-01]]
#_# ela_curv: [[1.00000000e+02], [1.00000355e+02], [1.00005040e+02], [1.00002931e+02], [1.00009346e+02], [1.00015828e+02], [5.10494927e-03], [0.00000000e+00], [5.62028278e+01], [7.31406032e+01], [5.13544460e+02], [1.30604608e+02], [3.75618981e+02], [1.05254867e+04], [1.23941806e+03], [0.00000000e+00], [3.02592268e+00], [9.02638335e+02], [1.56148314e+29], [3.81682127e+03], [3.25219248e+04], [2.89737144e+31], [2.05852895e+30], [5.00000000e-03], [8.40000000e+03], [1.13300000e+00]]
#_# ela_distr: [[-0.03671804], [-1.24272349], [ 5. ], [ 0. ], [ 0.023 ]]
#_# ela_local: [[3.00000000e+00], [3.00000000e-02], [1.00267380e+00], [6.66666667e-01], [1.10000000e-01], [4.45000000e-01], [4.45000000e-01], [2.00000000e+01], [2.00000000e+01], [2.26000000e+01], [2.00000000e+01], [2.50000000e+01], [3.00000000e+01], [3.51619629e+00], [2.26300000e+03], [2.35000000e-01]]
#_# ela_meta: [[9.99993630e-01], [1.01176187e+02], [8.08905581e-01], [9.99825941e+01], [1.23602305e+02], [9.99993660e-01], [1.00000000e+00], [3.95467951e+13], [1.00000000e+00], [0.00000000e+00], [1.00000000e-02]]
#_# basic: [[ 2. ], [500. ], [-10. ], [-10. ], [ 10. ], [ 10. ], [100.74931228], [199.87416126], [ 10. ], [ 10. ], [100. ], [ 1. ], [ 1. ], [ 0. ], [ 0. ]]
#_# disp: [[ 0.75879825], [ 0.61920947], [ 0.61336996], [ 0.68491606], [ 0.76149282], [ 0.5882951 ], [ 0.56069976], [ 0.60774698], [-0.12954581], [-0.20451683], [-0.20765314], [-0.16922681], [-0.12717398], [-0.21952442], [-0.23423848], [-0.20915252], [ 0. ], [ 0.011 ]]
#_# limo: [[9.99858662e+01], [1.00000000e+00], [9.99858662e+01], [ nan], [ nan], [ nan], [1.23602305e+02], [ nan], [ nan], [ nan], [ nan], [ nan], [0.00000000e+00], [3.00000000e-03]]
#_# nbc: [[ 0.30653068], [ 0.64759411], [ 0.26842005], [ 0.37025091], [-0.10065679], [ 0. ], [ 0.031 ]]
#_# pca: [[1. ], [1. ], [0.33333333], [0.66666667], [0.51467093], [0.50754981], [0.9998948 ], [0.66673408], [0. ], [0.002 ]]
#_# gcm: [[1.00000000e+00], [1.00000000e-02], [0.00000000e+00], [0.00000000e+00], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [ nan], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [ nan], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [ nan], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [0.00000000e+00], [6.00000000e-03], [1.00000000e+00], [1.00000000e-02], [0.00000000e+00], [0.00000000e+00], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [ nan], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [ nan], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [ nan], [1.00000000e-02], [1.00000000e-02], [1.00000000e-02], [0.00000000e+00], [5.00000000e-03], [5.00000000e+00], [5.00000000e-02], [9.50000000e-01], [1.00000000e+00], [1.53846154e-01], [2.00000000e-01], [2.30769231e-01], [2.30769231e-01], [4.21325044e-02], [0.00000000e+00], [0.00000000e+00], [0.00000000e+00], [0.00000000e+00], [0.00000000e+00], [0.00000000e+00], [0.00000000e+00], [2.00000000e-01], [1.00000000e-02], [6.40000000e-01], [2.88183969e-01], [1.00000000e+00], [1.00000000e+00], [5.00000000e-02], [0.00000000e+00], [1.02000000e-01]]
#_# ic: [[ 0.71881882], [ 2.00700701], [64.09244019], [ 1.82682683], [ 0.29116466], [ 0. ], [ 0.203 ]]
'''
return 100*(args[1]-0.01*args[0]**2+1)+0.01*(args[0]+10)**2