declare-lab/kingdom

4.3 Step 2a, x represents for sentence or document?

Closed this issue · 1 comments

Awesome work! There is one point confuses me. At the section of 4.3 Step 2a, x represents document(the whole target domain dataset) or sentence(one sentence of the document), I guess it's the latter.But if it is the latter, whether the 'Commonsense' is for target domain or target sentnce. If posssible, can you mail me the code of graph features trainning.jjplane@foxmail.com.thx!

Each instance of the Amazon reviews data is a document. Hence, at Section 4.3 Step 2a, x represents one document. The extracted commonsense features x_cg are thus document specific. Note that these features are extracted for both source and target documents.

This is the corresponding part in our code in model.py

recon_s2, y_s_pred, y_s_domain_pred = model(x_s1, x_s2, alpha)
recon_t2, _, y_t_domain_pred = model(x_t1, x_t2, alpha)
        
loss_class_s = loss_class(y_s_pred, y_s)
loss_domain_s = loss_domain(y_s_domain_pred, y_s_domain)
loss_domain_t = loss_domain(y_t_domain_pred, y_t_domain)
loss_recon_s = loss_ae(recon_s2, x_s2)
loss_recon_t = loss_ae(recon_t2, x_t2)
     
loss = loss_class_s + loss_recon_s + loss_recon_t + loss_domain_s + loss_domain_t

x_s2 and x_t2 are the graph features for the source and target documents with size (batch, feature_dim)

I will release the code for graph feature extraction shortly.