Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLEU score #2477

Merged
merged 5 commits into from Jul 27, 2020
Merged

BLEU score #2477

merged 5 commits into from Jul 27, 2020

Conversation

mrityunjay-tripathi
Copy link
Member

No description provided.

Copy link
Member

@jeffin143 jeffin143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just few initial comments

}

std::map<WordVector, size_t> translationNGramCounts = GetNGrams(*trIt);
std::map<WordVector, size_t> overlap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use boost::string_view instead of std::string here and many other place too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used

typedef typename TranslationCorpusType::value_type WordVector;

statement in line number 52. I think it's up to the user what to be used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok to give user a choice, but here overlap variable doesn't have any relation with the user, I mean it is not exposed to user

map<<vector<string>>, size_t> overlap , it would be unnecessary copy of whole string when inserting the value in overlap map

That's my POV, may be you can wait for someone to give a better insight

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think it will be better to add tests for both types :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be unnecessary copy of whole string when inserting the value in overlap map

Ok I will see this. Thanks for clarifying.

src/mlpack/core/metrics/bleu_score_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_score_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_score.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_score.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_score.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_score_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_score_impl.hpp Outdated Show resolved Hide resolved
@mrityunjay-tripathi
Copy link
Member Author

@lozhnikov If you get some time, can you look this PR. This is done from my side.

Copy link
Contributor

@lozhnikov lozhnikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the slow response, I didn't see this PR. I added a few comments.

src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Show resolved Hide resolved
@mrityunjay-tripathi
Copy link
Member Author

@lozhnikov @zoq Can this be merged now?

Copy link
Contributor

@lozhnikov lozhnikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments.

src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Show resolved Hide resolved
@lozhnikov
Copy link
Contributor

Can this be merged now?

I think it's almost done. Let me look at the code a couple of times.

Copy link
Contributor

@lozhnikov lozhnikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@lozhnikov lozhnikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments.

src/mlpack/core/metrics/bleu.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
@mrityunjay-tripathi
Copy link
Member Author

@lozhnikov Can we conclude this PR?

Copy link
Contributor

@lozhnikov lozhnikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pointed out a small issue. I think after the fix we can merge this.

src/mlpack/core/metrics/bleu_impl.hpp Outdated Show resolved Hide resolved
Copy link

@mlpack-bot mlpack-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second approval provided automatically after 24 hours. 👍

@lozhnikov lozhnikov merged commit 5f7a2c6 into mlpack:master Jul 27, 2020
@lozhnikov
Copy link
Contributor

I merged the PR. Thanks for the contribution!

@lozhnikov
Copy link
Contributor

I thought the App Veyor build failed due to time limit. In fact it doesn't like the conversion from double to float in the std::initializer_list constructor. I'll fix it soon.

@mrityunjay-tripathi
Copy link
Member Author

Thanks, @lozhnikov for all the reviews and suggestions:) Glad that you found the issue really quick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants