Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mast-group/convolutional-attention
Repository for the code of the "A Convolutional Attention Network for Extreme Summarization of Source Code" paper
https://github.com/mast-group/convolutional-attention
convolutional-attention-network machine-learning ml4code
Last synced: 12 days ago
JSON representation
Repository for the code of the "A Convolutional Attention Network for Extreme Summarization of Source Code" paper
- Host: GitHub
- URL: https://github.com/mast-group/convolutional-attention
- Owner: mast-group
- License: bsd-3-clause
- Archived: true
- Created: 2016-05-07T00:20:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-19T09:27:39.000Z (over 8 years ago)
- Last Synced: 2024-07-31T07:15:24.222Z (3 months ago)
- Topics: convolutional-attention-network, machine-learning, ml4code
- Language: HTML
- Homepage:
- Size: 1.59 MB
- Stars: 119
- Watchers: 11
- Forks: 31
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-summ - [code
README
Convolutional Attention Network
===============
Code related to the paper:
```
@inproceedings{allamanis2016convolutional,
title={A Convolutional Attention Network for Extreme Summarization of Source Code},
author={Allamanis, Miltiadis and Peng, Hao and Sutton, Charles},
booktitle={International Conference on Machine Learning (ICML)},
year={2016}
}
```
For more information and the data of the paper, see [here](http://groups.inf.ed.ac.uk/cup/codeattention/).The project depends on Theano and uses Python 2.7.
Usage Instructions
======
To train the `copy_attention` model with the data use
```
> python copy_conv_rec_learner.py
```
were `D` is the embedding space dimenssion (128 in paper.)
The best model will be saved at `.pkl`To evaluate an existing model re-run with exactly the same parameteres except
for `` which should be zero.The following code will generate names from a pre-trained model and a test_file
with code examples.```python
model = ConvolutionalCopyAttentionalRecurrentLearner.load(model_fname)
test_data, original_names = model.naming_data.get_data_in_recurrent_copy_convolution_format(test_file, model.padding_size)
test_name_targets, test_code_sentences, test_code, test_target_is_unk, test_copy_vectors = test_dataidx = 2 # pick an example from test_file
res = model.predict_name(np.atleast_2d(test_code[idx]))
print "original name:", ' '.join(original_names[idx].split(','))
print "code:", ' '.join(test_code[idx])
print "generated names:"
for r,v in res:
print v, ' '.join(r)
```