コード例 #1
0
from sklearn.metrics import mean_absolute_error as mae
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import graphviz
import gplearn.functions as gpn

rng = check_random_state(0)
#Create the base data

x = rng.uniform(-10, 10.0001, 50)

y = rng.uniform(-10, 10.0001, 50)

x, y = np.meshgrid(x, y)
z = gpn.max2(gpn.min2(gpn.cos1(x), gpn.sin1(y)), gpn.tan1(x / y))

#Create Training sample
x_train = rng.uniform(-10, 10.0001, 50)

y_train = rng.uniform(-10, 10.0001, 50)

trainSet = []
for i in range(len(x_train)):
    trainSet.append([x_train[i], y_train[i]])
z_train = gpn.max2(gpn.min2(gpn.cos1(x_train), gpn.sin1(y_train)),
                   gpn.tan1(x_train / y_train))

#Create Testing sample
x_test = rng.uniform(-10, 10, 50)
y_test = rng.uniform(-10, 10, 50)
コード例 #2
0
from sklearn.metrics import mean_absolute_error as mae
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import graphviz
import gplearn.functions as gpn

rng = check_random_state(0)
#Create the base data

x = rng.uniform(-10, 10.0001, 50)

y = rng.uniform(-10, 10.0001, 50)

x, y = np.meshgrid(x, y)
z = gpn.cos1(x) - gpn.sin1(y)

#Create Training sample
x_train = rng.uniform(-10, 10.0001, 50)

y_train = rng.uniform(-10, 10.0001, 50)

trainSet = []
for i in range(len(x_train)):
    trainSet.append([x_train[i], y_train[i]])
z_train = gpn.cos1(x_train) - gpn.sin1(y_train)

#Create Testing sample
x_test = rng.uniform(-10, 10, 50)
y_test = rng.uniform(-10, 10, 50)
testSet = []
コード例 #3
0
import matplotlib.pyplot as plt
import numpy as np
import graphviz
import gplearn.functions as gpn



rng = check_random_state(0)
#Create the base data

x = rng.uniform(0, 10.001, 50)

y = rng.uniform(0, 10.001, 50)

x, y = np.meshgrid(x, y)
z = gpn.sqrt1(gpn.cos1(x) * gpn.inv1(gpn.sin1(y)))

#Create Training sample
x_train = rng.uniform(0, 10.001, 50)

y_train = rng.uniform(0, 10.001, 50)

trainSet = []
for i in range (len(x_train)):
    trainSet.append([x_train[i], y_train[i]])
z_train = gpn.sqrt1(gpn.cos1(x_train) * gpn.inv1(gpn.sin1(y_train)))

#Create Testing sample
x_test = rng.uniform(0, 10.0001, 50)
y_test = rng.uniform(0, 10.0001, 50)
testSet = []
コード例 #4
0
from sklearn.metrics import mean_absolute_error as mae
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import graphviz
import gplearn.functions as gpn

rng = check_random_state(0)
#Create the base data

x = rng.uniform(0, 10.001, 50)

y = rng.uniform(0, 10.001, 50)

x, y = np.meshgrid(x, y)
z = gpn.sin1(x + gpn.cos1(y))

#Create Training sample
x_train = rng.uniform(0, 10.001, 50)

y_train = rng.uniform(0, 10.001, 50)

trainSet = []
for i in range(len(x_train)):
    trainSet.append([x_train[i], y_train[i]])
z_train = gpn.sin1(x_train + gpn.cos1(y_train))

#Create Testing sample
x_test = rng.uniform(0, 10.0001, 50)
y_test = rng.uniform(0, 10.0001, 50)
testSet = []
コード例 #5
0
import matplotlib.pyplot as plt
import numpy as np
import graphviz
import gplearn.functions as gpn

rng = check_random_state(0)

#Create the base data
x = rng.uniform(0.001, 10, 50)
y = rng.uniform(-10, -0.001, 50)
realSet = []
for i in range(len(x)):
    realSet.append([x[i], y[i]])
x, y = np.meshgrid(x, y)
z = (x / y) + gpn.cos1(
    2 * x) - gpn.sin1(3 * y) * gpn.max2(6 * x + 10, 2 * y - 8)
-gpn.min2(y + 5, 3 * x) + gpn.inv1(y) - gpn.tan1(x) * gpn.log1(x)
+gpn.sqrt1(x) * gpn.abs1(-2 * x)
'''
ax = plt.figure().gca(projection='3d')
ax.set_xlim(0, 10)
ax.set_ylim(-10, 0)
surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, color='green', alpha=0.5)
#plt.show()
'''

#Create Training sample
x_train = rng.uniform(0.001, 10, 50)
y_train = rng.uniform(-10, -0.001, 50)
trainSet = []
for i in range(len(x_train)):