Open source software project pull request prediction method based on deep learning model
By analyzing the code and submission information of open source software through deep learning models, potential pull requests are predicted, solving the problem of inefficiency in copy development and achieving efficient project collaboration and resource utilization.
Patent Information
- Application Number
- CN202510005033.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-01-02
AI Technical Summary
In open source software development, independent development within forks can lead to inefficiencies, especially when fork owners do not coordinate their work effectively, resulting in contributions being lost, rejected, or made redundant.
Through a method based on deep learning models, we analyze code commits and commit messages in open source software, predict which commits may evolve into pull requests, and combine statistical screening models and deep feature models to identify potential high-value contributions and provide reminders and warnings.
It improves the development efficiency of open source software projects, reduces redundancy and communication costs in team collaboration, optimizes the collaboration process, and ensures efficient project management.
Smart Images

Figure CN119902745B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a deep learning model-based open source software project pull request prediction method, belonging to the technical field of software development. BACKGROUND
[0002] Copy-and-pull collaboration development patterns have proven to be very successful in modern open source software development. Under this pattern, any developer interested in an open source project can first create his / her own copy of the source repository. Then, the developer can modify his / her own copy independently without relying on or obtaining permission from the source repository owner. If the developer wants to contribute changes back to the source repository, he / she can create a pull request to request the source repository maintainer to review and merge changes from the copy. Copies are essential to open source software development as they are an important source of contributions. Many copies are often considered a sign of the popularity of open source projects.
[0003] However, independent development in copies can lead to inefficiency, especially when copy owners do not effectively coordinate work. Studies have shown that there are problems of low efficiency in copy-and-pull development practices, such as lost, rejected or redundant contributions. SUMMARY
[0004] The present application provides a deep learning model-based open source software project pull request prediction method to address the problems and deficiencies in the prior art. By analyzing the development task workflow and collaboration mode in open source software, especially by predicting the generation of pull requests, the organization efficiency of project collaboration can be effectively evaluated, and the inefficient links can be identified to optimize the collaboration process. In this context, the deep learning model-based open source software project pull request prediction framework can predict which submissions may evolve into pull requests by intelligently analyzing code submissions, submission messages and code change content. This not only helps to improve development efficiency, but also reduces redundancy and communication costs in team collaboration, thereby promoting the efficient development of open source software projects.
[0005] The technical solution is a deep learning model-based open source software project pull request prediction method, which obtains normative statistical parameters by statistically analyzing copy modifications in open source software; and uses the statistical parameters to statistically screen and model;
[0006] The deep model is used to deeply model the text and code modification information of open source software;
[0007] Finally, the statistical screening model and the deep feature model are used to predict potential lost contributions in open source software, and based on the prediction results, further remind and warn potential contributions worthy of merging into the main repository.
[0008] The above method specifically includes the following steps:
[0009] Step 1: Obtain the required copy behavior flow data from open source projects. Assume that N open source project data is obtained from an open source software repository, and all open source projects are collectively represented by set Z, Z = {z1, z2, …zi, …,zN}, i = 1, …, N, where N is the number of open source projects, and zi represents the ith open source project in the obtained data set.
[0010] Step 2: Obtain the copy work records of all open source projects in set Z, and store them in database W after sorting by time.
[0011] Step 3: Obtain data from workflow database W, for the jth behavior flow record wij of the ith project in W, perform data cleaning on each copy modification record to remove invalid or duplicate pull requests. Perform text processing on each copy submission file, including tokenization, stop word removal, and stem extraction. Finally, obtain the set of all copy modification sequences, referred to as the set of all copy modification sequences S.
[0012] Step 4: Statistically analyze copy modifications in open source software to obtain a set of normative statistical parameters P. According to the parameter set P, threshold values such as pull jump ratio and pull commit ratio can be set to filter out copy modifications that meet the conditions. Next, select an appropriate statistical screening method (such as decision tree) to establish a statistical screening model TF, and use the screening model to extract the potential submission set using the set of all copy modification sequences S as input.
[0013] Step 5: Model the text and code modification information of open source software using a deep model, referred to as the deep feature model M. First, collect relevant text and code modification data from the version control system, including submission information Message and code difference Code Diff. Perform cleaning and preprocessing. Next, extract text features (such as TF-IDF and word vectors) and code features (such as syntax trees and complexity), and combine them to form a comprehensive feature set. Through a given set of feature sets, design a set of convolutional network-based recognition modules that meet their feature properties.
[0014] Step 6: Apply the statistical screening model TF obtained in step 4 and the deep feature model trained in step 5 to actual open source projects to predict pull requests based on code modifications and submission text, and collect feedback information to continuously iterate and improve the performance and applicability of the model.
[0015] The step 1 obtains the required copy behavior flow data from the open source platform, the data of each project obtained meets the data size scale, and the obtained copy modification information is filtered and integrated, and finally the process data includes project developer, copy development code and text and other information.
[0016] In step 2, for each open source project Zi in the set Z, all copy behavior flow records contained by each open source project are obtained, and are stored in the workflow database W after being sorted by time.
[0017] In step 3, for each copy behavior flow record wij, data preprocessing is performed to remove irrelevant redundant information, and only the specific description of the behavior, i.e. text modification, participant, code modification and modification time, is retained. The set of all copy modification sequences is obtained, which is called the set of all copy modification sequences S.
[0018] The step 4 specifically includes
[0019] Step 4.1: From the copy workflow database W, four key statistical parameters are defined to obtain the set of standard statistical parameters P, so as to understand how the contributors plan to select when creating a pull request. The four key statistical parameters of each fork wij include: the number of pull requests created by each fork; the number of commits contained in each pull request; the number of skipped commits; the proportion of skipped commits. By analyzing the commit records of the open source project, the specific values of the above key statistical parameters are calculated to provide key parameters for statistical screening modeling.
[0020] Step 4.2: Based on the statistical parameter set P obtained in step 4.1, a statistical screening process is designed to screen suitable commit sets to construct pull requests. In the statistical screening process of the whole commit set, multiple parameters are set, including the maximum number of commits and the maximum number of skipped commits, to balance the construction efficiency and coverage, and to ensure that the screened pull request combination is both efficient and comprehensive coverage of possible commits.
[0021] Step 4.3: The conclusions of steps 4.1 and 4.2 are used to screen the commit set of the whole copy, and the behavior record data in the screened copy commit, i.e. the sequence sij, is obtained. Since the copy modification records are arranged in chronological order, each copy behavior contains the following three-tuple information: (r, t, c), where r is the developer mark of the behavior, t is the label of the modification, and c is the detailed content of the modification.
[0022] The step 5 specifically includes
[0023] Step 5.1: Extract the relevant commit records from the triplets (r, t, c) obtained in step 4.3, including the commit information Message and the code difference Code Diff. Perform cleaning operations such as tokenization, stop word filtering, and lemmatization on the commit information to remove noise information; for the code difference, remove meaningless changes (such as comment modification, format adjustment), and parse the code structure into a syntax tree structure for easy analysis. Finally, align the text and code data to form a one-to-one corresponding cleaned feature dataset.
[0024] Step 5.2: According to step 5.1, in the model prediction process, the given potential pull request is composed of a combination of several commits, and the prediction task is modeled as a binary classification problem. For the content features Xc and statistical features Xs of each potential PR combination, feature extraction is performed respectively. The content features Xc include commit messages and code differences, and after being extracted by a pre-trained large language model, a 768-dimensional representation vector is obtained. In order to align the representation vector with the statistical feature dimension, the representation vector is reduced to 32 dimensions through a standard convolution module. The statistical features Xs are directly encoded into a 32-dimensional feature representation.
[0025] Step 5.3: According to step 5.2, obtain the vector representations Xc and Xs of the two kinds of features, align them and perform column-wise concatenation to form a comprehensive feature Z = [Xc, Xs] with a dimension of 64. The comprehensive feature is input into a 64-dimensional perception module to complete feature fusion. The fused feature is input into a fully connected layer to obtain the prediction output.
[0026] The above step 6 specifically includes the following steps:
[0027] Step 6.1: Use the already trained deep feature model to predict actual open source projects. For each new code commit, the model will generate a possible commit set to become a pull request prediction result based on the code modification and commit message (i.e. content features) in the commit and statistical features.
[0028] Step 6.2: Through feedback error labels or unsuccessful prediction objects, analyze these feedbacks to help identify the error types and improvement space of the model. For those main repositories that have not been timely submitted contributions, a warning reminder is given, indicating that there may be imminent lost contributions between these projects.
[0029] The present application has the following beneficial effects:
[0030] The open source software project pull request prediction method based on the deep learning model simulates the generation process of real contributions by deeply modeling the submission information in the open source software copy. Specifically, the application first analyzes the code changes and submission messages of the copy submission to mine the potential that can be converted into a pull request. Then, a statistical screening model TF is designed to screen the key submission subset in the submission history, so as to accurately capture the submissions that actually contribute to the project. This screening strategy can effectively filter out irrelevant or low-value submissions, improving the accuracy of the prediction. When constructing the identification framework of potential pull request contributions, the application combines the text features (such as submission messages, code comments, etc.) and code features (such as code differences, modification frequency, etc.) in the copy submission, and comprehensively analyzes them through a deep learning model to accurately identify which submissions may evolve into a pull request. The identification framework not only improves the efficiency of prediction, but also identifies potential contributions at the early stage of the project, providing valuable decision support for maintainers.
[0031] Compared with the traditional open source project management method, the Early pull request framework of the application has the following advantages: its early prediction capability enables the open source project to identify potential contributions earlier, thereby optimizing the management process of branches and pull requests. By accurately identifying high-value contributions, project maintainers can more efficiently organize code reviews and coordinate development tasks, thereby improving the collaboration efficiency of the project. In addition, since the framework is scalable, it can be applied to open source projects of different sizes and types, whether small independent projects or large complex projects, and can effectively improve the development and management efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0032] Fig. 1 The method flowchart of the embodiment of the application is shown in the figure.
[0033] Fig. 2 The method logic diagram of the embodiment of the application is shown in the figure. DETAILED DESCRIPTION
[0034] The application will be further illustrated below in conjunction with specific embodiments, which should be understood as merely illustrating the application and not limiting the scope of the application. After reading the application, those skilled in the art can make various modifications to the application, which fall within the scope defined by the claims attached hereto.
[0035] The hardware environment required for the method of the embodiment of the application includes a router or switch that can normally access a wide area network and a computer that can be normally used. The software environment is Python3.10.
[0036] As Figs. 1-2As shown, the open source software project pull request prediction method based on a deep learning model of the present application comprises the following steps:
[0037] Modeling the copy behavior statistical screening process of the open source project and the deep learning model-based open source software project pull request prediction framework.
[0038] Among them, in the step of modeling and clustering the work behavior process of the open source project, the statistical process based on key variables is used to model the pull request process of the open source copy, and the deep feature model is used to model the text and code comprehensive features submitted by the copy. Finally, the statistical screening model and the deep feature model are used to predict the potential lost contributions in the open source software, and based on the prediction results, further remind and warn the potential contributions worthy of merging into the main repository.
[0039] Step 1: Obtain the required copy behavior flow data from the open source project. Assume that N open source project data is obtained from the open source software repository, and all open source projects are represented by the set Z = {z1, z2, …zi, …,zN}, i = 1, …, N, where N is the number of open source projects, and zi represents the ith open source project in the obtained data set;
[0040] Step 2: Obtain the copy work records of all open source projects in set Z, and store them in database W (such as Oracle, MongoDB, etc.) after sorting by time;
[0041] Step 3: Obtain data from the workflow database W, and for the jth record wij of the ith project in W. Clean up each copy modification record to remove invalid or duplicate pull requests. Perform text processing on each copy submission file, including tokenization, stop word removal, and stem extraction. Finally, the set of copy modification sequences is S.
[0042] Step 4: Perform statistical analysis on the copy modifications in the open source software to generate a set of standard statistical parameters P, and use this set to screen the copy modifications. First, collect the submission records related to the copy from the version control system, including code change logs, timestamps, submitter information, etc. For these data, statistical indicators such as code modification line increase and decrease, submission frequency, and submission time interval are calculated. By calculating the pull jump ratio (defined as the ratio of the modification amount from the last pull to the current submission to the total modification amount) and the pull submission ratio (defined as the ratio of the number of submissions successfully converted into pull requests to the total number of submissions), the key features reflecting collaborative behavior are extracted. According to these statistical results, set reasonable thresholds for preliminary screening, such as filtering out high-frequency invalid modifications or low-efficiency collaborative submissions.
[0043] Step 4.1: In practice, the entire copy modification sequence S is input into the model as a model input, and the screening model is used to classify and prioritize the submission records to extract a set of submissions with potential pull request value. In order to optimize the model effect, the input data can be standardized and dimensionally reduced, and the parameters of the screening model can be optimized by cross-validation. Finally, the screened submission set can be used as the input of the subsequent deep model to improve the accuracy and efficiency of the potential pull request identification.
[0044] Step 5: Model the text and code modification information of open source software through a deep model, which is called a deep feature model M. First, collect relevant text and code modification data from the version control system, including submission information Message and code difference Code Diff, and perform cleaning and preprocessing to remove invalid changes and noise data. Then, extract text features (such as TF-IDF and word vectors) and code features (such as syntax tree representation, code complexity, and call relationship graph), and combine these features through feature fusion techniques to form a comprehensive feature set. On this basis, a set of convolutional network-based identification modules are designed and implemented, and the number of layers and feature fusion methods (such as weighted average, attention mechanism, etc.) are optimized to ensure that the network can efficiently capture the semantic association and structural pattern between text and code, thereby achieving accurate identification of potential pull requests.
[0045] Step 6: Apply the combined filter obtained in step 4 and the deep feature model trained in step 5 to actual open source projects to predict the quality and merging possibility of pull requests by analyzing code modifications and submission text. Use a modular integration framework to embed the model into the continuous integration process to achieve automated evaluation and real-time feedback. By collecting the feedback, continuously optimize the training data set and algorithm of the model to improve its applicability and prediction accuracy for different projects, and adjust the model parameters in a timely manner through performance monitoring to ensure its efficiency and stability in production environments.
[0046] When applying the open source software project pull request prediction framework based on deep learning model disclosed in the present application, first, a certain number of behavior event records of open source projects need to be collected, including code submission, pull request and related comment content. Then, use the deep feature model to model these behavior events to capture the potential collaboration patterns and code modification trends in the project. Then, through the prediction of pull requests, identify the efficient and inefficient collaboration patterns in the project.
[0047] One typical application scenario of the present application is to provide prediction and evaluation services for some open source projects. For example, for an open source project that gradually increases in size and faces a large number of development iteration needs, by analyzing the historical pull request and project collaboration mode, the organization and collaboration efficiency of the project can be evaluated. At the same time, based on the prediction results, a template project with efficient collaboration is provided for comparison to help the project team optimize the current development process. By referring to these efficient collaboration modes, the ongoing pull request and event processing can be effectively guided, and the development bottleneck caused by inefficient communication and collaboration can be avoided.
[0048] In the embodiment, step 1 obtains the required copy behavior process data from the open source platform, the data of each project obtained meets the data size, and the obtained copy modification information is filtered and integrated, and finally the process data includes project developers, copy development code and text and the like.
[0049] In step 2, for each open source project Zi in the set Z, all copy behavior process records contained by each open source project are obtained, and are stored in the database W after being sorted by time.
[0050] In step 3, for each copy behavior process record wij, data preprocessing is performed to remove irrelevant redundant information, and only the specific description of the behavior, i.e. text modification, participants, code modification, modification time and other related necessary information, is retained. Finally, the set of all copy modification sequences is obtained, which is referred to as the set of all copy modification sequences S.
[0051] Step 4 specifically includes
[0052] Step 4.1: From the copy workflow database W, four key statistical parameters are defined to obtain the set of standard statistical parameters P. The four key statistical parameters of each project copy include: the number of pull requests created by each Fork; the number of commits contained in each pull request; the number of skipped commits; and the proportion of skipped commits. By analyzing the commit records of the open source project, the specific values of the above parameters are calculated to provide key parameters for statistical screening modeling.
[0053] Step 4.2: Based on the statistical parameters P obtained in step 4.1, a statistical screening process is designed to screen suitable commit sets to construct pull requests. In this process, multiple parameters are set, including the maximum number of commits and the maximum number of skipped commits, to balance the construction efficiency and coverage range, and to ensure that the constructed pull request combination is both efficient and fully covers possible commits.
[0054] Step 4.3: Screen the entire copy of the submission set with the conclusion of Step 4.1, Step 4.2 to obtain a copy submission set that meets the TF model. Take out the behavior record data of the screened copy submission set, that is, the sequence sij. Since the copy modification record is arranged in chronological order, each copy behavior contains the following triple information: (r, t, c), where r is the developer mark of the behavior; t is the label of the modification; and c is the detailed content of the modification.
[0055] The above step 5 specifically includes
[0056] Step 5.1: Extract the relevant submission record from the triple (r, t, c) obtained in Step 4.3, including submission information Message and code difference Code Diff. Perform cleaning operations such as word segmentation, stop word filtering, and morphological restoration on the submission information to remove noise information; for the code difference, eliminate meaningless changes (such as comment modification, format adjustment), and parse the code structure into a syntax tree structure for easy analysis. Finally, align the text and code data to form a one-to-one corresponding cleaned feature data set.
[0057] Step 5.2: According to Step 5.1, in the model prediction process, the given potential pull request is composed of a combination of several submissions, and the prediction task is modeled as a binary classification problem. For the content features Xc and statistical features Xs of each potential PR combination, feature extraction is performed respectively. The content features Xc include submission messages and code differences, and after being extracted by a pre-trained large language model, a 768-dimensional representation vector is obtained. In order to align the representation vector with the statistical feature dimension, the representation vector is reduced to 32 dimensions through a standard convolution module. The statistical features Xs are directly encoded into a 32-dimensional feature representation.
[0058] Step 5.3: According to Step 5.2, obtain the vector representation of the two features Xc, Xs, align them and perform column-wise splicing to form a comprehensive feature Z = [Xc, Xs] with a dimension of 64. The comprehensive feature is input into a 64-dimensional perception module to complete feature fusion. The fused feature is input into a fully connected layer to obtain the prediction output.
[0059] The above step 6 specifically includes the following steps:
[0060] Step 6.1: Use the already trained deep feature model to predict actual open source projects. For each new code submission, the model will generate a possible submission set as a pull request prediction result based on the code modification and submission message (i.e., content features) in the submission and statistical features.
[0061] Step 6.2: By marking feedback errors or not successfully predicting objects, analyzing these feedback helps identify the error types of the model and the improvement space. For those main repositories that have not submitted contributions in time, a warning reminder is given, indicating that there may be contributions that will be lost between these projects.
Claims
1. A deep learning model-based open source software project pull request prediction method, characterized in that: The statistical parameters are obtained by counting the copy modifications in the open source software, and the statistical parameters are used for statistical screening modeling; The text and code modification information of the open source software is modeled by using a deep model; Finally, the statistical screening model and the deep feature model are used to predict the potential missing contributions in the open source software; The method comprises the following steps: Step 1: Obtain the required copy behavior flow data from the open source project, and obtain N open source project data from the open source software repository, all open source projects are represented by a set Z, Z = {z1, z2, …zi, …, zN}, i = 1, …, N, wherein N is the number of open source projects, and zi represents the ith open source project in the obtained data set; Step 2: Obtain the copy work record of all open source projects in the set Z, and store the sorted copy work record data in the work flow database W; Step 3: Obtain data from the work flow database W, and obtain the jth behavior flow record wij of the ith project in W, clean each copy modification record, remove invalid or duplicate pull requests, and process each copy submission file to obtain a set of copy modification sequences, referred to as the set of copy modification sequences S; Step 4: Count the copy modifications in the open source software to obtain the set of statistical parameters P; According to the parameter set P, set the threshold of the pull jump ratio and the pull submission ratio, and filter the copy modifications that meet the conditions; select a statistical screening method, establish a statistical screening model TF, and use the screening model to extract the potential submission set by inputting the set of copy modification sequences S; Step 5: Model the text and code modification information of the open source software by using a deep model, and the model is referred to as a deep feature model M; First, collect the relevant text and code modification data from the version control system, including the submission information Message and the code difference Code Diff data; then, extract the text features and code features, and combine them to form a comprehensive feature set; by giving a set of feature sets, a set of recognition modules based on convolutional network is designed according to the feature properties; Step 6: Apply the statistical screening model TF and the trained deep feature model to the actual open source project to predict the pull request based on the code modification and the submission text, and collect feedback information to continuously iterate and improve the performance and applicability of the model.
2. The open source software project pull request prediction method based on a deep learning model according to claim 1, characterized in that: In step 1, the required copy behavior flow data is obtained from the open source platform, the data of each project obtained meets the data size, and the obtained copy modification information is filtered and integrated, and finally the flow data includes project developers, copy development codes and text information.
3. The open source software project pull request prediction method based on a deep learning model according to claim 1, characterized in that: In step 2, for each open source project Zi in the set Z, all copy behavior flow records contained in each open source project are obtained, and are stored in the work flow database W in chronological order.
4. The open source software project pull request prediction method based on a deep learning model according to claim 1, characterized in that: The step 3 carries out data preprocessing on each copy behavior flow record wij in step 3, removes irrelevant redundant information, and only retains the specific description of the behavior, that is, the text modification, the participant, the code modification, and the modification time; a set of all copy modification sequences is obtained, which is referred to as a set of all copy modification sequences S.
5. The open source software project pull request prediction method based on a deep learning model according to claim 1, characterized in that: Step 4 specifically includes: Step 4.1: From the copy workflow database W, four key statistical parameters are defined to obtain a set of standard statistical parameters P; the four key statistical parameters of each project copy wij include: the number of pull requests created by each Fork; the number of commits contained in each pull request; the number of skipped commits; the proportion of skipped commits; by analyzing the commit records of the open source project, the specific values of the above key statistical parameters are calculated to provide key parameters for statistical screening modeling; Step 4.2: Based on the statistical parameter set P obtained in step 4.1, a statistical screening process is designed to screen the required commit set to construct the pull request; in the statistical screening process of the entire commit set, multiple parameters are set, including the maximum number of commits and the maximum number of skipped commits; Step 4.3: The commit set of the entire copy is screened to obtain the behavior record data in the screened copy commit, that is, the sequence sij; since the copy modification records are arranged in chronological order, each copy behavior contains the following three-tuple information: (r, t, c), wherein r is the developer mark of the behavior; t is the label of the modification; and c is the detailed content of the modification.
6. The open source software project pull request prediction method based on a deep learning model according to claim 5, characterized in that: Step 5 specifically includes: Step 5.1: The related commit records are extracted from the three-tuple (r, t, c), including the commit information Message and the code difference Code Diff; the commit information is cleaned to remove noise information; the code difference is removed and the code structure is parsed into a syntax tree structure; finally, the text and code data are aligned to form a one-to-one corresponding cleaned feature data set; Step 5.2: In the model prediction process, the given potential pull request is composed of a number of commits, and the prediction task is modeled as a binary classification problem; the content feature Xc and the statistical feature Xs of each potential PR combination are extracted respectively; the content feature Xc includes the commit message and the code difference, which is extracted by the pre-trained large language model to obtain the representation vector; in order to align the representation vector with the statistical feature dimension, the representation vector is reduced in dimension through a standard convolution module; the statistical feature Xs is directly encoded into the reduced feature representation; Step 5.3: According to step 5.2, the vector representations Xc and Xs of the two features are aligned and concatenated in column direction to form a comprehensive feature Z=[Xc, Xs], which is input into a perception module for feature fusion, and then the fused feature is input into a fully connected layer to obtain the prediction output.
7. The open source software project pull request prediction method based on a deep learning model according to claim 1, characterized in that: The above step 6 specifically includes the following steps: Step 6.1: Use the already trained deep feature model to make predictions on actual open source projects; for each new code submission, the model will generate a prediction of the set of possible submissions that could become pull requests based on the code modifications and commit messages in the submission and statistical features; Step 6.2: Analyze feedback from error markers or unsuccessful predictions to identify the types of errors in the model and areas for improvement; for those main repositories that have not been timely submitted contributions, send a warning reminder that there may be contributions that will be lost between these projects.
Citation Information
Patent Citations
Open source crowd-sourcing behavior mining and measuring method based on Markov model and entropy
CN115730910A
Validating code ownership of software components in a software development system
US20240427559A1