mirror of
https://github.com/ejeanboris/MDAF.git
synced 2025-04-29 20:12:37 +00:00
plotfuncsv1
This commit is contained in:
42
MDAF/MDAF.py
42
MDAF/MDAF.py
@ -11,7 +11,8 @@ import statistics
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
# Surrogate modelling
|
# Surrogate modelling and plotting
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
# Test function representation
|
# Test function representation
|
||||||
from rpy2 import robjects as robjs
|
from rpy2 import robjects as robjs
|
||||||
@ -269,8 +270,8 @@ def doe(heuristicpath, testfunctionpaths, args):
|
|||||||
#return the performance values
|
#return the performance values
|
||||||
return responses
|
return responses
|
||||||
|
|
||||||
def plotfuncs(funcpaths, features):
|
def plotfuncs(funcpaths, feature):
|
||||||
print ('help')
|
pi = 3.141592653589793
|
||||||
for i,funpath in enumerate(funcpaths):
|
for i,funpath in enumerate(funcpaths):
|
||||||
if funpath.find('@') == 0:
|
if funpath.find('@') == 0:
|
||||||
funcpaths[i] = path.dirname(__file__) + '/TestFunctions/' + funpath[1:]
|
funcpaths[i] = path.dirname(__file__) + '/TestFunctions/' + funpath[1:]
|
||||||
@ -279,9 +280,42 @@ def plotfuncs(funcpaths, features):
|
|||||||
representations = {}
|
representations = {}
|
||||||
|
|
||||||
for idx,funpath in enumerate(funcpaths):
|
for idx,funpath in enumerate(funcpaths):
|
||||||
representations[funcnames[idx]] = representfunc(funpath)
|
representations[funcnames[idx]] = representfunc(funpath)[feature]
|
||||||
|
|
||||||
|
# generate a list of the categories of the plot
|
||||||
|
elements = list(representations.values())
|
||||||
|
categories = [str(i) for i in list(range(len(elements[0])))]
|
||||||
|
|
||||||
|
# creating the plot figure
|
||||||
|
fig = plt.figure(figsize = (12,8))
|
||||||
|
ax = plt.subplot(polar = "True")
|
||||||
|
|
||||||
|
for idx, func in enumerate(representations):
|
||||||
|
vals = representations[func]
|
||||||
|
vals = [float(v) for v in vals]
|
||||||
|
|
||||||
|
# get the number of dims of the plot
|
||||||
|
N = len(vals)
|
||||||
|
# repeat the first value to close the circle
|
||||||
|
vals += vals[:1]
|
||||||
|
#calculate the angles for each category
|
||||||
|
angles = [n/float(N)*2*pi for n in range(N)]
|
||||||
|
angles += angles[:1]
|
||||||
|
#creating the polar plot
|
||||||
|
ax.plot(angles,vals)
|
||||||
|
|
||||||
|
# X ticks
|
||||||
|
plt.xticks(angles[:-1], categories)
|
||||||
|
|
||||||
|
#ax.set_rlabel_position(0)
|
||||||
|
|
||||||
|
# y ticks
|
||||||
|
# set dynamic scaling for each dimension
|
||||||
|
plt.ylim(0,200)
|
||||||
|
|
||||||
|
plt.title("Radar Plot of the "+feature+ " feature for the following Functions")
|
||||||
|
plt.legend()
|
||||||
|
plt.show(block=True)
|
||||||
|
return representations
|
||||||
|
|
||||||
# %%
|
# %%
|
||||||
|
@ -8,5 +8,24 @@ def main(args):
|
|||||||
#_# lower: [-15, -3]
|
#_# lower: [-15, -3]
|
||||||
#_# minimum: [-10,1]
|
#_# minimum: [-10,1]
|
||||||
|
|
||||||
|
|
||||||
|
#_# cm_angle: array([[6.66400060e-01], [1.57197492e-01], [6.33211887e-01], [1.78907191e-01], [1.44244246e+02], [3.10372115e+01], [2.04871341e-01], [7.98873206e-02], [0.00000000e+00], [4.70000000e-02]])
|
||||||
|
#_# cm_conv: array([[0.17307692], [0.09615385], [0.53846154], [0.46153846], [0. ], [0.015 ]])
|
||||||
|
#_# cm_grad: array([[0.748637 ], [0.18732133], [0. ], [0.033 ]])
|
||||||
|
#_# ela_conv: array([[ 5.59000000e-01], [ 0.00000000e+00], [-9.93512960e+00], [ 1.40517786e+01], [ 1.00000000e+03], [ 1.19000000e-01]])
|
||||||
|
#_# ela_curv: array([[2.35290361e+01], [3.25866731e+01], [5.34145553e+01], [4.24019080e+01], [6.03282394e+01], [2.44344134e+02], [3.49426877e+01], [0.00000000e+00], [3.32978294e+00], [3.94526823e+00], [5.47746980e+00], [4.97327244e+00], [6.76368399e+00], [9.90620749e+00], [1.81308137e+00], [0.00000000e+00], [5.82313234e+00], [1.08167038e+01], [4.23447456e+01], [1.87734274e+01], [3.81238982e+01], [6.49883654e+02], [7.88648872e+01], [0.00000000e+00], [8.40000000e+03], [1.01800000e+00]])
|
||||||
|
#_# ela_distr: array([[-0.1580354 ], [-0.75125793], [ 1. ], [ 0. ], [ 0.031 ]])
|
||||||
|
#_# ela_local: array([[1.00000000e+00], [1.00000000e-02], [1.00000000e+00], [ nan], [1.00000000e+00], [0.00000000e+00], [1.00000000e+00], [1.00000000e+01], [1.00000000e+01], [1.30500000e+01], [1.50000000e+01], [1.50000000e+01], [1.50000000e+01], [2.45103565e+00], [1.30600000e+03], [1.20000000e-01]])
|
||||||
|
#_# ela_meta: array([[4.43726129e-01], [1.03457432e+02], [2.03061212e+00], [1.84369067e+01], [9.07948224e+00], [5.57966283e-01], [6.75912004e-01], [1.97815159e+01], [9.09087990e-01], [0.00000000e+00], [9.00000000e-03]])
|
||||||
|
#_# basic: array([[ 2.00000000e+00], [ 5.00000000e+02], [-1.50000000e+01], [-3.00000000e+00], [-5.00000000e+00], [ 3.00000000e+00], [ 2.77942324e+00], [ 2.26293823e+02], [ 6.00000000e+00], [ 6.00000000e+00], [ 3.60000000e+01], [ 3.60000000e+01], [ 1.00000000e+00], [ 0.00000000e+00], [ 1.00000000e-03]])
|
||||||
|
#_# disp: array([[ 0.9437388 ], [ 0.84900264], [ 0.81147919], [ 0.82037666], [ 0.99730628], [ 0.79772263], [ 0.74883067], [ 0.74919161], [-0.23897957], [-0.64138846], [-0.80077605], [-0.76298243], [-0.01088726], [-0.81754857], [-1.01515617], [-1.01369734], [ 0. ], [ 0.01 ]])
|
||||||
|
#_# limo: array([[1.19640615e+01], [3.77717321e-01], [4.31621681e+01], [1.76236793e+01], [9.32994956e-01], [7.34512758e-01], [1.06087444e+01], [3.22623285e+01], [4.46141915e+00], [4.07690838e+00], [2.72360722e+01], [5.67862195e-01], [0.00000000e+00], [3.50000000e-02]])
|
||||||
|
#_# nbc: array([[ 0.19289655], [ 0.84266125], [ 0.20129043], [ 0.16243626], [-0.30378927], [ 0. ], [ 0.043 ]])
|
||||||
|
#_# pca: array([[1. ], [1. ], [0.33333333], [1. ], [0.73572473], [0.51519025], [0.99587696], [0.55976219], [0. ], [0.003 ]])
|
||||||
|
#_# gcm: array([[2. ], [0.05555556], [0.94444444], [0.72222222], [0.23300034], [0.5 ], [0.5 ], [0.76699966], [0.37759454], [0.02777778], [0.13888889], [0.13888889], [0.25 ], [0.15713484], [0.27777778], [0.22222222], [0.5 ], [0.5 ], [0.77777778], [0.3928371 ], [1. ], [0.76699966], [0.02777778], [0. ], [0.024 ], [2. ], [0.05555556], [0.94444444], [0.77777778], [0.46754278], [0.5 ], [0.5 ], [0.53245722], [0.04590144], [0.08333333], [0.11111111], [0.11111111], [0.13888889], [0.03928371], [0.22222222], [0.44444444], [0.5 ], [0.5 ], [0.55555556], [0.07856742], [1. ], [0.53245722], [0.02777778], [0. ], [0.029 ], [2. ], [0.05555556], [0.94444444], [0.69444444], [0.40534181], [0.5 ], [0.5 ], [0.59465819], [0.13386689], [0.08333333], [0.15277778], [0.15277778], [0.22222222], [0.09820928], [0.30555556], [0.38888889], [0.5 ], [0.5 ], [0.61111111], [0.15713484], [1. ], [0.40534181], [0.02777778], [0. ], [0.031 ]])
|
||||||
|
#_# ic: array([[ 0.66268098], [ 2.08708709], [20.2444651 ], [ 1.46646647], [ 0.29718876], [ 0. ], [ 0.243 ]])
|
||||||
|
|
||||||
|
#_# Represented: 1
|
||||||
|
|
||||||
'''
|
'''
|
||||||
return 100*sqrt(fabs(args[1]-0.01*args[0]**2))+0.01*fabs(args[0]+10)
|
return 100*sqrt(fabs(args[1]-0.01*args[0]**2))+0.01*fabs(args[0]+10)
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user