import matplotlib.pyplot as plt
import math
import numpy as np
def calconvex(X):
demational = X.shape[1]
Xtemp = np.zeros(shape=(demational, demational))
mean = np.mean(X, axis=0)
for i in range(len(X)):
reduce = [X[i, :] - mean]
Xtemp = Xtemp + np.dot(np.transpose(reduce), reduce)
convex = 1 / len(X) * (Xtemp)
return convex
plt.figure(figsize=(8, 8))
plt.subplots_adjust(bottom=.05, top=.9, left=.05, right=.95)
plt.subplot(111)
num = 100
# X1, Y1= make_gaussian_quantiles(cov=100,n_features=2, n_classes=1,n_samples=num)
# # plt.scatter(X1[:, 0], X1[:, 1], marker='o')
x1 = np.linspace(0,10,50)
# y1 = np.power(math.e,1.0/x1)
y1 = 1.0 / x1
plt.plot(x1,y1,label="1/x")
# plt.title("convex : %d" % np.sum(calconvex(X1)), fontsize='small')
# x2 = np.linspace(0,10,20)
y2 = np.log(x1)
plt.plot(x1,y2,label="ln")
y3 = x1
plt.plot(x1,y3,label="x")
y4 = np.sqrt(x1)
plt.plot(x1,y4,label="sqrtx")
y5 = np.exp(x1)
plt.plot(x1,y5,label="e")
y6 = np.power(x1,2)
plt.plot(x1,y6,label="x^2")
plt.grid()
plt.legend()
plt.axis([0,10,0,10])
plt.savefig("image/test.png")
plt.show()