File size: 684 Bytes
31747ca
 
 
 
 
04b61ad
 
31747ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import matplotlib.pyplot as plt
import seaborn as sns
import requests
import json


ENDPOINT: str = "http://127.0.0.1:5000/"

request_params = {
    "algorithm": "neural-network",
    "arguments": {
        "epochs": 100,
        "activation_func": "tanh",
        "hidden_size": 8,
        "learning_rate": 0.01
    }
}

headers = {
    "Content-Type": "application/json",
}

r = requests.post(
    ENDPOINT,
    headers=headers,
    data=json.dumps(request_params),
)

model = r.json()


def plot():
    sns.set()
    plt.plot(model["loss_history"])
    plt.xlabel("Epoch")
    plt.ylabel("Loss")
    plt.title("Loss History")
    plt.show()


if __name__ == "__main__":
    plot()