I have a model and ran it on a random data (ranging from 1000 to 10001 with a step of 1000) to get the loss value after 10 epochs, time taken for computation. I used 3 different optimizers SGD, RMSProp, Adam for comparison. Now I wanted to visualise the time taken for different input sizes along with the loss.
I have the following lists/arrays:
time_sgd, time_rmsprop, time_adam - each of length 10 (1000 to 10001 with step-size 1000)
loss_sgd, loss_rmsprop, loss_adam - each of length 10 (the final loss for each imput size)
I decided to use seaborn
for a scatterplot with input_size
on the x-axis, time
on the y-axis and loss
as the size of the data points. I tried the following code but it is displaying in separate graphs.
import matplotlib.pyplot as plt
import seaborn as sns
sns.relplot(x=range(10), y=time_sgd, kind="scatter", size=loss_sgd, hue=loss_sgd)
sns.relplot(x=range(10), y=time_rmsprop, kind="scatter", size=loss_rmsprop, hue=loss_rmsprop)
sns.relplot(x=range(10), y=time_adam, kind="scatter", size=loss_adam, hue=loss_adam)
plt.show()
I want all the visualization in a single graph like this:
plt.scatter(range(10), time_sgd, label='SGD')
plt.scatter(range(10), time_rmsprop, label='RMSProp')
plt.scatter(range(10), time_adam, label='Adam')
plt.xlabel('Input size in 1000')
plt.ylabel('Time in seconds')
plt.title('Time comparison')
plt.legend()
plt.show()
But the issue in the last code is that it is not distinguishing the 3 points based on loss. I want the sizes of the data points for the same input size to differ based on the loss value.
question from:
https://stackoverflow.com/questions/65897208/visualizing-the-data-in-seaborn 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…