Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Code-annotation conversion method based on dual reinforcement learning

A technology of reinforcement learning and code conversion, applied in the field of automatic software development, can solve problems such as deviation and easy exposure, and achieve the effect of improving accuracy

Active Publication Date: 2020-06-16
DALIAN MARITIME UNIVERSITY
View PDF7 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Therefore, it is considered to use the dual model to solve the code-comment conversion problem. Previous researchers used the seq2seq model when dealing with the dual problem. However, seq2seq has certain limitations and is prone to exposure bias.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Code-annotation conversion method based on dual reinforcement learning
  • Code-annotation conversion method based on dual reinforcement learning
  • Code-annotation conversion method based on dual reinforcement learning

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0040] In order to make the technical solutions and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described below in conjunction with the drawings in the embodiments of the present invention:

[0041] Such as figure 1 A code-comment conversion method based on dual reinforcement learning is shown, a code-comment conversion method based on dual reinforcement learning:

[0042] Code conversion into annotation phase:

[0043] Step 1: Convert the code to a word vector representation.

[0044] Step 2: Use the LSTM bidirectional neural network to perform feature extraction on the sequence and structure information in the code word vector.

[0045] Step 3: Use the attention mechanism (Attention) to assign weights to each word in the word vector to obtain the weight of each word.

[0046] Step 4: Fusion each word vector and its weight in Hybrid.

[0047] Step 5: Calculate the probabilit...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a code-annotation conversion method based on dual reinforcement learning, and the method comprises the steps: converting a code into an annotation stage: building a code annotation generation model, converting the code into a word vector, and carrying out the feature extraction of a sequence and structural information in the code word vector through an LSTM bidirectional neural network; allocating weights to the words in the word vector by using an attention mechanism to obtain the weight of each word; fusing the word vectors and the weights thereof, and calculating theprobability that each word is selected by using a gradient descent method; carrying out dual constraint on the weight of each word and selecting the probability that each word; and calculating the matching degree of each sequence and standard annotations in the data set by using a BLEU evaluation method, and dividing by n to obtain an average value as a reward value of each word in reinforcementlearning.

Description

technical field [0001] The invention relates to the technical field of automatic software development, in particular to a code-comment conversion method based on dual reinforcement learning. Background technique [0002] Comments to code and code to comments are two key tasks in the field of automated software development. Converting comments into codes can generate codes (codes) based on natural language descriptions, while converting codes into comments automatically generates comments (comments) based on codes. Various neural network-based approaches have been proposed in previous studies to solve these two tasks separately. However, there is a specific intuitive correlation between annotation-to-code and code-to-comment conversion, and exploiting the relationship between these two tasks can improve the performance of both tasks. Considering the duality between the two tasks, a dual training framework is proposed in the paper [1] to simultaneously train annotation-to-co...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/40G06N3/04G06N3/08
CPCG06F8/40G06N3/084G06N3/045G06N3/044Y02D30/70
Inventor 陈荣唐文君
Owner DALIAN MARITIME UNIVERSITY
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products