Пример #1
0
# kmeans.distribute()
# error = kmeans.check()
# print('separated sets normalize')
# print("error is %f%%" % (error*100))
#
# print('none separated sets')
# points = Points()
# points.init(file_name="sets_connected.xls", start_row=0, dim=5)
# kmeans = Kmeans(points=points.points, centroid_num=5)
# kmeans.distribute()
# error = kmeans.check()
# print('none separated sets')
# print("error is %f%%" % (error*100))
#
# print('none separated sets normalize')
# points = Points()
# points.init(file_name="sets_connected_norma.xls", start_row=0, dim=5)
# kmeans = Kmeans(points=points.points, centroid_num=5)
# kmeans.distribute()
# error = kmeans.check()
# print('none separated sets normalize')
# print("error is %f%%" % (error*100))

points = Points()
points.init(file_name="iris.xls", start_row=0, end_row=2, dim=4)
prc = Pca(points=points.points)
prc.distribute()
error = prc.check()
print("error is %f%%" % (error*100))

Пример #2
0
from model import Points


# restore network
# with open("my_network", 'rb') as pickle_file:
#     network = pickle.load(pickle_file)
# init new network
network = NeuralNetwork(inputs=5, outs=1, hidden_layers_num=5, layer_neurons_num=5)

# simple check that everithing is working
# matr = np.random.rand(5, 1)
# print("matr input is: ", matr)
# result = network.work(matr)
# print("result is : ", result)

# get data from xl
points = Points()
points.init(file_name="separated_sets.xls")
# study our network

for i in range(100):
    error = 0
    for point in points.points:
        error += abs(network.study(point.cords, np.array([point.set_class])))
    print(error)

# save network
with open("my_network", 'wb') as pickle_file:
    pickle.dump(network, pickle_file)