CoolFace
Apppublic

JetBrains-Research/commit-message-editing-visualization

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
data_stats.ipynb760 linesDownload Raw Back to root
1{2 "cells": [3  {4   "metadata": {},5   "cell_type": "markdown",6   "source": "# Data Stats",7   "id": "694a6cc631d4ab93"8  },9  {10   "metadata": {11    "ExecuteTime": {12     "end_time": "2024-10-15T18:43:07.644299Z",13     "start_time": "2024-10-15T18:43:02.316453Z"14    }15   },16   "cell_type": "code",17   "source": [18    "from datasets import load_dataset\n",19    "\n",20    "\n",21    "df = load_dataset(\"JetBrains-Research/synthetic-commit-msg-edits\", \"all_pairs\", split=\"train\").to_pandas()\n",22    "df.head()"23   ],24   "id": "ed42f4f83199feb2",25   "outputs": [26    {27     "name": "stderr",28     "output_type": "stream",29     "text": [30      "Downloading data: 100%|██████████| 6.35M/6.35M [00:00<00:00, 9.95MB/s]\n"31     ]32    },33    {34     "data": {35      "text/plain": [36       "Generating train split: 0 examples [00:00, ? examples/s]"37      ],38      "application/vnd.jupyter.widget-view+json": {39       "version_major": 2,40       "version_minor": 0,41       "model_id": "1a0523289d424b29974b60d017643280"42      }43     },44     "metadata": {},45     "output_type": "display_data"46    },47    {48     "data": {49      "text/plain": [50       "                                       hash              repo  \\\n",51       "0  2febb99eee8ed71c9122db88ca58dd33be0b9550  mesonbuild/meson   \n",52       "1  2febb99eee8ed71c9122db88ca58dd33be0b9550  mesonbuild/meson   \n",53       "2  2febb99eee8ed71c9122db88ca58dd33be0b9550  mesonbuild/meson   \n",54       "3  2febb99eee8ed71c9122db88ca58dd33be0b9550  mesonbuild/meson   \n",55       "4  2febb99eee8ed71c9122db88ca58dd33be0b9550  mesonbuild/meson   \n",56       "\n",57       "                                              G_text  \\\n",58       "0  Enhance OptionOverrideProxy and simplify optio...   \n",59       "1  Enhance OptionOverrideProxy and simplify optio...   \n",60       "2  Enhance OptionOverrideProxy and simplify optio...   \n",61       "3  Enhance OptionOverrideProxy and simplify optio...   \n",62       "4  Enhance OptionOverrideProxy and simplify optio...   \n",63       "\n",64       "                                              E_text              G_type  \\\n",65       "0  Enhance OptionOverrideProxy for multiple optio...  synthetic_backward   \n",66       "1  Refactor OptionOverrideProxy and Backend class...  synthetic_backward   \n",67       "2  Refactor OptionOverrideProxy and backend optio...  synthetic_backward   \n",68       "3  Refactor: Enhance OptionOverrideProxy for mult...  synthetic_backward   \n",69       "4  Refactor OptionOverrideProxy and add target-sp...  synthetic_backward   \n",70       "\n",71       "                            E_type  is_related  \n",72       "0                   expert_labeled        True  \n",73       "1                synthetic_forward        True  \n",74       "2                synthetic_forward        True  \n",75       "3                synthetic_forward        True  \n",76       "4  synthetic_forward_from_backward       False  "77      ],78      "text/html": [79       "<div>\n",80       "<style scoped>\n",81       "    .dataframe tbody tr th:only-of-type {\n",82       "        vertical-align: middle;\n",83       "    }\n",84       "\n",85       "    .dataframe tbody tr th {\n",86       "        vertical-align: top;\n",87       "    }\n",88       "\n",89       "    .dataframe thead th {\n",90       "        text-align: right;\n",91       "    }\n",92       "</style>\n",93       "<table border=\"1\" class=\"dataframe\">\n",94       "  <thead>\n",95       "    <tr style=\"text-align: right;\">\n",96       "      <th></th>\n",97       "      <th>hash</th>\n",98       "      <th>repo</th>\n",99       "      <th>G_text</th>\n",100       "      <th>E_text</th>\n",101       "      <th>G_type</th>\n",102       "      <th>E_type</th>\n",103       "      <th>is_related</th>\n",104       "    </tr>\n",105       "  </thead>\n",106       "  <tbody>\n",107       "    <tr>\n",108       "      <th>0</th>\n",109       "      <td>2febb99eee8ed71c9122db88ca58dd33be0b9550</td>\n",110       "      <td>mesonbuild/meson</td>\n",111       "      <td>Enhance OptionOverrideProxy and simplify optio...</td>\n",112       "      <td>Enhance OptionOverrideProxy for multiple optio...</td>\n",113       "      <td>synthetic_backward</td>\n",114       "      <td>expert_labeled</td>\n",115       "      <td>True</td>\n",116       "    </tr>\n",117       "    <tr>\n",118       "      <th>1</th>\n",119       "      <td>2febb99eee8ed71c9122db88ca58dd33be0b9550</td>\n",120       "      <td>mesonbuild/meson</td>\n",121       "      <td>Enhance OptionOverrideProxy and simplify optio...</td>\n",122       "      <td>Refactor OptionOverrideProxy and Backend class...</td>\n",123       "      <td>synthetic_backward</td>\n",124       "      <td>synthetic_forward</td>\n",125       "      <td>True</td>\n",126       "    </tr>\n",127       "    <tr>\n",128       "      <th>2</th>\n",129       "      <td>2febb99eee8ed71c9122db88ca58dd33be0b9550</td>\n",130       "      <td>mesonbuild/meson</td>\n",131       "      <td>Enhance OptionOverrideProxy and simplify optio...</td>\n",132       "      <td>Refactor OptionOverrideProxy and backend optio...</td>\n",133       "      <td>synthetic_backward</td>\n",134       "      <td>synthetic_forward</td>\n",135       "      <td>True</td>\n",136       "    </tr>\n",137       "    <tr>\n",138       "      <th>3</th>\n",139       "      <td>2febb99eee8ed71c9122db88ca58dd33be0b9550</td>\n",140       "      <td>mesonbuild/meson</td>\n",141       "      <td>Enhance OptionOverrideProxy and simplify optio...</td>\n",142       "      <td>Refactor: Enhance OptionOverrideProxy for mult...</td>\n",143       "      <td>synthetic_backward</td>\n",144       "      <td>synthetic_forward</td>\n",145       "      <td>True</td>\n",146       "    </tr>\n",147       "    <tr>\n",148       "      <th>4</th>\n",149       "      <td>2febb99eee8ed71c9122db88ca58dd33be0b9550</td>\n",150       "      <td>mesonbuild/meson</td>\n",151       "      <td>Enhance OptionOverrideProxy and simplify optio...</td>\n",152       "      <td>Refactor OptionOverrideProxy and add target-sp...</td>\n",153       "      <td>synthetic_backward</td>\n",154       "      <td>synthetic_forward_from_backward</td>\n",155       "      <td>False</td>\n",156       "    </tr>\n",157       "  </tbody>\n",158       "</table>\n",159       "</div>"160      ]161     },162     "execution_count": 3,163     "metadata": {},164     "output_type": "execute_result"165    }166   ],167   "execution_count": 3168  },169  {170   "metadata": {},171   "cell_type": "markdown",172   "source": "## Full",173   "id": "922e7a73f11a4aec"174  },175  {176   "metadata": {177    "ExecuteTime": {178     "end_time": "2024-10-15T18:43:14.266540Z",179     "start_time": "2024-10-15T18:43:14.262103Z"180    }181   },182   "cell_type": "code",183   "source": "len(df.loc[df.is_related])",184   "id": "562d9c53da109d1a",185   "outputs": [186    {187     "data": {188      "text/plain": [189       "656"190      ]191     },192     "execution_count": 4,193     "metadata": {},194     "output_type": "execute_result"195    }196   ],197   "execution_count": 4198  },199  {200   "metadata": {201    "ExecuteTime": {202     "end_time": "2024-10-15T18:43:18.073966Z",203     "start_time": "2024-10-15T18:43:18.069219Z"204    }205   },206   "cell_type": "code",207   "source": "df.loc[df.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",208   "id": "b4f3c96a4b676a0d",209   "outputs": [210    {211     "data": {212      "text/plain": [213       "43.733333333333334"214      ]215     },216     "execution_count": 5,217     "metadata": {},218     "output_type": "execute_result"219    }220   ],221   "execution_count": 5222  },223  {224   "metadata": {225    "ExecuteTime": {226     "end_time": "2024-10-15T18:43:19.026689Z",227     "start_time": "2024-10-15T18:43:19.021680Z"228    }229   },230   "cell_type": "code",231   "source": "len(df.loc[~df.is_related])",232   "id": "54d9f32f1d18844f",233   "outputs": [234    {235     "data": {236      "text/plain": [237       "5140"238      ]239     },240     "execution_count": 6,241     "metadata": {},242     "output_type": "execute_result"243    }244   ],245   "execution_count": 6246  },247  {248   "metadata": {249    "ExecuteTime": {250     "end_time": "2024-10-15T18:43:19.484304Z",251     "start_time": "2024-10-15T18:43:19.480012Z"252    }253   },254   "cell_type": "code",255   "source": "df.loc[~df.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",256   "id": "679761631517b9e4",257   "outputs": [258    {259     "data": {260      "text/plain": [261       "342.6666666666667"262      ]263     },264     "execution_count": 7,265     "metadata": {},266     "output_type": "execute_result"267    }268   ],269   "execution_count": 7270  },271  {272   "metadata": {},273   "cell_type": "markdown",274   "source": "## Expert-labeled",275   "id": "84561ea89717d61a"276  },277  {278   "metadata": {279    "ExecuteTime": {280     "end_time": "2024-10-15T18:45:52.905631Z",281     "start_time": "2024-10-15T18:45:52.901913Z"282    }283   },284   "cell_type": "code",285   "source": "_ = df.loc[(df.G_type == \"initial\") & (df.E_type == \"expert_labeled\")]",286   "id": "be1c800f45cef26e",287   "outputs": [],288   "execution_count": 36289  },290  {291   "metadata": {292    "ExecuteTime": {293     "end_time": "2024-10-15T18:45:53.234109Z",294     "start_time": "2024-10-15T18:45:53.230986Z"295    }296   },297   "cell_type": "code",298   "source": "len(_.loc[_.is_related])",299   "id": "1d092dff4d39bcd1",300   "outputs": [301    {302     "data": {303      "text/plain": [304       "57"305      ]306     },307     "execution_count": 37,308     "metadata": {},309     "output_type": "execute_result"310    }311   ],312   "execution_count": 37313  },314  {315   "metadata": {316    "ExecuteTime": {317     "end_time": "2024-10-15T18:45:53.629311Z",318     "start_time": "2024-10-15T18:45:53.625620Z"319    }320   },321   "cell_type": "code",322   "source": "_.loc[_.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",323   "id": "a06a532cd5a29725",324   "outputs": [325    {326     "data": {327      "text/plain": [328       "3.8"329      ]330     },331     "execution_count": 38,332     "metadata": {},333     "output_type": "execute_result"334    }335   ],336   "execution_count": 38337  },338  {339   "metadata": {340    "ExecuteTime": {341     "end_time": "2024-10-15T18:45:53.956790Z",342     "start_time": "2024-10-15T18:45:53.953842Z"343    }344   },345   "cell_type": "code",346   "source": "len(_.loc[~_.is_related])",347   "id": "5e19c8a6309b62aa",348   "outputs": [349    {350     "data": {351      "text/plain": [352       "0"353      ]354     },355     "execution_count": 39,356     "metadata": {},357     "output_type": "execute_result"358    }359   ],360   "execution_count": 39361  },362  {363   "metadata": {364    "ExecuteTime": {365     "end_time": "2024-10-15T18:46:02.554527Z",366     "start_time": "2024-10-15T18:46:02.551084Z"367    }368   },369   "cell_type": "code",370   "source": "_.loc[~_.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",371   "id": "e43179c5dcab5eb2",372   "outputs": [373    {374     "data": {375      "text/plain": [376       "nan"377      ]378     },379     "execution_count": 40,380     "metadata": {},381     "output_type": "execute_result"382    }383   ],384   "execution_count": 40385  },386  {387   "metadata": {},388   "cell_type": "markdown",389   "source": "## Backward",390   "id": "70ee052fae2f88e3"391  },392  {393   "metadata": {394    "ExecuteTime": {395     "end_time": "2024-10-15T18:44:33.559606Z",396     "start_time": "2024-10-15T18:44:33.556802Z"397    }398   },399   "cell_type": "code",400   "source": "_ = df.loc[(df.G_type == \"synthetic_backward\") & (~df.E_type.isin([\"synthetic_forward\", \"synthetic_forward_from_backward\"]))]",401   "id": "99f51ecc55c4db35",402   "outputs": [],403   "execution_count": 20404  },405  {406   "metadata": {407    "ExecuteTime": {408     "end_time": "2024-10-15T18:44:33.958325Z",409     "start_time": "2024-10-15T18:44:33.955847Z"410    }411   },412   "cell_type": "code",413   "source": "len(_.loc[_.is_related])",414   "id": "6ff29390c8e127c2",415   "outputs": [416    {417     "data": {418      "text/plain": [419       "104"420      ]421     },422     "execution_count": 21,423     "metadata": {},424     "output_type": "execute_result"425    }426   ],427   "execution_count": 21428  },429  {430   "metadata": {431    "ExecuteTime": {432     "end_time": "2024-10-15T18:44:34.455560Z",433     "start_time": "2024-10-15T18:44:34.452303Z"434    }435   },436   "cell_type": "code",437   "source": "_.loc[_.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",438   "id": "e1ae04e1ecfb2040",439   "outputs": [440    {441     "data": {442      "text/plain": [443       "7.428571428571429"444      ]445     },446     "execution_count": 22,447     "metadata": {},448     "output_type": "execute_result"449    }450   ],451   "execution_count": 22452  },453  {454   "metadata": {455    "ExecuteTime": {456     "end_time": "2024-10-15T18:44:34.903849Z",457     "start_time": "2024-10-15T18:44:34.901226Z"458    }459   },460   "cell_type": "code",461   "source": "len(_.loc[~_.is_related])",462   "id": "125c4c335e7761da",463   "outputs": [464    {465     "data": {466      "text/plain": [467       "1048"468      ]469     },470     "execution_count": 23,471     "metadata": {},472     "output_type": "execute_result"473    }474   ],475   "execution_count": 23476  },477  {478   "metadata": {479    "ExecuteTime": {480     "end_time": "2024-10-15T18:44:35.783538Z",481     "start_time": "2024-10-15T18:44:35.778676Z"482    }483   },484   "cell_type": "code",485   "source": "_.loc[~_.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",486   "id": "4782f1d6e6863f89",487   "outputs": [488    {489     "data": {490      "text/plain": [491       "74.85714285714286"492      ]493     },494     "execution_count": 24,495     "metadata": {},496     "output_type": "execute_result"497    }498   ],499   "execution_count": 24500  },501  {502   "metadata": {},503   "cell_type": "markdown",504   "source": "## Forward",505   "id": "bf61a4b422f779fa"506  },507  {508   "metadata": {},509   "cell_type": "markdown",510   "source": "### From human",511   "id": "1429f9f99acf75d"512  },513  {514   "metadata": {515    "ExecuteTime": {516     "end_time": "2024-10-15T18:46:21.359807Z",517     "start_time": "2024-10-15T18:46:21.356451Z"518    }519   },520   "cell_type": "code",521   "source": "_ = df.loc[(df.G_type == \"initial\") & (df.E_type == \"synthetic_forward\")]",522   "id": "e13d55b0124f04b3",523   "outputs": [],524   "execution_count": 41525  },526  {527   "metadata": {528    "ExecuteTime": {529     "end_time": "2024-10-15T18:46:21.798508Z",530     "start_time": "2024-10-15T18:46:21.795885Z"531    }532   },533   "cell_type": "code",534   "source": "len(_.loc[_.is_related])",535   "id": "b8353390df7da427",536   "outputs": [537    {538     "data": {539      "text/plain": [540       "177"541      ]542     },543     "execution_count": 42,544     "metadata": {},545     "output_type": "execute_result"546    }547   ],548   "execution_count": 42549  },550  {551   "metadata": {552    "ExecuteTime": {553     "end_time": "2024-10-15T18:46:22.163595Z",554     "start_time": "2024-10-15T18:46:22.160176Z"555    }556   },557   "cell_type": "code",558   "source": "_.loc[_.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",559   "id": "ac89afde65efd73d",560   "outputs": [561    {562     "data": {563      "text/plain": [564       "11.8"565      ]566     },567     "execution_count": 43,568     "metadata": {},569     "output_type": "execute_result"570    }571   ],572   "execution_count": 43573  },574  {575   "metadata": {576    "ExecuteTime": {577     "end_time": "2024-10-15T18:46:22.552314Z",578     "start_time": "2024-10-15T18:46:22.549570Z"579    }580   },581   "cell_type": "code",582   "source": "len(_.loc[~_.is_related])",583   "id": "9b6cb335e3bbb7ff",584   "outputs": [585    {586     "data": {587      "text/plain": [588       "0"589      ]590     },591     "execution_count": 44,592     "metadata": {},593     "output_type": "execute_result"594    }595   ],596   "execution_count": 44597  },598  {599   "metadata": {600    "ExecuteTime": {601     "end_time": "2024-10-15T18:46:23.237736Z",602     "start_time": "2024-10-15T18:46:23.234085Z"603    }604   },605   "cell_type": "code",606   "source": "__.loc[~__.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",607   "id": "fe22189a70fc4149",608   "outputs": [609    {610     "data": {611      "text/plain": [612       "nan"613      ]614     },615     "execution_count": 45,616     "metadata": {},617     "output_type": "execute_result"618    }619   ],620   "execution_count": 45621  },622  {623   "metadata": {},624   "cell_type": "markdown",625   "source": "### From backward",626   "id": "ace7afb876fb88a0"627  },628  {629   "metadata": {630    "ExecuteTime": {631     "end_time": "2024-10-15T18:47:06.641374Z",632     "start_time": "2024-10-15T18:47:06.637018Z"633    }634   },635   "cell_type": "code",636   "source": "_ = df.loc[(df.G_type == \"synthetic_backward\") & (df.E_type.isin([\"synthetic_forward\", \"synthetic_forward_from_backward\"]))]",637   "id": "88800960dbff619a",638   "outputs": [],639   "execution_count": 53640  },641  {642   "metadata": {643    "ExecuteTime": {644     "end_time": "2024-10-15T18:47:15.358650Z",645     "start_time": "2024-10-15T18:47:15.355108Z"646    }647   },648   "cell_type": "code",649   "source": "len(_.loc[_.is_related])",650   "id": "890613156e005c83",651   "outputs": [652    {653     "data": {654      "text/plain": [655       "318"656      ]657     },658     "execution_count": 56,659     "metadata": {},660     "output_type": "execute_result"661    }662   ],663   "execution_count": 56664  },665  {666   "metadata": {667    "ExecuteTime": {668     "end_time": "2024-10-15T18:47:15.579415Z",669     "start_time": "2024-10-15T18:47:15.576016Z"670    }671   },672   "cell_type": "code",673   "source": "_.loc[_.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",674   "id": "999f91382a2c8ff6",675   "outputs": [676    {677     "data": {678      "text/plain": [679       "22.714285714285715"680      ]681     },682     "execution_count": 57,683     "metadata": {},684     "output_type": "execute_result"685    }686   ],687   "execution_count": 57688  },689  {690   "metadata": {691    "ExecuteTime": {692     "end_time": "2024-10-15T18:47:15.834218Z",693     "start_time": "2024-10-15T18:47:15.831258Z"694    }695   },696   "cell_type": "code",697   "source": "len(_.loc[~_.is_related])",698   "id": "d347941cbb4b2db1",699   "outputs": [700    {701     "data": {702      "text/plain": [703       "3753"704      ]705     },706     "execution_count": 58,707     "metadata": {},708     "output_type": "execute_result"709    }710   ],711   "execution_count": 58712  },713  {714   "metadata": {715    "ExecuteTime": {716     "end_time": "2024-10-15T18:47:16.138798Z",717     "start_time": "2024-10-15T18:47:16.133397Z"718    }719   },720   "cell_type": "code",721   "source": "_.loc[~_.is_related].groupby([\"hash\", \"repo\"]).G_text.count().mean()",722   "id": "2db4d96713a8634d",723   "outputs": [724    {725     "data": {726      "text/plain": [727       "268.07142857142856"728      ]729     },730     "execution_count": 59,731     "metadata": {},732     "output_type": "execute_result"733    }734   ],735   "execution_count": 59736  }737 ],738 "metadata": {739  "kernelspec": {740   "display_name": "Python 3",741   "language": "python",742   "name": "python3"743  },744  "language_info": {745   "codemirror_mode": {746    "name": "ipython",747    "version": 2748   },749   "file_extension": ".py",750   "mimetype": "text/x-python",751   "name": "python",752   "nbconvert_exporter": "python",753   "pygments_lexer": "ipython2",754   "version": "2.7.6"755  }756 },757 "nbformat": 4,758 "nbformat_minor": 5759}760