Closed arwhirang closed 7 years ago
well, sentiment model example is written to demonstrate how to combine preprocessing (in this case parsing s-expressions from strings) with modeling. Probably the simplest way to do what you want is to break out the preprocessing as a separate step (either with an InputTransform or just directly in python before Fold ever sees the data), add the features that you'd like, then pass the s-expression directly to a version of the sentiment model that doesn't do preprocessing but expects an s-expression as input. This should be quite simple, just drop the td.InputTransform(tokenize) block from the model, and call tokenize yourself along with adding your extra features.
On Thu, Mar 9, 2017 at 7:44 PM, arwhirang notifications@github.com wrote:
Suppose I have a certain input like below Fold is a nice library. ,which can be converted like below. (4 (3 Fold) (3 (3 (3 is) (3 (3 a) (3 (5 nice) (3 library)))) (3 .)))
The binary tree format string can be an input for the sentiment model https://github.com/tensorflow/fold/blob/master/tensorflow_fold/g3doc/sentiment.ipynb. I tried to find a way for add additional feature for each node in a tree. And by changing the label of each node, (for example, (3 Fold) => (3/NP Fold)) I could transfer additional feature to the model. But it seems a bit clumsy way for me.
Is there any way to add additional features to each node?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/fold/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AAsbjihHZjJ631H3edrgTb4AE53PaJrGks5rkMcagaJpZM4MY7wV .
Well... I have been trying it. But somehow, I feel like the model's performance becomes worse when I just add features to the label part (even if I do not use the additional features)
I will keep trying it.
update By adding more features to the label part, I was able to add features to the model.
Suppose I have a certain input like below
Fold is a nice library.
,which can be converted like below. (4 (3 Fold) (3 (3 (3 is) (3 (3 a) (3 (5 nice) (3 library)))) (3 .)))The binary tree format string can be an input for the sentiment model. I tried to find a way for assigning additional features for each node in a tree. And by changing the label of each node, (for example, (3 Fold) => (3/NP Fold)) I could transfer additional features to the model. But it seems a bit clumsy way for me.
Is there any other way to add additional features to each node?