{"id":16930633,"url":"https://github.com/erfaniaa/commit-type-detection","last_synced_at":"2025-04-11T18:32:15.176Z","repository":{"id":46237110,"uuid":"237852161","full_name":"Erfaniaa/commit-type-detection","owner":"Erfaniaa","description":"Classify Git commits with deep learning","archived":false,"fork":false,"pushed_at":"2023-12-15T20:35:38.000Z","size":142,"stargazers_count":18,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T14:21:43.311Z","etag":null,"topics":["classification","deep-learning","neural-network","paper","python","pytorch","tf-idf"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Erfaniaa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-02T23:25:01.000Z","updated_at":"2024-01-30T14:18:34.000Z","dependencies_parsed_at":"2024-10-13T20:42:11.675Z","dependency_job_id":"ab9043d7-6841-4469-83d0-70382e18a30c","html_url":"https://github.com/Erfaniaa/commit-type-detection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erfaniaa%2Fcommit-type-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erfaniaa%2Fcommit-type-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erfaniaa%2Fcommit-type-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Erfaniaa%2Fcommit-type-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Erfaniaa","download_url":"https://codeload.github.com/Erfaniaa/commit-type-detection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248458665,"owners_count":21107124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","deep-learning","neural-network","paper","python","pytorch","tf-idf"],"created_at":"2024-10-13T20:42:07.331Z","updated_at":"2025-04-11T18:32:15.154Z","avatar_url":"https://github.com/Erfaniaa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Commit Type Detection\n\nClassify Git commits with deep learning\n\n# Introduction\n\nAccording to [this](https://arxiv.org/pdf/1711.05340.pdf) paper, we suppose that there are 3 main classification categories for software project maintenance activities:\n\n**Corrective**: fixing faults (functional and non-functional)\n\n**Perfective**: improving the system and its design\n\n**Adaptive**: introducing new features into the system\n\nIn this work, we seek to design a commit classification model capable of providing high accuracy to detect these three types of commits.\n\nThe used dataset can be found [here](https://zenodo.org/record/835534).\n\n# Method\n\nIn the mentioned paper, three algorithms have been used and compared. Among J48, GBM, and RF algorithms, RF had a better performance.\n\nInstead of using these algorithms, we implemented a **deep learning** approach. Here you can see the implemented neural network architecture (copied from network.py file):\n\n```python\nclass Network(nn.Module):\n    def __init__(self, input_size=NETWORK_INPUT_SIZE, output_size=NETWORK_OUTPUT_SIZE):\n        super(Network, self).__init__()\n        self.fc1 = nn.Linear(input_size, 80)\n        self.fc2 = nn.Linear(80, 60)\n        self.dropout1 = nn.Dropout(0.01)\n        self.fc3 = nn.Linear(60, 40)\n        self.fc4 = nn.Linear(40, 20)\n        self.fc5 = nn.Linear(20, output_size)\n\n    def forward(self, x):\n        x = self.fc1(x)\n        x = F.relu(x)\n        x = self.dropout1(x)\n        x = self.fc2(x)\n        x = F.relu(x)\n        x = self.dropout1(x)\n        x = self.fc3(x)\n        x = F.relu(x)\n        x = self.dropout1(x)\n        x = self.fc4(x)\n        x = F.relu(x)\n        x = self.dropout1(x)\n        x = self.fc5(x)\n        x = torch.tanh(x)\n        return x\n```\n\nAs you can read, a fully-connected neural network has been implemented in **PyTorch** deep learning framework.\n\nIn our dataset, each commit has a message, project name, and 68 other features. By applying **tf-idf** algorithm on the commit messages, we may convert each commit data to a vector with size 100. So, the input of this network is a vector with a size equal to 100.\n\nLike the paper method, our models were trained using 85% of the dataset, while the remaining 15% was used as a test set.\n\n# Result\n\nA confusion matrix will be shown after training. You can compare this data to the 8th table of the mentioned paper. As you can see, our method has reached **74.5% accuracy** in this case.\n\n```\nPredict  a        c        p        \nActual\na        17       4        10       \n\nc        5        74       6        \n\np        3        16       38       \n\n\n\n\nOverall Statistics:\n\nKappa                                                      0.57912\nNIR                                                        0.49133\nOverall Accuracy                                           0.74566\nP-Value [Accuracy \u003e NIR]                                   0.0\n\nClass Statistics:\n\nClasses                                                    Adaptive    Corrective  Perfective\nACC(Accuracy)                                              0.87283     0.82081     0.79769\nERR(Error rate)                                            0.12717     0.17919     0.20231\nFN(False negative/miss/type 2 error)                       14          11          19\nFP(False positive/type 1 error/false alarm)                8           20          16\nFPR(Fall-out or false positive rate)                       0.05634     0.22727     0.13793\nPPV(Precision or positive predictive value)                0.68        0.78723     0.7037\nTN(True negative/correct rejection)                        134         68          100\nTNR(Specificity or true negative rate)                     0.94366     0.77273     0.86207\nTP(True positive/hit)                                      17          74          38\nTPR(Sensitivity, recall, hit rate, or true positive rate)  0.54839     0.87059     0.66667\n```\n\n# Usage\n\nUse Python version 3.\n\nFirst of all, install the required Python packages:\n\n```bash\npip install requirements.txt\n```\n\nAnd then run the Python program:\n\n```\npython main.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferfaniaa%2Fcommit-type-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferfaniaa%2Fcommit-type-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferfaniaa%2Fcommit-type-detection/lists"}