-
Notifications
You must be signed in to change notification settings - Fork 27
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
Need help to understand the code #5
Comments
After debugging using several test samples, I think I understand the symbol For example, the sequence
equals to
, and it equals to the following tree: |
Thank you for your attention~ (1) What does the symbol ^ mean? (2) How to understand the content of the output files of predict.py(e.g. ATIS/out/0.txt)? (3) Which part of this repository is not complete? (4) The number of training epochs is set to pretrain_times = 100000, is it necessary to use such a big value to achieve the results in the paper? I hope my answers can help you understand our project. Zeyu |
Thanks for your quick reply, I still have some questions. (1) Confusion about the meaning of "Javaoutput.Probability". Specifically, I get confused about the following expression in JavaOutNext.Probility = (JavaOut.Probility * math.pow(len(JavaOut.RuleList), apa) + math.log(max(1e-10, res[i]))) / math.pow(len(JavaOut.RuleList) + 1, apa) Suppose we decode rule I notice that, at time step 1, the expression above equals to in which It would be more reasonable to me if the expression is changed to JavaOutNext.Probility = JavaOut.Probility + math.log(max(1e-10, res[i])) , which means Could you explain more about "the log of its percentage"? (2) Why do we need the files fw.write(out.replace(" node_gen ^", "") + "\n")
fw.write(node_par[0] + "\n")
fw.write(node_par[1] + "\n")
fw.write(node_par[2] + "\n")
fw.write(out.replace(" End ^", "") + "\n")
fw.write(out.replace(" End ^", "") + "\n") # Is this redundant?
fw.write("1\n") # Fixed value?
fw.write("1\n") # Fixed value?
fw.write(out.replace(" End ^", "") + "\n")
fw.write("1\n") # Is this useless?
fw.write(str(father_index_now) + "\n") # Is this redundant? The method return Javaoutput(lines[4][:-1], Nl, lines[1][:-1], lines[2][:-1], lines[3][:-1], lines[0][:-1],lines[6][:-1], lines[7][:-1], "grow") So is some of the content of Hoping for your reply! |
(1) Confusion about the meaning of "Javaoutput.Probability". (2) Why do we need the files Tree_Rule.in and Tree_Feature.out? Zeyu |
@zysszy Many thanks for helping me out so much! |
@zysszy Sorry to bother you again, I have another question. As you've mentioned in #3
I can confirm that this is true when doing inference in The numbers beside every non-terminal nodes indicate their order which decide which tokens they can pay attention to under the control of the What am I doing wrong here? Thanks! |
Sorry for the late reply. The Node Zeyu |
I still feel confused about the Node First of all, I would like to clarify that the data of the first example is as follows.
Please correct me if I am wrong. There's a strong possibility that I have misunderstood something important. (1) Question about the Node
There is no rule with (2) The meaning of 2.1) When describing an AST using a tree, the 2.2) When denoting an AST using sequence with symbol Looking forward to your reply! |
I found the figure is wrong. 8th node We expand a node until all of its children are generated. The children of the node
|
How to understand the last line of the first example, |
Yeah, you are right if you remove the node |
I understand that the 6th line of every sample corresponds to the tree without |
Hmmm... Sorry, it is a bug..... Thank you for this. Zeyu |
@zysszy Thank you soooo much for your valuable time! |
@zysszy I want to ask if this method of AST node traversal into a sequence is from that paper. Is there a paper that officially introduces this method? My current work uses this AST traversal method, and I want to quote the reference of this method. |
We directly use the traditional preorder traversal algorithm. Maybe you can refer to the Wikipedia (https://en.wikipedia.org/wiki/Tree_traversal). |
OK, thank you for your reply! |
First, I would like to thank you for the publication of the source code, which makes it much easier for me to understand the details of the model. I have read several key files of the project, including
resolve_data.py
,code_generate_model.py
andrun.py
, and now I am kind of stuck on the filepredict.py
. I have seversal questions and need some help.(1) What does the symbol
^
mean? It appears both in the input file of training procedure (train_trans.txt
) and the output file of inference (e.g. 'ATIS/out/0.txt'), and the code inpredict.py
insert or remove the symbol many times.(2) How to understand the content of the output files of
predict.py
(e.g.ATIS/out/0.txt
)? According to the methodBeamSearch()
inpredict.py
, I think every 2 lines is a beam, with the first line showing the generated tree and the second line is the probability of the tree. But I failed to understand how the trees are organized into these sequences (with so many^
), and what made me more confused, the "probability" are all negative numbers. I have attached a picture showing the content of0.txt
.(3)Which part of this repository is not complete? According to README, "This repository is not a complete one".
(4) The number of training epochs is set to
pretrain_times = 100000
, is it necessary to use such a big value to achieve the results in the paper? After running for a while, I found out that after 100 epochs, the accuracy is 0.98+, and 0.99+ after 500 epochs, so I just stopped training.Thank you for your help in advance!
The text was updated successfully, but these errors were encountered: