WO2020199345A1 - 一种基于GitHub的半监督异构软件缺陷预测算法 - Google Patents
一种基于GitHub的半监督异构软件缺陷预测算法 Download PDFInfo
- Publication number
- WO2020199345A1 WO2020199345A1 PCT/CN2019/090948 CN2019090948W WO2020199345A1 WO 2020199345 A1 WO2020199345 A1 WO 2020199345A1 CN 2019090948 W CN2019090948 W CN 2019090948W WO 2020199345 A1 WO2020199345 A1 WO 2020199345A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- supervised
- semi
- cost
- matrix
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
Definitions
- the invention relates to a software defect prediction algorithm, in particular to a semi-supervised heterogeneous software defect prediction algorithm based on GitHub.
- Software defect prediction is a research hotspot in the current software engineering data field. The hope is to be able to identify potential defective program modules in the project in the early stage of project development, and allocate sufficient test resources to such program modules to ensure that sufficient code review or unit testing can be carried out, and ultimately improve The purpose of software product quality.
- most research work focuses on the problem of predicting defects in the same project, that is, selecting part of the data set of the same project as the training set to build the model, and using the remaining unselected data as the test set to obtain the prediction ability of the model.
- the target project that requires defect prediction may be a newly started project, and there is not enough historical data to serve as a training set and a test set.
- Cross-project is to use training data from other projects to build predictive models and predict defects for a brand-new project.
- the value distribution of metric elements of different items has significant differences, and the data of defect prediction has the problem of category imbalance.
- the purpose of the present invention is to propose a semi-supervised heterogeneous software defect prediction algorithm based on GitHub in view of the defects in the prior art.
- the purpose is to provide a method for semi-supervised and heterogeneous problems when establishing defect prediction models.
- CKSCA cost-sensitive nuclear semi-supervised correlation analysis
- ccdp semi-supervised cross-company defect prediction
- a GitHub-based semi-supervised heterogeneous software defect prediction algorithm includes the following steps:
- Step (1) collect data and establish a database
- Step (2) data preprocessing, including data normalization and data filtering
- Step (3) match the source data and target data, and introduce unified measurement representation (UMR) and canonical correlation analysis (CCA);
- UMR unified measurement representation
- CCA canonical correlation analysis
- Step (4) semi-supervised discriminant analysis
- Step (5) nuclear semi-supervised discriminant analysis
- Step (6) cost-sensitive nuclear semi-supervised judgment analysis.
- the specific method of the step (1) is:
- the collected data includes item selection, feature extraction, and cleanup data sets.
- the item selection includes selecting 3 language tags (Python, Java, C) as keywords, and sorting tags by "most star", Twenty items were selected from the top of the sorted list.
- the data preprocessing in the step (2) uses min-max normalization. Given a metric x, the normalized value x′ is calculated as:
- the data filtering is a method for knn filters to filter cross-company data, using data filters instead of all cross-company data, selecting common attributes between the source and target cross-company projects, and selecting k nearest neighbors for each instance in the target data
- k 10 is used to represent k-nearest neighbor.
- step (3) matching the source data and the target data introduces the unified measurement representation (UMR) and the canonical correlation analysis method (CCA).
- UMR unified measurement representation
- CCA canonical correlation analysis method
- the CCA is used as the source and target project data to find a common space, Maximize the correlation between forecast data, use UMR technology to enable heterogeneous data to be compared, set with Is the source data and target data, here Is the i-th instance of X s , Ns and Nt are the number of instances in X s and X t , the instance in the source company is expressed as The instance in the target company is represented as Here, Means with The metric value corresponding to the jth metric of, d s and d t are the number of metrics in the source data and target data, and UMR is defined as follows:
- T is matrix or vector transpose
- C ss and C tt are internal company with Covariance matrix
- C st is cross-company with The covariance matrices of are defined as:
- the optimal projection or transformation is obtained and the inter-class distance is maximized at the same time to realize the maximization of inter-class recognition.
- the inter-class and intra-class scattering matrices are calculated as follows:
- S b is an inter-Matrix
- S w is the class of matrix
- u is the total sample mean vector
- u i is the mean vector of class i
- N i is the number of samples in class i
- It is the i-th sample of the k-th class, adding an adjacency graph to use unlabeled samples, looking for an optimal projection matrix w, separating the data from different classes, and making nearby samples closer. Therefore, semi-supervised
- the objective function of discriminant analysis is as follows:
- W is the projection matrix
- W T is the transpose of the projection matrix
- S b is the inter-class matrix
- S w is the intra-class matrix
- ⁇ is a trade-off parameter.
- N k (x j ) represents the set of k nearest neighbors of x j .
- the kernel semi-supervised discriminant analysis maps the original data to the high-dimensional kernel Hilbert space, and the mapping from ⁇ : R n ⁇ F in the feature space F is called a mapping function, such as: Gaussian kernel function And polynomial kernel It has been proved to be useful in previous work.
- a mapping function such as: Gaussian kernel function And polynomial kernel It has been proved to be useful in previous work.
- L is the Laplace matrix.
- the present invention proposes a cost-sensitive nuclear semi-supervised discrimination analysis (CKSDA) technology, which uses cost-sensitive learning technology to solve different misclassification costs and achieves the effect of defect prediction.
- CKSDA cost-sensitive nuclear semi-supervised discrimination analysis
- Figure 1 is a flow chart of the method of the present invention.
- this embodiment is based on GitHub's semi-supervised heterogeneous software defect prediction algorithm and includes the following steps:
- Step (1) Collect data to build your own database: first collect data on GitHub. Data collection consists of three examples: 1) project selection; 2) feature extraction; 3) clean up the data set.
- Project selection here we choose 3 language tags (Python, Java, C) as keywords, and the sort tag we choose is "most star”. Take "Top Programming Languages of 2017" as a reference. Because of this ranking, we only study projects written mainly in the most popular programming languages (Python, Java, and c) and then we filter out 20 projects from the top of the sorted list. Table 1 shows the number of instances of the 3 programming languages
- Metric data includes static code metrics of files, such as lines of code and average lines of comments.
- code metrics obtained from Scitools. These metrics cover a variety of source code attributes, such as code lines, cyclomatic complexity, coupling between objects, class methods, class variables, functions, instance methods and variable factors, variables, etc.
- Scitools These metrics cover a variety of source code attributes, such as code lines, cyclomatic complexity, coupling between objects, class methods, class variables, functions, instance methods and variable factors, variables, etc.
- Step (2) data preprocessing, including data normalization and data filtering: because the values of different software metrics usually have different sizes. When performing normalization, the magnitude and scale of the values are quite low. This normalization applies to source and target project data. .
- min-max normalization For example, given a metric x, the normalized value x′ is calculated as:
- a knn filter method for filtering cross-company data is proposed here.
- Using data filters to replace all cross-company data helps avoid examples that are not similar to existing problems.
- Step (3) matching the source data and target data, in order to effectively utilize all the characteristics between the source data and the target data, the unified measurement representation (UMR) and the canonical correlation analysis method (CCA) are introduced.
- UMR unified measurement representation
- CCA canonical correlation analysis method
- Is the source data and target data here Is the i-th instance of X s , Ns and Nt are the number of instances in X s and X t .
- the instance in the source company can be expressed as The instance in the target company can be expressed as Here, Means with The metric value corresponding to the jth metric, d s and d t are the number of metrics in the source data and target data. Then we define UMR as follows:
- CCA learning correlation subspace based on CCA.
- the purpose of CCA is to find P s and P t in two projection directions, which can maximize the linear correlation coefficient ⁇ between the source and target company data.
- the objective function of CCA can be defined as:
- T is matrix or vector transpose
- C ss and C tt are internal company with Covariance matrix
- C st is cross-company with The covariance matrix of, they are defined as:
- Step (4) semi-supervised discriminant analysis, its purpose is to find a projection to respect the discriminant structure inferred from the labeled data. And infer the inherent geometric structure from labeled and unlabeled data.
- M Ns+Nt is the number of all source and target instances.
- x 1 , x 2 ..., x m ⁇ R m belonging to class c By minimizing the intra-class distance, the optimal projection or transformation is obtained and the inter-class distance is maximized at the same time to realize the maximization of inter-class recognition.
- the inter-class and intra-class scattering matrix can be calculated as follows:
- u is the total sample mean vector
- u i is the mean vector of class i
- N i is the number of samples in class i
- J(w) is defined as follows:
- N k (x j ) represents the set of k nearest neighbors of x j .
- Step (5) nuclear semi-supervised discriminant analysis. Since semi-supervised discriminant analysis in step (4) is a linear method, it cannot accurately understand the nonlinear correlation between the source and the target.
- Step (6) cost-sensitive nuclear semi-supervised discriminant analysis, we construct a cost matrix.
- the cost-sensitive nuclear discriminant analysis algorithm and six semi-supervised cross-project defect prediction methods Ftct-MDS, LDS, RusTri, NSGLP, CKSDL, MSTrA and two supervised cross-projects Compare the defect prediction methods HDP-KS and CTKCCA. 14 projects in AEEEM, NASA, relink, SOFTlab group and GitHub were used as experimental data for comparative verification.
- the evaluation indicators of the predictive model include recall rate (pd), false alarm rate (pf), precision (precision) and accuracy (acc). These indicators can be represented by A, B, C, D defined in Table 3, as shown in Table 1:
- the AUC value Absolute Under Curve
- the NB, CC4.5, and CBBN algorithms can have better F-measure values on some projects, but the CMKEL proposed in this article can also have good F-measure values on most projects.
- AUC value the effect is better than the first three algorithms, indicating the superiority of the CMKEL algorithm, and indeed solves the problem of unbalanced data sets in software defect prediction and lack of historical data, and achieves the purpose of the present invention.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Stored Programmes (AREA)
Abstract
一种基于GitHub的半监督异构软件缺陷预测算法,包括以下步骤:首先是数据集收集,建立自己的数据库;对收集到的数据预处理;然后这里异构的数据处理,我们引入增强版的典型关联分析方法,它是由统一度量表示(UMR)和典型关联分析(CCA)组成;最后我们加入了代价敏感的核半监督判别方法,从而实现了基于GitHub的半监督异构软件缺陷预测算法,所述算法解决了软件缺陷预测中数据异构的问题以及首次提出了代价敏感的核半监督鉴别分析(CKSDA)技术,利用代价敏感的学习技术,解决不同的错误分类代价,实现了缺陷预测效果。
Description
本发明涉及软件缺陷预测算法,具体涉及一种基于GitHub的半监督异构软件缺陷预测算法。
软件缺陷预测是当前软件工程数据领域中的一个研究热点。其希望就是能够在项目开发的早期阶段,预先识别出项目内的潜在缺陷程序模块,并且对这类的程序模块分配足够的测试资源来确保可以进行充分的代码审查或者是单元测试,最终达到提高软件产品质量的目的。目前大部分研究工作都集中关注同项目缺陷预测问题,即选择同一项目的部分数据集作为训练集来构建模型,并用剩余未选择的数据作为测试集来获得模型的预测能力。然而在实际的软件开发场景中,需要进行缺陷预测的目标项目可能是一个新启动的项目,并没有足够的历史数据来作为训练集和测试集。由于历史数据的缺少研究者们开始关注跨项目软件缺陷预测的问题,跨项目就是使用其他项目的训练数据来构建预测模型,并对一个全新项目进行缺陷预测。在大部分的情况下,不同项目的度量元取值分布具有显著的差异性,缺陷预测的数据存在类别不平衡问题。
在软件测试中,软件缺陷预测是非常重要的,它可以利用历史缺陷数据学习预测模型。当没有足够的历史缺陷数据建立准确的预测模型时,跨公司缺陷预测(Ccdp)和半监督缺陷预测(Ssdp)是两种可行的方法。来自开放源码项目(OSP)托管平台(如GitHub)的现有开放源码未标记数据就足够了,这些数据通常是异构的。目前,对于如何利用开放源码项目(OSP)的大量未标记异构数据进行缺陷预测模型的研究还很少。
发明内容
本发明的目的在于:针对现有技术存在的缺陷,提出一种基于GitHub的半监督异构软件缺陷预测算法,目的在于建立缺陷预测模型时,为半监督问题和异构问题提供一种方法,解决异构问题,同时提出了一种代价敏感的核半监督相关分析(CKSCA)方法来解决半监督的跨公司缺陷预测(ccdp)问题。
为达到上述目的,本发明是通过以下技术方案来实现的:
一种基于GitHub的半监督异构软件缺陷预测算法包括以下步骤:
步骤(1)、收集数据建立数据库;
步骤(2)、数据预处理,包括数据规范化和数据过滤;
步骤(3)、匹配源数据和目标数据,引入统一度量表示(UMR)和典型相关分析方法(CCA);
步骤(4)、半监督判别分析;
步骤(5)、核半监督判别分析;
步骤(6)、代价敏感核半监督判分析。
优选地,所述步骤(1)的具体做法是:
在GitHub上收集数据,所述收集数据包括项目选择、特征提取和清理数据集,所述项目选择包括选择3个语言标记(Python,Java,C)作为关键字,由“most star”排序标记,从排序列表的顶部筛选出20个项目,所述特征提取包括使用“Understand”工具,提取代码度量,所述代码度量为文件静态代码度量,使用Scitools获得代码度量标准,所述清理数据集包括采用人工筛选对缺失值和显著误差值进行筛选。
优选地,所述步骤(2)中数据预处理使用min-max规范化,给定一个度量x,规范化值x′,计算为:
所述数据过滤为knn滤波器过滤跨公司数据的方法,使用数据筛选器代替所有跨公司数据,选择源和目标跨公司项目之间的公共属性,对于目标数据中的每个实例,选择k近邻来度量相似度,使用常见的特性进行过滤,获得与目标数据集相似的源数据集的筛选数据集,这里使用k=10来表示k-最近的邻居。
优选地,在步骤(3)中匹配源数据和目标数据引入统一度量表示(UMR)和典型相关分析方法(CCA),在UMR的基础上,利用CCA为源和目标项目的数据寻找共同空间,使得预测数据之间的相关性最大化,利用UMR技术来使异构数据能够被比较,设定
和
是源数据和目标数据,这里
是X
s的第i个实例,Ns和Nt是在X
s和X
t的实例数,源公司中的实例表示为
目标公司中的实例表示为
这里,
表示与
的第j度量相对应的度量值,d
s和d
t是源数据和目标数据中的度量数,则UMR定义如下:
其中
是包含源数据集特定度量的X
s中的数据,
是包含目标数据集特定度量的X
t中的数据,0
s和0
t是源数据与目标数据中的全零矩阵,目的是为了补全维度,并且
在源数据中,而
在目标数据中,R为实数集,加入基于CCA的学习相关子空间,寻找两个投影方向的P
s,P
t,最大化源与目标公司数据之间的线性相关系数ρ,则CCA的目标函数定义为:
优选地,在步骤(4)中半监督判别分析为以尊重从标记数据中推断出的判别结构,以及从标记数据和未标记数据推断内在的几何结构,设定X=[x
1,x
2,...x
M]=[X
s+,X
T+]是投影样本矩阵,M=Ns+Nt是所有源实例和目标实例的数目,一组样本x
1,x
2...,x
m∈R
m属于c类,通过最小化类内距离,得到最优投影或变换和同时最大化类间距离,实现类间识别的最大化,类间和类内散射矩阵按以下方式计算:
其中S
b是类间矩阵,S
w是类内矩阵,u是总样本平均向量,u
i是第i类的平均向量,N
i是第i类的样本数,
是第k类的第i样本,加入一个邻接图来使用未标记样本,寻找一个最优的投影矩阵w,将数据从不同的类中分离出来,同时使附近的样本更加接近,因此,半监督判别分析的目标函数如下所示:
其中,W是投影矩阵,W
T是投影矩阵的转置,S
b是类间矩阵,S
w是类内矩阵,α是一个权衡参数,构造邻接图来估计样本的内在几何结构,J(w)定义如下:
定义的相应的权矩阵G:
其中,N
k(x
j)表示x
j的k近邻集合。
优选地,在步骤(5)中核半监督判别分析将原始数据映射到高维核Hilbert空间中,由φ:R
n→F映射在特征空间F中称为映射函数,如:
高斯核函数
和多项式核
在以前的工作中被证明是有用的,设定一个非线性映射函数φ(·)通过N*N核矩阵K=[K
ij]定义,
则数据矩阵:
φ=[φ(x
1),φ(x
2),...,φ(x
m)]
(15
)
那么公式(9)和公式(10)可以改写为:
优选地,在步骤(6)中代价敏感核半监督判别分析,构造一个代价矩阵,如下所示,Cost是代价函数,元素代价(i,j)(i,j∈1,2…c)指示将第I类中的实例分类为第I类的代价值,将缺陷类表示为1,而无缺陷类表示为2,成本(1,1)=0和成本(2,2)=0,因为正确的分类不会导致任何成本,
代价矩阵
使用函数f(i)来描述第i类的权重,定义为
结合有价值的代价信息,提出了一种对代价敏感的核判别分析方法,下面对代价敏感的半监督缺陷分析优化问题如下,
是类间散度;
是类内散度;
按照代数公式我们得到目标函数优化后:
其中,L是拉普拉斯矩阵。
本发明提出了代价敏感的核半监督鉴别分析(CKSDA)技术,利用代价敏感的学习技术,解决不同的错误分类代价,实现了缺陷预测效果。
图1是本发明的方法流程图。
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
实施例1
如图1所示,本实施例基于GitHub的半监督异构软件缺陷预测算法,包括以下步骤:
步骤(1)、收集数据建立自己的数据库:首先要在GitHub上收集数据,数据收集由三个实例组成1)项目选择;2)特征提取;3)清理数据集。对于项目选择,这里我们选择了3个语言标记(Python,Java,C)作为关键字,我们选择的排序标记是“most star”。将“2017年顶级编程语言”作为参考。由于这个排名,我们只研究主要用最流行的编程语言编写的项目(Python、Java和c)然后我们从排序列表的顶部筛选出20个项目。表1显示了3种编程语言的实例数
表1
不同编程语言的数目
对于特征提取,这里我们用一款叫做“Understand”商业工具,来计算代码度量。
度量数据包括文件的静态代码度量,例如代码行、注释的平均行。我们使用了从Scitools获得的代码度量标准。这些度量涵盖了各种源代码属性,如代码行、圈复杂度、对象之间的耦合、类方法、类变量、函数、实例方法和可变因素,变数等。最后我们就要清理数据,这里我们采用人工筛选的方法,对缺失值和显着误差值进行筛选。例如,如果实例中有一个值丢失或明显错误,我们将其替换为相应的度量值的平均值。
步骤(2)、数据预处理,其中包括数据规范化和数据过滤:因为不同软件度量的值通常有不同的大小。当执行归一化时,值的大小和缩放到相当低的值。这种规范化适用于源和目标项目数据。。我们使用min-max规范化。例如,给定一个度量x,规范化值x′,计算为:
对于数据过滤,这里提出了knn滤波器过滤跨公司数据的方法,使用数据筛选器代替所有跨公司数据有助于避免与现有问题不相似的示例。首先选择源和目标跨公司项目之间的公共属性,对于目标数据中的每个实例,我们选择k近邻来度量相似度。我们使用常见的特性进行过滤,我们的预期结果是获得与目标数据集相似的源数据集的筛选数据集。这里使用k=10来表示k-最近的邻居。
步骤(3)、匹配源数据和目标数据,为了有效地利用源数据和目标数据之间的所有特性,引入了统一度量表示(UMR)和典型相关分析方法(CCA)。在UMR的基础上,利用CCA为源和目标项目的数据寻找共同空间,使得预测数据之间的相关性最大化。请注意,UMR适用于异构源和目标数据,以最大限度地提高源数据和目标数据之间的相关性,我们利用UMR技术来使异构数据能够被比较。假设
和
是源数据和目标数据,这里
是X
s的第i个实例,Ns和Nt是在X
s和X
t的实例数。源公司中的实例可以表示为
目标公司中的实例可以表示为
这里,
表示与
的第j度量相对应的度量值,d
s和d
t是源数据和目标数据中的度量数。则UMR我们定义如下:
其中
是包含源数据集特定度量的X
s中的数据,
是包含目标数据集特定度量的X
t中的数据。并且
在源数据中,而
在目标数据中。然后我们加入基于CCA的学习相关子空间,CCA的目的是寻找两个投影方向的P
s,P
t,可以最大化源与目标公司数据之间的线性相关系数ρ。则CCA的目标函数可以定义为:
步骤(4)、半监督判别分析,它的目的是寻找一个投影,以尊重从标记数据中推断出的判别结构。以及从标记数据和未标记数据推断内在的几何结构。假设X=[x
1,x
2,...x
M]=[X
s+,X
T+]是投影样本矩阵。M=Ns+Nt是所有源实例和目标实例的数目。现在我们有一组样本x
1,x
2...,x
m∈R
m属于c类。通过最小化类内距离,得到最优投影或变换和同时最大化类间距离,实现类间识别的最大化。类间和类内散射矩阵可以按以下方式计算:
其中u是总样本平均向量,u
i是第i类的平均向量,N
i是第i类的样本数,
是第k类的第i样本。我们加了一个邻接图来使用未标记样本。半监督判别分析的目的是寻找一个最优的投影矩阵w,它能最好地将数据从不同的类中分离出来,同时使附近的样本更加接近,因此,半监督判别分析的目标函数如下所示:
α是一个权衡参数,我们构造了邻接图来估计样本的内在几何结构,J(w)定义如下:
定义的相应的权矩阵G:
其中,N
k(x
j)表示x
j的k近邻集合。
步骤(5)、核半监督判别分析,由于步骤(4)中半监督判别分析是一种线性方法,它不能准确地了解源与目标之间的非线性相关性。我们将原始数据映射到高维核Hilbert空间中。我们考虑由φ:R
n→F映射在特征空间F中的问题,称为映射函数,如:
则数据矩阵:
φ=[φ(x
1),φ(x
2),...,φ(x
m)] (15)
那么公式(9)和公式(10)可以改写为:
步骤(6)、代价敏感核半监督判别分析,我们构造了一个代价矩阵。在表2中,元素代价(i,j)(i,j∈1,2…c)指示将第I类中的实例分类为第I类的代价值。由于软件缺陷预测中有两类,所以我们将缺陷类表示为1,而无缺陷类表示为2,成本(1,1)=0和成本(2,2)=0,因为正确的分类不会导致任何成本。
表2
代价矩阵
我们使用函数f(i)来描述第i类的权重,定义为
结合有价值的代价信息,提出了一种对代价敏感的核判别分析方法。下面对代价敏感的半监督缺陷分析优化问题如下,
是类间散度;
是类内散度。
按照代数公式我们得到目标函数优化后:
为验证本算法是否有很好的优越性,将对代价敏感的核判别分析算法与六种半监督跨项目缺陷预测方法Ftct-MDS、LDS、RusTri、NSGLP、CKSDL、MSTrA和两个监督跨项目缺陷预测方法HDP-KS,CTKCCA进行比较。分别在AEEEM、NASA、relink、SOFTlab小组和GitHub的14个项目作为实验数据进行对比验证。
预测模型的评估指标有召回率(pd),误报率(pf),查准率(precision)和精确度(acc)。这些指标能够通过表3定义的A,B,C,D来表示,如表1所示:
表3混淆矩阵
被预测为缺陷 | 被预测为无缺陷 | |
缺陷模块 | A | B |
无缺陷模块 | C | D |
召回率(pd):正确预测为有缺陷的模块数与真实有缺陷的模块数的比值,即pd=A/(A+B),该比值对软件缺陷预测来说很重要,因为预测模型就是为了找出有缺陷的模块。查准率(precision):正确被预测为有缺陷的模块数与预测为有缺陷模块数的比值,即precision=A/(A+C),该比值评估的是模型预测的正确程度。
主要采用两个综合性能指标:F-measure指标就是将pd与precision结合起来评价,即F-measure=2*pd*precision/(pd+precision)。AUC值(Area Under Curve)被定义为ROC曲线下的面积,使用AUC值可以评估二分类问题分类效果的优劣。F-measure值和AUC值的数值越为大表示软件缺陷预测模型的预测性能越好。
为了验证代价敏感系数的大小是否对模型有影响,我们设置了μ=1,5,10,15,20,观察代价敏感系数对实验的影响。在AEEEM数据集做实验,实验结果为表4,其中μ=1表示没有引入代价敏感系数。
表4不同代价敏感系数下的AUC值
从表4中的实验结果可以看出:当μ>1时AUC值要比μ=1高,说明引入代价敏感系数提高了预测的效果;随着μ值的增大,AUC的值也在增长,但是当μ>15时,AUC值开始下降,说明代价敏感系数并不是越大越好,当μ=15时,CMKEL算法能达到很好的效果。
为了验证本文的算法在几个对比算法里面是否有很好的性能,分别在NASA和AEEEM两个数据库做实验,实验结果为表3所示,在实验结果中将F-measure值表示成F值。
表3对比算法实验结果
通过以上实验可以看出:NB,CC4.5,CBBN算法在某些项目上面能够有比较好的F-measure值,但是本文提出的CMKEL在大部分项目上能同时有很好的F-measure值,AUC值,效果要比前三种算法要好,表明了CMKEL算法的优越性,确实解决了软件缺陷预测中数据集有类别不平衡,历史数据缺少的问题,达到了本发明的目的。
上述实施例仅供说明本发明之用,而并非是对本发明的限制,有关技术领域的普通技术人员,在不脱离本发明范围的情况下,还可以作出各种变化和变型,因此所有等同的技术方案也应属于本发明的范畴,本发明的专利保护范围应由各权利要求限定。
Claims (7)
- 一种基于GitHub的半监督异构软件缺陷预测算法,其特征在于,所述基于GitHub的半监督异构软件缺陷预测算法包括以下步骤:步骤(1)、收集数据建立数据库;步骤(2)、数据预处理,包括数据规范化和数据过滤;步骤(3)、匹配源数据和目标数据,引入统一度量表示(UMR)和典型相关分析方法(CCA);步骤(4)、半监督判别分析;步骤(5)、核半监督判别分析;步骤(6)、代价敏感核半监督判分析。
- 根据权利要求1所述的一种基于GitHub的半监督异构软件缺陷预测算法,其特征在于,所述步骤(1)的具体做法是:在GitHub上收集数据,所述收集数据包括项目选择、特征提取和清理数据集,所述项目选择包括选择3个语言标记(Python,Java,C)作为关键字,由“most star”排序标记,从排序列表的顶部筛选出20个项目,所述特征提取包括使用“Understand”工具,提取代码度量,所述代码度量为文件静态代码度量,使用Scitools获得代码度量标准,所述清理数据集包括采用人工筛选对缺失值和显著误差值进行筛选。
- 根据权利要求1所述的一种基于GitHub的半监督异构软件缺陷预测算法,其特征在于,在步骤(3)中匹配源数据和目标数据引入统一度量表示(UMR)和典型相关分析方法(CCA),在UMR的基础上,利用CCA为源和目标项目的数据寻找共同空间,使得预测数 据之间的相关性最大化,利用UMR技术来使异构数据能够被比较,设定 和 是源数据和目标数据,这里 是X s的第i个实例,Ns和Nt是在X s和X t的实例数,源公司中的实例表示为 目标公司中的实例表示为 这里, 表示与 的第j度量相对应的度量值,d s和d t是源数据和目标数据中的度量数,则UMR定义如下:其中 是包含源数据集特定度量的X s中的数据, 是包含目标数据集特定度量的X t中的数据,0 s和0 t是源数据与目标数据中的全零矩阵,目的是为了补全维度,并且 在源数据中,而 在目标数据中,R为实数集,加入基于CCA的学习相关子空间,寻找两个投影方向的P s,P t,最大化源与目标公司数据之间的线性相关系数ρ,则CCA的目标函数定义为:
- 根据权利要求1所述的一种基于GitHub的半监督异构软件缺陷预测算法,其特征在于,在步骤(4)中半监督判别分析为以尊重从标记数据中推断出的判别结构,以及从标记数据和未标记数据推断内在的几何结构,设定X=[x 1,x 2,...x M]=[X s+,X T+]是投影样本矩阵,M=Ns+Nt是所有源实例和目标实例的数目,一组样本x 1,x 2...,x m∈R m属于c类,通过最小化类内距离,得到最优投影或变换和同时最大化类间距离,实现类间识别的最大化,类间和类内散射矩阵按以下方式计算:其中S b是类间矩阵,S w是类内矩阵,u是总样本平均向量,u i是第i类的平均向量,N i是第i类的样本数, 是第k类的第i样本,加入一个邻接图来使用未标记样本,寻找一个最优的投影矩阵w,将数据从不同的类中分离出来,同时使附近的样本更加接近,因此,半监督判别分析的目标函数如下所示:其中,W是投影矩阵,W T是投影矩阵的转置,S b是类间矩阵,S w是类内矩阵,α是一个权衡参数,构造邻接图来估计样本的内在几何结构,J(w)定义如下:定义的相应的权矩阵G:其中,N k(x j)表示x j的k近邻集合。
- 根据权利要求1所述的一种基于GitHub的半监督异构软件缺陷预测算法,其特征在于,在步骤(6)中代价敏感核半监督判别分析,构造一个代价矩阵,如下所示,Cost是代价函数,元素代价(i,j)(i,j∈1,2…c)指示将第I类中的实例分类为第I类的代价值,将缺陷类 表示为1,而无缺陷类表示为2,成本(1,1)=0和成本(2,2)=0,因为正确的分类不会导致任何成本,代价矩阵使用函数f(i)来描述第i类的权重,定义为结合有价值的代价信息,提出了一种对代价敏感的核判别分析方法,下面对代价敏感的半监督缺陷分析优化问题如下,是类间散度;是类内散度;按照代数公式我们得到目标函数优化后:其中,L是拉普拉斯矩阵。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
ZA2021/00183A ZA202100183B (en) | 2019-04-02 | 2021-01-07 | Github-based semi-supervised heterogeneous software defect prediction algorithm |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910261507.5A CN110008584B (zh) | 2019-04-02 | 2019-04-02 | 一种基于GitHub的半监督异构软件缺陷预测方法 |
CN201910261507.5 | 2019-04-02 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020199345A1 true WO2020199345A1 (zh) | 2020-10-08 |
Family
ID=67169426
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/090948 WO2020199345A1 (zh) | 2019-04-02 | 2019-06-12 | 一种基于GitHub的半监督异构软件缺陷预测算法 |
Country Status (3)
Country | Link |
---|---|
CN (1) | CN110008584B (zh) |
WO (1) | WO2020199345A1 (zh) |
ZA (1) | ZA202100183B (zh) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112529037A (zh) * | 2020-11-06 | 2021-03-19 | 重庆恢恢信息技术有限公司 | 基于大数据分析建筑工地建设优化方法 |
CN113127342A (zh) * | 2021-03-30 | 2021-07-16 | 广东电网有限责任公司 | 基于电网信息系统特征选择的缺陷预测方法及装置 |
CN113723679A (zh) * | 2021-08-27 | 2021-11-30 | 暨南大学 | 基于代价敏感深度级联森林的饮用水质预测方法及系统 |
CN113985853A (zh) * | 2021-11-01 | 2022-01-28 | 浙江大学 | 一种基于数据依赖核判别分析的工业过程可视化监控方法 |
CN114168478A (zh) * | 2021-12-13 | 2022-03-11 | 东北大学 | 一种基于多图多标记学习的软件Bug检测方法 |
CN114297054A (zh) * | 2021-12-17 | 2022-04-08 | 北京交通大学 | 一种基于子空间混合抽样的软件缺陷数目预测方法 |
CN114924962A (zh) * | 2022-05-17 | 2022-08-19 | 北京航空航天大学 | 一种跨项目软件缺陷预测数据选择方法 |
CN114936597A (zh) * | 2022-05-20 | 2022-08-23 | 电子科技大学 | 一种局部信息增强子空间真假目标特征提取方法 |
CN115858209A (zh) * | 2022-11-17 | 2023-03-28 | 北京航空航天大学 | 基于信息保留协同优化的异构跨项目软件缺陷预测方法 |
CN114168478B (zh) * | 2021-12-13 | 2024-05-28 | 东北大学 | 一种基于多图多标记学习的软件Bug检测方法 |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111881048B (zh) * | 2020-07-31 | 2022-06-03 | 武汉理工大学 | 一种跨项目软件老化缺陷预测方法 |
CN112099353B (zh) * | 2020-09-09 | 2021-12-28 | 浙江大学 | 基于散度约束核判别分析的连铸坯皮下夹渣缺陷预报方法 |
CN114356641B (zh) * | 2022-03-04 | 2022-05-27 | 中南大学 | 一种增量式的软件缺陷预测方法、系统、设备及存储介质 |
CN115269377B (zh) * | 2022-06-23 | 2023-07-11 | 南通大学 | 一种基于优化实例选择的跨项目软件缺陷预测方法 |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7607046B1 (en) * | 2005-05-06 | 2009-10-20 | Sun Microsystems, Inc. | System for predicting and preventing escalations |
CN106201871A (zh) * | 2016-06-30 | 2016-12-07 | 重庆大学 | 基于代价敏感半监督的软件缺陷预测方法 |
CN106991049A (zh) * | 2017-04-01 | 2017-07-28 | 南京邮电大学 | 一种软件缺陷预测方法及预测系统 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016172367A1 (en) * | 2015-04-21 | 2016-10-27 | UberGrape GmbH DBA ChatGrape | Systems and methods for integrating external resources from third-party services |
GB201620820D0 (en) * | 2016-12-07 | 2017-01-18 | Univ Oxford Innovation Ltd | Characterisation of dynamical statistical systems |
CN108710576B (zh) * | 2018-05-30 | 2021-08-10 | 浙江工业大学 | 基于异构迁移的数据集扩充方法及软件缺陷预测方法 |
-
2019
- 2019-04-02 CN CN201910261507.5A patent/CN110008584B/zh active Active
- 2019-06-12 WO PCT/CN2019/090948 patent/WO2020199345A1/zh active Application Filing
-
2021
- 2021-01-07 ZA ZA2021/00183A patent/ZA202100183B/en unknown
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7607046B1 (en) * | 2005-05-06 | 2009-10-20 | Sun Microsystems, Inc. | System for predicting and preventing escalations |
CN106201871A (zh) * | 2016-06-30 | 2016-12-07 | 重庆大学 | 基于代价敏感半监督的软件缺陷预测方法 |
CN106991049A (zh) * | 2017-04-01 | 2017-07-28 | 南京邮电大学 | 一种软件缺陷预测方法及预测系统 |
Non-Patent Citations (2)
Title |
---|
JING, XIAOYUAN ET AL.: "Heterogeneous Cross-Company Defect Prediction by Unified Metric Representation and CCA-Based Transfer Learning", 2015 10TH JOINT MEETING ON FOUNDATION OF SOFTWARE, 31 August 2015 (2015-08-31), XP055740032, DOI: 20191205183006A * |
LINAG, TIANCHAO: "An Artificial Immune Based Naïve Bayes Model for Software Defect Predict", INFORMATION SCIENCE AND TECHNOLOGY, CHINESE MASTER’S THESES FULL-TEXT DATABASE, no. 5, 15 May 2016 (2016-05-15), DOI: 20191205182612A * |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112529037A (zh) * | 2020-11-06 | 2021-03-19 | 重庆恢恢信息技术有限公司 | 基于大数据分析建筑工地建设优化方法 |
CN113127342B (zh) * | 2021-03-30 | 2023-06-09 | 广东电网有限责任公司 | 基于电网信息系统特征选择的缺陷预测方法及装置 |
CN113127342A (zh) * | 2021-03-30 | 2021-07-16 | 广东电网有限责任公司 | 基于电网信息系统特征选择的缺陷预测方法及装置 |
CN113723679A (zh) * | 2021-08-27 | 2021-11-30 | 暨南大学 | 基于代价敏感深度级联森林的饮用水质预测方法及系统 |
CN113723679B (zh) * | 2021-08-27 | 2024-04-16 | 暨南大学 | 基于代价敏感深度级联森林的饮用水质预测方法及系统 |
CN113985853A (zh) * | 2021-11-01 | 2022-01-28 | 浙江大学 | 一种基于数据依赖核判别分析的工业过程可视化监控方法 |
CN113985853B (zh) * | 2021-11-01 | 2024-04-26 | 浙江大学 | 一种基于数据依赖核判别分析的工业过程可视化监控方法 |
CN114168478A (zh) * | 2021-12-13 | 2022-03-11 | 东北大学 | 一种基于多图多标记学习的软件Bug检测方法 |
CN114168478B (zh) * | 2021-12-13 | 2024-05-28 | 东北大学 | 一种基于多图多标记学习的软件Bug检测方法 |
CN114297054B (zh) * | 2021-12-17 | 2023-06-30 | 北京交通大学 | 一种基于子空间混合抽样的软件缺陷数目预测方法 |
CN114297054A (zh) * | 2021-12-17 | 2022-04-08 | 北京交通大学 | 一种基于子空间混合抽样的软件缺陷数目预测方法 |
CN114924962A (zh) * | 2022-05-17 | 2022-08-19 | 北京航空航天大学 | 一种跨项目软件缺陷预测数据选择方法 |
CN114924962B (zh) * | 2022-05-17 | 2024-05-31 | 北京航空航天大学 | 一种跨项目软件缺陷预测数据选择方法 |
CN114936597B (zh) * | 2022-05-20 | 2023-04-07 | 电子科技大学 | 一种局部信息增强子空间真假目标特征提取方法 |
CN114936597A (zh) * | 2022-05-20 | 2022-08-23 | 电子科技大学 | 一种局部信息增强子空间真假目标特征提取方法 |
CN115858209B (zh) * | 2022-11-17 | 2023-06-20 | 北京航空航天大学 | 基于信息保留协同优化的异构跨项目软件缺陷预测方法 |
CN115858209A (zh) * | 2022-11-17 | 2023-03-28 | 北京航空航天大学 | 基于信息保留协同优化的异构跨项目软件缺陷预测方法 |
Also Published As
Publication number | Publication date |
---|---|
ZA202100183B (en) | 2021-08-25 |
CN110008584A (zh) | 2019-07-12 |
CN110008584B (zh) | 2020-11-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020199345A1 (zh) | 一种基于GitHub的半监督异构软件缺陷预测算法 | |
US9489446B2 (en) | Computer-implemented system and method for generating a training set for use during document review | |
CN106201871A (zh) | 基于代价敏感半监督的软件缺陷预测方法 | |
CN107820620A (zh) | 用于缺陷分类的方法和系统 | |
CN106295692A (zh) | 基于降维与支持向量机的产品早期故障根原因识别方法 | |
Liu et al. | Unsupervised segmentation and elm for fabric defect image classification | |
CN112756759B (zh) | 点焊机器人工作站故障判定方法 | |
CN111338950A (zh) | 一种基于谱聚类的软件缺陷特征选择方法 | |
Haghighi et al. | Applying mining schemes to software fault prediction: A proposed approach aimed at test cost reduction | |
CN103793694A (zh) | 一种基于多特征空间稀疏分类器的人脸识别方法 | |
Hsu | Clustering ensemble for identifying defective wafer bin map in semiconductor manufacturing | |
Jeong et al. | A systemic approach to exploring an essential patent linking standard and patent maps: Application of generative topographic mapping (GTM) | |
CN107016416B (zh) | 基于邻域粗糙集和pca融合的数据分类预测方法 | |
Keya et al. | Comparison of different machine learning algorithms for detecting bankruptcy | |
Maletzke et al. | The Importance of the Test Set Size in Quantification Assessment. | |
CN114610924A (zh) | 基于多层分类识别模型的商品图片相似度匹配搜索方法和系统 | |
Sandag | A prediction model of company health using bagging classifier | |
CN111309577A (zh) | 一种面向Spark的批处理应用执行时间预测模型构建方法 | |
Zhang et al. | A hierarchical feature selection model using clustering and recursive elimination methods | |
Vagh | An investigation into the effect of stochastic annual rainfall on crop yields in South Western Australia | |
CN114968774A (zh) | 一种多源异构跨项目软件缺陷预测方法 | |
CN113837266A (zh) | 一种基于特征提取和Stacking集成学习的软件缺陷预测方法 | |
CN110334721B (zh) | 一种基于大数据的油品质量分析系统 | |
Raje | Detecting Diseases in Rice Leaf Using Deep Learning and Machine Learning Techniques | |
Kallio et al. | The self-organizing map in selecting companies for tax audit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19923578 Country of ref document: EP Kind code of ref document: A1 |