Recommenders: [ASK] [HELP] NCF Notebook train loss graph

Created on 17 Oct 2019  路  3Comments  路  Source: microsoft/recommenders

I am using NCF deep dive notebook, I am just wondering is there any way to plot the train loss graph ? is there any inbuilt function to plot this? If not can you tell me how to do it?

Any help is appreciated.

Thanks
K

help wanted

Most helpful comment

You can use tf.summary.scalar() to write your metrics to tensorboard. Here you can find simple example.

For NCF in our repo, you can add summary writing part to:

def fit(self, data):
...
            # output every self.verbose
            if self.verbose and epoch_count % self.verbose == 0:
                logger.info(
                    "Epoch %d [%.2fs]: train_loss = %.6f "
                    % (epoch_count, train_time, sum(train_loss) / len(train_loss))
                )
                # ... write mean(train_loss) into summary writer here ...

We do have a logging hook at reco_utils/common/tf_utils.py which are being used for wide-deep model, but it is for tf.Estimator API. You can refer the module to see how the summary writer is used.

All 3 comments

You can use tf.summary.scalar() to write your metrics to tensorboard. Here you can find simple example.

For NCF in our repo, you can add summary writing part to:

def fit(self, data):
...
            # output every self.verbose
            if self.verbose and epoch_count % self.verbose == 0:
                logger.info(
                    "Epoch %d [%.2fs]: train_loss = %.6f "
                    % (epoch_count, train_time, sum(train_loss) / len(train_loss))
                )
                # ... write mean(train_loss) into summary writer here ...

We do have a logging hook at reco_utils/common/tf_utils.py which are being used for wide-deep model, but it is for tf.Estimator API. You can refer the module to see how the summary writer is used.

@karthikraja95 does it help solve your problem? If so, please close the issue.

I am trying to use implement it. I will let you know the results. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

roalexan picture roalexan  路  4Comments

miguelgfierro picture miguelgfierro  路  5Comments

ngcferreira picture ngcferreira  路  4Comments

luiscastro193 picture luiscastro193  路  5Comments

miguelgfierro picture miguelgfierro  路  3Comments