Skip to content

Added a label bias functionality in tag mode#8

Open
priancho wants to merge 6 commits into
chokkan:masterfrom
priancho:master
Open

Added a label bias functionality in tag mode#8
priancho wants to merge 6 commits into
chokkan:masterfrom
priancho:master

Conversation

@priancho

Copy link
Copy Markdown

You can specify a label bias weight in tag mode.
Passed test with a small sample data.

Run crfsuite tag -h for help

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why not simply add the bias weights to the state table?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I agree that your approach is better than my code.
I will fix it and re-commit soon.

Comment thread example/crfutils.py
"""

x_range = list(range(len(X)))
x_range_set = set(x_range)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if I understand the rationale behind this. The list cast effectively pre-allocates the list, which seems unnecessary - and the named variable declaration seems like an unnecessary change.

Comment thread frontend/frontend.vcxproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you explain why these were changed?

Comment thread frontend/tag.c
if (opt->probability) {
floatval_t lognorm;
tagger->lognorm(tagger, &lognorm);
fprintf(fpo, "@score\t%f\t%f\n", score, lognorm);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Indentation does not match surrounding code.

Comment thread include/crfsuite.hpp

if (tr == NULL) {
std::stringstream ss;
ss << "The trainer is not initialized. Call Trainer::select before Trainer::train.";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a constant string. Why is a stream being used?

Comment thread include/crfsuite.hpp

if (data->attrs == NULL || data->labels == NULL) {
std::stringstream ss;
ss << "The data is empty. Call Trainer::append before Trainer::train.";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ditto the constant remark above.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants