Giter Club home page Giter Club logo

rouge-l-tensorflow's Introduction

Rouge-L-Tensorflow

ROUGE L metric implementation using tensorflow ops.

Implemented for the purpose of reinforcing a summary model without having to switch to CPU for computation.

About

ROUGE (Recall-Oriented Understudy for Gisting Evaluation) is specified in the paper ROUGE: A Package for Automatic Evaluation of Summaries. It is often used as a method to automatically evaluate machine generated summeries.

Can be used to compute Rouge L during training as a reinforment objective as described in the paper A Deep Reinforced Model For Abstractive Summarization, without switching to CPU. Significantly more efficient than using tf.py_func with a python Rouge L function.

Usage

Function tf_rouge_l takes three arguments: a Tensor to evaluate, a Tensor to act as a reference, and an end id to truncate each sequence with. If the end id is not found within a sequence, the sequence is not truncated.

import tensorflow as tf
from rouge_l_tensorflow import tf_rouge_l

sess = tf.Session()

val = tf.constant([[5,6,13,57,100,4,5,0,0], [67,55,31,52,88,100,0,0,0]])
ref = tf.constant([[5,6,13,57,100,4,0,9,88], [67,99,31,57,88,4,0,0,4]])
end_token = 100

sess.run(tf_rouge_l(val, ref, end_token)) 
# => array([ 0.70957613,  0.6875,  0.80000001], dtype=float32)

rouge-l-tensorflow's People

Contributors

vd44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

wsiy

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.