GithubHelp home page GithubHelp logo

Evaluating perplexity about nmt-keras HOT 4 CLOSED

philipcori avatar philipcori commented on May 24, 2024
Evaluating perplexity

from nmt-keras.

Comments (4)

lvapeab avatar lvapeab commented on May 24, 2024

Oh, that function was a utility that I quickly wrote to evaluate a model. It shouldn't be there. I've removed it.

To evaluate the perplexity of a model, you can pass 'perplexity' as a KERAS_METRIC in config.py. This is now done by default:

KERAS_METRICS = ['perplexity'] # Metrics to be logged by Keras during training (in addition to the loss).

PS: it requires to update Keras.

from nmt-keras.

philipcori avatar philipcori commented on May 24, 2024

Got it, thanks. However, it only computes perplexity during training. Is there a way to compute perplexity on the validation set? I would like to have the metric_name here be 'perplexity' rather than sacrebleu:

callbacks.append(PrintPerformanceMetricOnEpochEndOrEachNUpdates(nmt_model,
                                                                dataset,
                                                                gt_id='target_text',
                                                                metric_name=['sacrebleu'],
                                                                set_name=['val'],
                                                                batch_size=256,
                                                                each_n_epochs=20,
                                                                extra_vars=search_params,
                                                                reload_epoch=0,
                                                                is_text=True,
                                                                input_text_id=input_text_id,
                                                                index2word_y=vocab,
                                                                sampling_type='max_likelihood',
                                                                beam_search=True,
                                                                save_path=nmt_model.model_path,
                                                                start_eval_on_epoch=0,
                                                                write_samples=True,
                                                                write_type='list',
                                                                verbose=True))

Thanks again for the help.

from nmt-keras.

lvapeab avatar lvapeab commented on May 24, 2024

Added (MarcBS/multimodal_keras_wrapper@22d10a9).

You can now evaluate with Perpleixty as any other metric, e.g.:

    METRICS = ['sacrebleu', 'perplexity']

You'll need to update multimodal-keras-wrapper and nmt-keras.

from nmt-keras.

philipcori avatar philipcori commented on May 24, 2024

Great, thank you.

from nmt-keras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.