linked feature
I am confused about the linked feature. The linked feature have these contributes: name/fml/embedding_dim/size/source_component/source_translator/source_layer, i am confused about the embedding_dim and the source_layer_size, and what relationshilps between the features given by fml and the source_layer of source_component. And source_translator "shift-reduce-step" means? Thanks.
Good questions, I agree we should document this better.
-
embedding_dimis the dimesionality of the embedding of the feature. So when you pull a linked feature, say from tagger to parser, it gets re-embedded (basically multiplied by a matrix) by default. If you do not want to re-embed, setembedding_dim = -1 -
The lifecycle of a linked feature is as follows. First, a number is produced by a feature defined in
fml. Then that number is tranformed by atranslator, say the output isSTEP. So then you look into the neural network activations ofsource_layerofsource_componentat stepSTEP. Those activations (re-embedded as mentioned above) are the linked features. -
A practical example: you can set
fmlto bebias(0), which produces0, and then settranslatorto behistory, thus translating0into the total number of steps in that component. So then you pull the last activation of the source_component, without having to explicitly define how many steps were there. (this can be useful, for example, when you are building a seq2seq architecture) -
shift-reduce-stepreturns, given a token index, the neural network activation from when it was placed on the stack. The correspondingfmlto use here is typicallystack.focusorstack(1).focusto basically pull the representations of top two tokens on the stack.
@bogatyy Thanks.In the lifecycle of a linked feature, I am still confused about " First, a number is produced by a feature defined in fml. Then that number is tranformed by a translator, say the output is STEP", for example, the first component is shift-only transition, the second component is tagger, and the fml of linked features of the second component is "stack.focus stack(1).focus",can you explain how this work?the second component input of each time step are(is this similar to each time-step)?how they connect to the first component?
And the differences of translators "identity","reverse-token","history", can you explain this use an example?
(1) stack.focus cannot be used with neither shift-only nor tagger. It points to the top token currently on the stack. So it only works with 'arc-standard' transition system (i.e. for the parser). https://en.wikipedia.org/wiki/Shift-reduce_parser
(2) "identity" just outputs whatever "fml" produced. So you get IDENTITY(N) = N. "reverse-token" counts from the end of the sentence. So REVERSE-TOKEN(N) = COUNT_TOKENS(INPUT) - N "history" is similar, but counts from the end of the sequence of steps. Notice the difference to reverse-token: for example, a shift-reduce parser on L tokens will have 2*L+1 steps.
@bogatyy
linked_feature {
name: "features"
fml: "input.focus"
embedding_dim: -1
size: 1
source_component: "tagger-features"
source_translator: "identity"
source_layer: "logits"
}
in this case, this linked feature means? "identity" means outputs is "input.focus", how can this relate activation of "logits" layer of "tagger-features"?