Sphere

代码示例如下::

num = 20
ndim = 2
x = np.ones((num, ndim))

x[:, 0] = np.linspace(-10, 10.0, num)
x[:, 1] = 0.0
s = Sphere()
dataSet = s(x)
plt.plot(dataSet["input"][:, 0], dataSet["output"][:, 0])
plt.xlabel("x")
plt.ylabel("y")
plt.show()
print(dataSet)

know = s.getKnowledge(knowType=["单调型","形状型"],visual = True)
print(know)

运行结果如下::

{'title': [['x0', 'x1'], ['y']],
'range': [[[0, 10], [0, 10]], [0, 200]],
'input': array([[-10.        ,   0.        ],
           [ -8.94736842,   0.        ],
           [ -7.89473684,   0.        ],
           [ -6.84210526,   0.        ],
           [ -5.78947368,   0.        ],
           [ -4.73684211,   0.        ],
           [ -3.68421053,   0.        ],
           [ -2.63157895,   0.        ],
           [ -1.57894737,   0.        ],
           [ -0.52631579,   0.        ],
           [  0.52631579,   0.        ],
           [  1.57894737,   0.        ],
           [  2.63157895,   0.        ],
           [  3.68421053,   0.        ],
           [  4.73684211,   0.        ],
           [  5.78947368,   0.        ],
           [  6.84210526,   0.        ],
           [  7.89473684,   0.        ],
           [  8.94736842,   0.        ],
           [ 10.        ,   0.        ]]),
           'output': array([[100.        ],
           [ 80.05540166],
           [ 62.32686981],
           [ 46.81440443],
           [ 33.51800554],
           [ 22.43767313],
           [ 13.5734072 ],
           [  6.92520776],
           [  2.49307479],
           [  0.27700831],
           [  0.27700831],
           [  2.49307479],
           [  6.92520776],
           [ 13.5734072 ],
           [ 22.43767313],
           [ 33.51800554],
           [ 46.81440443],
           [ 62.32686981],
           [ 80.05540166],
           [100.        ]])}
___________________________________________________________________________
知识名称:C:\kfsmt算法包\kfsmt\benchmark\sphere\knowledge\sphereMonoKnowledge1.xml
知识类型:单调型
变量:x0
变量范围:[0.0, 10.0]
性能:y
单调性:单调递增
___________________________________________________________________________
知识名称:C:\kfsmt算法包\kfsmt\benchmark\sphere\knowledge\sphereMonoKnowledge2.xml
知识类型:单调型
变量:x0
变量范围:[-10.0, 0.0]
性能:y
单调性:单调递减
___________________________________________________________________________
知识名称:C:\kfsmt算法包\kfsmt\benchmark\sphere\knowledge\sphereShapeKnowledge.xml
知识类型:形状型
变量:x0
变量范围:[-10.0, 10.0]
性能:y
性能范围:[0.0, 100.0]
贝塞尔曲线控制点1:[-9.91, 102.4]
贝塞尔曲线控制点2:[-8.06, 20.8]
贝塞尔曲线控制点3:[0.28, -84.8]
贝塞尔曲线控制点4:[7.05, -3.2]
贝塞尔曲线控制点5:[9.97, 105.6]
[{'type': '单调型', 'input_type': ['x0'], 'output_type': ['y'], 'convar': None, 'input_range': [[0.0, 10.0]], 'mapping_relation': ['单调递增']}, {'type': '单调型', 'input_type': ['x0'], 'output_type': ['y'], 'convar': None, 'input_range': [[-10.0, 0.0]], 'mapping_relation': ['单调递减']}, {'type': '形状型', 'input_type': ['x0'], 'output_type': ['y'], 'convar': None, 'input_range': [[-10.0, 10.0]], 'output_range': [[0.0, 100.0]], 'mapping_relation': [[-9.91, 102.4], [-8.06, 20.8], [0.28, -84.8], [7.05, -3.2], [9.97, 105.6]]}]
benchmark/Sphere/image/Sphere运行结果.png