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

add chunk eval layer #6296

Merged
merged 10 commits into from
Dec 5, 2017
Merged

Conversation

jacquesqiao
Copy link
Member

@jacquesqiao jacquesqiao commented Dec 5, 2017

fix: #6280

@jacquesqiao jacquesqiao changed the title Trunk evaluator add trunk eva layer Dec 5, 2017
@jacquesqiao jacquesqiao changed the title add trunk eva layer add trunk eval layer Dec 5, 2017
@jacquesqiao jacquesqiao added this to the Release 0.11.0 milestone Dec 5, 2017
@jacquesqiao jacquesqiao changed the title add trunk eval layer add chunk eval layer Dec 5, 2017
@@ -632,6 +632,40 @@ def accuracy(input, label, k=1, correct=None, total=None, **kwargs):
return acc_out


def trunk_eval(input,
Copy link
Contributor

Choose a reason for hiding this comment

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

chunk_eval should be better.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

images = layers.data(name='pixel', shape=[784], dtype='float32')
label = layers.data(name='label', shape=[1], dtype='int32')
hidden = layers.fc(input=images, size=128)
crf = layers.linear_chain_crf(
input=hidden, label=label, param_attr=ParamAttr(name="crfw"))
crf_decode = layers.crf_decoding(
input=hidden, param_attr=ParamAttr(name="crfw"))
layers.trunk_eval(
Copy link
Contributor

Choose a reason for hiding this comment

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

chunk_eval might be better.

@@ -173,10 +179,13 @@ def main():
for data in train_data():
outs = exe.run(fluid.default_main_program(),
feed=feeder.feed(data),
fetch_list=[avg_cost])
fetch_list=[avg_cost, precision])
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe recall and f1_score can also be added here.

@@ -130,13 +130,19 @@ def test_word_embedding(self):
def test_linear_chain_crf(self):
program = Program()
with program_guard(program, startup_program=Program()):
label_dict_len = 10
images = layers.data(name='pixel', shape=[784], dtype='float32')
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally suggest using NLP related names rather than names for images here, but it has little effect.

Copy link
Contributor

@guoshengCS guoshengCS left a comment

Choose a reason for hiding this comment

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

LGTM

@jacquesqiao jacquesqiao merged commit 161128b into PaddlePaddle:develop Dec 5, 2017
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.

add trunk evaluator for crf
2 participants