mirror of
https://github.com/ejeanboris/MDAF.git
synced 2025-06-17 18:48:29 +00:00
flacco has been integrated w rpy2 - basic function
This commit is contained in:
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
8
.idea/MDAF-GitLAB.iml
generated
Normal file
8
.idea/MDAF-GitLAB.iml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
11
.idea/aws.xml
generated
Normal file
11
.idea/aws.xml
generated
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="accountSettings">
|
||||||
|
<option name="activeRegion" value="us-east-1" />
|
||||||
|
<option name="recentlyUsedRegions">
|
||||||
|
<list>
|
||||||
|
<option value="us-east-1" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||||
|
<component name="PyCharmProfessionalAdvertiser">
|
||||||
|
<option name="shown" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/MDAF-GitLAB.iml" filepath="$PROJECT_DIR$/.idea/MDAF-GitLAB.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.spyproject/config/backups/codestyle.ini.bak
Normal file
8
.spyproject/config/backups/codestyle.ini.bak
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[codestyle]
|
||||||
|
indentation = True
|
||||||
|
edge_line = True
|
||||||
|
edge_line_columns = 79
|
||||||
|
|
||||||
|
[main]
|
||||||
|
version = 0.2.0
|
||||||
|
|
6
.spyproject/config/backups/encoding.ini.bak
Normal file
6
.spyproject/config/backups/encoding.ini.bak
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[encoding]
|
||||||
|
text_encoding = utf-8
|
||||||
|
|
||||||
|
[main]
|
||||||
|
version = 0.2.0
|
||||||
|
|
7
.spyproject/config/backups/vcs.ini.bak
Normal file
7
.spyproject/config/backups/vcs.ini.bak
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[vcs]
|
||||||
|
use_version_control = False
|
||||||
|
version_control_system =
|
||||||
|
|
||||||
|
[main]
|
||||||
|
version = 0.2.0
|
||||||
|
|
12
.spyproject/config/backups/workspace.ini.bak
Normal file
12
.spyproject/config/backups/workspace.ini.bak
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[workspace]
|
||||||
|
restore_data_on_startup = True
|
||||||
|
save_data_on_exit = True
|
||||||
|
save_history = True
|
||||||
|
save_non_project_files = False
|
||||||
|
project_type = empty-project-type
|
||||||
|
recent_files = ['SourceCode/AlgorithmAnalyser.py']
|
||||||
|
|
||||||
|
[main]
|
||||||
|
version = 0.2.0
|
||||||
|
recent_files = []
|
||||||
|
|
8
.spyproject/config/codestyle.ini
Normal file
8
.spyproject/config/codestyle.ini
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[codestyle]
|
||||||
|
indentation = True
|
||||||
|
edge_line = True
|
||||||
|
edge_line_columns = 79
|
||||||
|
|
||||||
|
[main]
|
||||||
|
version = 0.2.0
|
||||||
|
|
5
.spyproject/config/defaults/defaults-codestyle-0.2.0.ini
Normal file
5
.spyproject/config/defaults/defaults-codestyle-0.2.0.ini
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[codestyle]
|
||||||
|
indentation = True
|
||||||
|
edge_line = True
|
||||||
|
edge_line_columns = 79
|
||||||
|
|
3
.spyproject/config/defaults/defaults-encoding-0.2.0.ini
Normal file
3
.spyproject/config/defaults/defaults-encoding-0.2.0.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[encoding]
|
||||||
|
text_encoding = utf-8
|
||||||
|
|
4
.spyproject/config/defaults/defaults-vcs-0.2.0.ini
Normal file
4
.spyproject/config/defaults/defaults-vcs-0.2.0.ini
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[vcs]
|
||||||
|
use_version_control = False
|
||||||
|
version_control_system =
|
||||||
|
|
6
.spyproject/config/defaults/defaults-workspace-0.2.0.ini
Normal file
6
.spyproject/config/defaults/defaults-workspace-0.2.0.ini
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[workspace]
|
||||||
|
restore_data_on_startup = True
|
||||||
|
save_data_on_exit = True
|
||||||
|
save_history = True
|
||||||
|
save_non_project_files = False
|
||||||
|
|
6
.spyproject/config/encoding.ini
Normal file
6
.spyproject/config/encoding.ini
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[encoding]
|
||||||
|
text_encoding = utf-8
|
||||||
|
|
||||||
|
[main]
|
||||||
|
version = 0.2.0
|
||||||
|
|
7
.spyproject/config/vcs.ini
Normal file
7
.spyproject/config/vcs.ini
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[vcs]
|
||||||
|
use_version_control = False
|
||||||
|
version_control_system =
|
||||||
|
|
||||||
|
[main]
|
||||||
|
version = 0.2.0
|
||||||
|
|
12
.spyproject/config/workspace.ini
Normal file
12
.spyproject/config/workspace.ini
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[workspace]
|
||||||
|
restore_data_on_startup = True
|
||||||
|
save_data_on_exit = True
|
||||||
|
save_history = True
|
||||||
|
save_non_project_files = False
|
||||||
|
project_type = empty-project-type
|
||||||
|
recent_files = ['SourceCode/AlgorithmAnalyser.py']
|
||||||
|
|
||||||
|
[main]
|
||||||
|
version = 0.2.0
|
||||||
|
recent_files = []
|
||||||
|
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"python.pythonPath": "/usr/bin/python3.8",
|
"python.pythonPath": "/usr/sbin/python",
|
||||||
"python.testing.pytestArgs": [
|
"python.testing.pytestArgs": [
|
||||||
"Sample codes"
|
"Sample codes"
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# directly running the DOE because existing surrogates can be explored with another workflow
|
# directly running the DOE because existing surrogates can be explored with another workflow
|
||||||
from os import path
|
from os import path
|
||||||
|
from os import sys
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import time
|
import time
|
||||||
@ -15,6 +16,11 @@ import itertools
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from mpl_toolkits.mplot3d import Axes3D
|
from mpl_toolkits.mplot3d import Axes3D
|
||||||
|
|
||||||
|
# Test function representation
|
||||||
|
from rpy2 import robjects as robjs
|
||||||
|
from rpy2.robjects.packages import importr
|
||||||
|
from rpy2 import rinterface
|
||||||
|
|
||||||
# Test function characteristics
|
# Test function characteristics
|
||||||
import statistics as st
|
import statistics as st
|
||||||
from scipy import signal, misc, ndimage
|
from scipy import signal, misc, ndimage
|
||||||
@ -140,93 +146,30 @@ def representfunc(funcpath):
|
|||||||
|
|
||||||
# Automatically generate the representation if the docstrings did not return anything
|
# Automatically generate the representation if the docstrings did not return anything
|
||||||
if not ('Represented' in results):
|
if not ('Represented' in results):
|
||||||
print("Warning, the Representation of the Test Function has not specified\n===\n******Calculating the Characteristics******")
|
print("Warning, the Representation of the Test Function has not been specified\n===\n******Calculating the Characteristics******")
|
||||||
n = int(results['dimmensions'])
|
n = int(results['dimmensions'])
|
||||||
|
|
||||||
# pickle these steps
|
execpath = sys.executable
|
||||||
coords = arange(-10,10,0.5)
|
|
||||||
samplemx = array([*itertools.product(coords, repeat=n)])
|
|
||||||
funcmap = array([* map(funcmodule.main, samplemx)])
|
|
||||||
|
|
||||||
# Arrays for plotting the test function
|
# creating the r functions
|
||||||
X = array([tp[0] for tp in samplemx])
|
rlist = robjs.r['list']
|
||||||
Y = array([tp[1] for tp in samplemx])
|
rapply = robjs.r['apply']
|
||||||
Z = array(funcmap)
|
rtestfunc = rinterface.rternalize(funcmodule.main)
|
||||||
|
|
||||||
# reshaping the array into a 3D topology
|
###
|
||||||
topology = reshape(Z,(coords.size,coords.size))
|
lower =-10
|
||||||
ck = topology
|
upper = 10
|
||||||
|
X = flacco.createInitialSample(n_obs = 500, dim = 2, 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)
|
||||||
|
|
||||||
# Plotting the test function
|
rawfeats = flacco.calculateFeatureSet(testfuncobj, set='ela_meta')
|
||||||
fig = plt.figure()
|
|
||||||
ax = fig.add_subplot(111, projection='3d')
|
pyfeat = asarray(rawfeats)
|
||||||
ax.plot_trisurf(X, Y, Z)
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Number of Modes filter the data for local optima: look for circle like shapes, or squares or rectangles of very low derivative (tip of modes)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Valleys and Bassins
|
|
||||||
|
|
||||||
# Alternative filter used for calculating derivatives
|
|
||||||
#derfilt = array([1.0, -2, 1.0], dtype=float32)
|
|
||||||
#alpha = signal.sepfir2d(ck, derfilt, [1]) + signal.sepfir2d(ck, [1], derfilt)
|
|
||||||
|
|
||||||
# Currently used filter for Valley detection
|
|
||||||
hor = array([[0,1,1],[-1,0,1], [-1,-1,0]])
|
|
||||||
vert = array([[-1,-1,0], [-1,0,1], [0,1,1]])
|
|
||||||
|
|
||||||
for i in range(1): betaH = signal.convolve(ck,hor,mode='valid')
|
|
||||||
for i in range(1): betaV = signal.convolve(ck,vert, mode='valid')
|
|
||||||
|
|
||||||
beta = sqrt(betaH ** 2 + betaV ** 2)
|
|
||||||
|
|
||||||
|
|
||||||
#beta = beta[5:-5][5:-5]
|
|
||||||
|
|
||||||
norm = linalg.norm(beta)
|
|
||||||
beta/= norm # normalized matrix
|
|
||||||
|
|
||||||
|
|
||||||
# custom filter for detection should light up the locaton of pattern
|
|
||||||
kernel = array([[1,1,1], [1,100,1], [1,1,1]])
|
|
||||||
beta = beta < average(beta)
|
|
||||||
beta = beta * 1
|
|
||||||
for i in range(100):
|
|
||||||
beta = ndimage.convolve(beta,kernel)
|
|
||||||
beta = beta >= 101
|
|
||||||
beta = beta * 1
|
|
||||||
|
|
||||||
if any(beta): results['Valleys'] = True
|
|
||||||
|
|
||||||
|
|
||||||
# Separability: calculate the derivatives in one dimension and see if independant from other dimension
|
|
||||||
|
|
||||||
|
|
||||||
# Dimensionality: number of objectives, inputs: call function once and see what it gives | for number of inputs call until it works; try catch
|
|
||||||
|
|
||||||
|
|
||||||
# Pareto fronts:
|
|
||||||
|
|
||||||
|
|
||||||
# Noisyness: use the previously generated DOE and calculate a noisyness factor; average of derivative
|
|
||||||
|
|
||||||
# Displaying the plots for development purposes
|
|
||||||
#img1 = plt.figure()
|
|
||||||
#ax2 = img1.add_subplot(111)
|
|
||||||
#ax2.imshow(alpha)
|
|
||||||
|
|
||||||
img2 = plt.figure()
|
|
||||||
ax3 = img2.add_subplot(111)
|
|
||||||
ax3.imshow(beta)
|
|
||||||
|
|
||||||
plt.show()
|
|
||||||
|
|
||||||
# Writing the calculated representation into the test function file
|
|
||||||
# results['Represented'] = True
|
|
||||||
writerepresentation(funcpath, results)
|
writerepresentation(funcpath, results)
|
||||||
|
|
||||||
|
|
||||||
@ -286,13 +229,22 @@ if __name__ == '__main__':
|
|||||||
# testfunctionpaths = ["/home/remi/Documents/MDAF-GitLAB/SourceCode/TestFunctions/Bukin4.py"]
|
# testfunctionpaths = ["/home/remi/Documents/MDAF-GitLAB/SourceCode/TestFunctions/Bukin4.py"]
|
||||||
# funcnames = ["Bukin4"]
|
# funcnames = ["Bukin4"]
|
||||||
|
|
||||||
|
# Installing the packages needed for FLACCO
|
||||||
|
utils = importr('utils')
|
||||||
|
#utils.install_packages('flacco', repos='https://utstat.toronto.edu/cran/')
|
||||||
|
#utils.install_packages('list', repos='https://utstat.toronto.edu/cran/')
|
||||||
|
####utils.install_packages('reticulate', repos='https://utstat.toronto.edu/cran/')
|
||||||
|
|
||||||
|
reticulate = importr('reticulate')
|
||||||
|
flacco = importr('flacco')
|
||||||
|
|
||||||
objs = 0
|
objs = 0
|
||||||
args = {"high": 200, "low": -200, "t": 1000, "p": 0.95}
|
args = {"high": 200, "low": -200, "t": 1000, "p": 0.95}
|
||||||
scale = 1
|
scale = 1
|
||||||
|
|
||||||
data = doe (heuristicpath, heuristic_name, testfunctionpaths, funcnames, objs, args, scale)
|
# data = doe (heuristicpath, heuristic_name, testfunctionpaths, funcnames, objs, args, scale)
|
||||||
print(data['Bukin2'][1][2])
|
# print([point[2] for point in data['Bukin2'][1]])
|
||||||
#representfunc("TestFunctions/Bukin6.py")
|
representfunc("TestFunctions/Bukin2.py")
|
||||||
|
|
||||||
|
|
||||||
# %%
|
# %%
|
||||||
|
@ -72,7 +72,7 @@ def main(func, obj, S, args):
|
|||||||
route.append(Best[:])
|
route.append(Best[:])
|
||||||
print(route)
|
print(route)
|
||||||
|
|
||||||
if t < 0 or Quality(Best,y,func) > 200:
|
if t < 0 or Quality(Best,y,func) > 50:
|
||||||
break
|
break
|
||||||
#print('the Best Quality obtained was:{}'.format(Quality(Best,y)))
|
#print('the Best Quality obtained was:{}'.format(Quality(Best,y)))
|
||||||
print("Final Quality is: {}".format(Quality(Best,y,func)))
|
print("Final Quality is: {}".format(Quality(Best,y,func)))
|
||||||
|
Binary file not shown.
@ -5,88 +5,5 @@ def main(args):
|
|||||||
'''
|
'''
|
||||||
#_# dimmensions: 2
|
#_# 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
|
|
||||||
|
|
||||||
#_# 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
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
|
|
||||||
#_# dimmensions: 2.0
|
|
||||||
#_# Valleys: True
|
|
||||||
'''
|
'''
|
||||||
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)
|
||||||
|
BIN
SourceCode/TestFunctions/__pycache__/Brown.cpython-39.pyc
Normal file
BIN
SourceCode/TestFunctions/__pycache__/Brown.cpython-39.pyc
Normal file
Binary file not shown.
BIN
SourceCode/TestFunctions/__pycache__/Bukin2.cpython-39.pyc
Normal file
BIN
SourceCode/TestFunctions/__pycache__/Bukin2.cpython-39.pyc
Normal file
Binary file not shown.
BIN
SourceCode/TestFunctions/__pycache__/Bukin4.cpython-39.pyc
Normal file
BIN
SourceCode/TestFunctions/__pycache__/Bukin4.cpython-39.pyc
Normal file
Binary file not shown.
BIN
SourceCode/TestFunctions/__pycache__/Bukin6.cpython-39.pyc
Normal file
BIN
SourceCode/TestFunctions/__pycache__/Bukin6.cpython-39.pyc
Normal file
Binary file not shown.
31
SourceCode/Testingground.py
Normal file
31
SourceCode/Testingground.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
from mpl_toolkits.mplot3d import Axes3D
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from matplotlib import cm
|
||||||
|
from matplotlib.ticker import LinearLocator, FormatStrFormatter
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
fig = plt.figure()
|
||||||
|
ax = fig.gca(projection='3d')
|
||||||
|
|
||||||
|
# Make data.
|
||||||
|
X = np.arange(-5, 5, 0.25)
|
||||||
|
Y = np.arange(-5, 5, 0.25)
|
||||||
|
X, Y = np.meshgrid(X, Y)
|
||||||
|
R = np.sqrt(X**2 + Y**2)
|
||||||
|
Z = np.sin(R)
|
||||||
|
print(Z[1])
|
||||||
|
|
||||||
|
# Plot the surface.
|
||||||
|
surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm,
|
||||||
|
linewidth=0, antialiased=False)
|
||||||
|
|
||||||
|
# Customize the z axis.
|
||||||
|
ax.set_zlim(-1.01, 1.01)
|
||||||
|
ax.zaxis.set_major_locator(LinearLocator(10))
|
||||||
|
ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
|
||||||
|
|
||||||
|
# Add a color bar which maps values to colors.
|
||||||
|
fig.colorbar(surf, shrink=0.5, aspect=5)
|
||||||
|
|
||||||
|
plt.show()
|
BIN
SourceCode/__pycache__/AlgorithmAnalyser.cpython-39.pyc
Normal file
BIN
SourceCode/__pycache__/AlgorithmAnalyser.cpython-39.pyc
Normal file
Binary file not shown.
31
SourceCode/calcFeatures.R
Normal file
31
SourceCode/calcFeatures.R
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
library(reticulate)
|
||||||
|
library(flacco)
|
||||||
|
library(parallelMap)
|
||||||
|
library(parallel)
|
||||||
|
|
||||||
|
# Other packages to install
|
||||||
|
# plyr
|
||||||
|
# RANN
|
||||||
|
# numDeriv
|
||||||
|
# e1071
|
||||||
|
# mda - needs to install gcc-fortran on Operating system
|
||||||
|
|
||||||
|
|
||||||
|
genTestFeatures <- function(path,pypath, upper=10, lower=-10, n) {
|
||||||
|
|
||||||
|
use_python(pypath)
|
||||||
|
source_python(path)
|
||||||
|
|
||||||
|
X = createInitialSample(n.obs = 500, dim = n, control = list(init_sample.type = 'lhs', init_sample.lower = lower, init_sample.upper = upper))
|
||||||
|
|
||||||
|
y = apply(X, 1, main)
|
||||||
|
|
||||||
|
testfunc <- createFeatureObject(X = X, y = y, fun = main, lower = lower, upper = upper, blocks = 10)
|
||||||
|
|
||||||
|
n.cores = detectCores()
|
||||||
|
parallelStart(mode = "local", logging = FALSE, show.info = FALSE)
|
||||||
|
system.time((levelset.par = calculateFeatures(testfunc , control = list('cm_angle.show_warnings'=TRUE, 'cm_grad.show_warnings'=TRUE, 'ic.show_warnings'=TRUE))))
|
||||||
|
parallelStop()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user