Ejemplo n.º 1
0
def get_advance():
    """
    获取每个小组晋级的队伍
    """
    teams = Points.select().where(Points.team_order << [1, 2])
    data = [Points.get_one(id=t.id).get_dict() for t in teams]
    return json_data(data)
Ejemplo n.º 2
0
def get_true_goals():
    """
    获取每个小组净胜球最大的队伍
    """
    teams = Points.select(Points.group, Points.team, fn.Max(Points.true_goal)).where(
        Points.team == Points.team).group_by(Points.group)
    data = [g.get_dict() for g in teams]
    return json_data(data)
Ejemplo n.º 3
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))

Ejemplo n.º 4
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)