Skip to content

Commit

Permalink
Change loss chart visual to darker line (#1917)
Browse files Browse the repository at this point in the history
  • Loading branch information
lajohn4747 authored Apr 18, 2024
1 parent 938bea0 commit 7732f0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions sdv/single_table/ctgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ def get_loss_values_plot(self, title='CTGAN loss function'):

# Tidy up the loss values data
loss_df = self._model.loss_values.copy()
loss_df['Generator Loss'] = loss_df['Generator Loss'].apply(lambda x: x.item())
loss_df['Discriminator Loss'] = loss_df['Discriminator Loss'].apply(lambda x: x.item())

# Create a pretty chart using Plotly Express
fig = px.line(
loss_df, x='Epoch',
y=['Generator Loss', 'Discriminator Loss'],
color_discrete_map={
'Generator Loss': visualization.PlotConfig.DATACEBO_BLUE,
'Generator Loss': visualization.PlotConfig.DATACEBO_DARK,
'Discriminator Loss': visualization.PlotConfig.DATACEBO_GREEN
},
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/single_table/test_ctgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def test_get_loss_values_plot(self, mock_line_plot):
assert (fig['x'] == 'Epoch')
assert (fig['y'] == ['Generator Loss', 'Discriminator Loss'])
assert (fig['color_discrete_map'] == {
'Generator Loss': visualization.PlotConfig.DATACEBO_BLUE,
'Generator Loss': visualization.PlotConfig.DATACEBO_DARK,
'Discriminator Loss': visualization.PlotConfig.DATACEBO_GREEN
})

Expand Down

0 comments on commit 7732f0d

Please sign in to comment.