Skip to content

Commit

Permalink
v0.07: add summarize methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianherreramonterrosa committed Jul 20, 2024
1 parent e7e45f6 commit 7beb0e3
Show file tree
Hide file tree
Showing 11 changed files with 4,415 additions and 669 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,22 @@ phitter_cont = phitter.PHITTER(data)
phitter_cont.fit()

## Global methods and properties
phitter_cont.summarize(k: int) -> pandas.DataFrame
phitter_cont.summarize_info(k: int) -> pandas.DataFrame
phitter_cont.best_distribution -> dict
phitter_cont.sorted_distributions_sse -> dict
phitter_cont.not_rejected_distributions -> dict
phitter_cont.df_sorted_distributions_sse -> pandas.DataFrame
phitter_cont.df_not_rejected_distributions -> pandas.DataFrame

## Specific distribution methods and properties
get_parameters(id_distribution: str) -> dict
get_test_chi_square(id_distribution: str) -> dict
get_test_kolmmogorov_smirnov(id_distribution: str) -> dict
get_test_anderson_darling(id_distribution: str) -> dict
get_sse(id_distribution: str) -> float
get_n_test_passed(id_distribution: str) -> int
get_n_test_null(id_distribution: str) -> int
phitter_cont.get_parameters(id_distribution: str) -> dict
phitter_cont.get_test_chi_square(id_distribution: str) -> dict
phitter_cont.get_test_kolmmogorov_smirnov(id_distribution: str) -> dict
phitter_cont.get_test_anderson_darling(id_distribution: str) -> dict
phitter_cont.get_sse(id_distribution: str) -> float
phitter_cont.get_n_test_passed(id_distribution: str) -> int
phitter_cont.get_n_test_null(id_distribution: str) -> int
```

### Histogram Plot
Expand Down
313 changes: 308 additions & 5 deletions examples/fit_accelerate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -26,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -38,7 +38,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -54,7 +54,7 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -77,7 +77,7 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -89,6 +89,309 @@
"phitter_cont.fit(n_workers=4)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Summarize**"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>distribution</th>\n",
" <th>sse</th>\n",
" <th>parameters</th>\n",
" <th>chi_square</th>\n",
" <th>kolmogorov_smirnov</th>\n",
" <th>anderson_darling</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>generalized_gamma</td>\n",
" <td>0.002355</td>\n",
" <td>'a': 1.83, 'd': 20.53, 'p': 2.154</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>beta</td>\n",
" <td>0.002372</td>\n",
" <td>'alpha': 13.86, 'beta': 20.77, 'A': 1.344, 'B'...</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>johnson_sb</td>\n",
" <td>0.002384</td>\n",
" <td>'xi': 0.6761, 'lambda': 10.56, 'gamma': 1.031,...</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>nakagami</td>\n",
" <td>0.002430</td>\n",
" <td>'m': 11.06, 'omega': 27.06</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>gamma_3p</td>\n",
" <td>0.002486</td>\n",
" <td>'alpha': 227.2, 'loc': -6.6, 'beta': 0.05169</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>fatigue_life</td>\n",
" <td>0.002487</td>\n",
" <td>'gamma': 0.04952, 'loc': -10.59, 'scale': 15.71</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>inverse_gaussian_3p</td>\n",
" <td>0.002499</td>\n",
" <td>'mu': 17.62, 'lambda': 9005, 'loc': -12.47</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>erlang_3p</td>\n",
" <td>0.002500</td>\n",
" <td>'k': 227, 'beta': 0.05169, 'loc': -6.6</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>beta_prime_4p</td>\n",
" <td>0.002633</td>\n",
" <td>'alpha': 218, 'beta': 1161, 'loc': -5.393, 'sc...</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>non_central_t_student</td>\n",
" <td>0.002802</td>\n",
" <td>'lambda': 11.26, 'n': 328.2, 'loc': -2.878, 's...</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>inverse_gamma_3p</td>\n",
" <td>0.003376</td>\n",
" <td>'alpha': 265.8, 'loc': -7.6, 'beta': 3375</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>generalized_extreme_value</td>\n",
" <td>0.003572</td>\n",
" <td>'xi': -0.2257, 'mu': 4.847, 'sigma': 0.7586</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>johnson_su</td>\n",
" <td>0.003689</td>\n",
" <td>'xi': -123.2, 'lambda': 313.2, 'gamma': -173.4...</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>burr_4p</td>\n",
" <td>0.003855</td>\n",
" <td>'A': 4.368, 'B': 4.747, 'C': 4.689, 'loc': 2.172</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✅</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>rice</td>\n",
" <td>0.004323</td>\n",
" <td>'v': 5.082, 'sigma': 0.7839</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✖️</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>non_central_f</td>\n",
" <td>0.004369</td>\n",
" <td>'lambda': 131.7, 'n1': 31.75, 'n2': 3.735e+06</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✖️</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>folded_normal</td>\n",
" <td>0.004431</td>\n",
" <td>'mu': 5.143, 'sigma': 0.7791</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✖️</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>normal</td>\n",
" <td>0.004431</td>\n",
" <td>'mu': 5.143, 'sigma': 0.7791</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✖️</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>t_student_3p</td>\n",
" <td>0.004433</td>\n",
" <td>'df': 2.326e+09, 'loc': 5.143, 'scale': 0.779</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✖️</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>alpha</td>\n",
" <td>0.004616</td>\n",
" <td>'alpha': 21.5, 'loc': -11.52, 'scale': 357.4</td>\n",
" <td>✖️</td>\n",
" <td>✅</td>\n",
" <td>✖️</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" distribution sse \\\n",
"0 generalized_gamma 0.002355 \n",
"1 beta 0.002372 \n",
"2 johnson_sb 0.002384 \n",
"3 nakagami 0.002430 \n",
"4 gamma_3p 0.002486 \n",
"5 fatigue_life 0.002487 \n",
"6 inverse_gaussian_3p 0.002499 \n",
"7 erlang_3p 0.002500 \n",
"8 beta_prime_4p 0.002633 \n",
"9 non_central_t_student 0.002802 \n",
"10 inverse_gamma_3p 0.003376 \n",
"11 generalized_extreme_value 0.003572 \n",
"12 johnson_su 0.003689 \n",
"13 burr_4p 0.003855 \n",
"14 rice 0.004323 \n",
"15 non_central_f 0.004369 \n",
"16 folded_normal 0.004431 \n",
"17 normal 0.004431 \n",
"18 t_student_3p 0.004433 \n",
"19 alpha 0.004616 \n",
"\n",
" parameters chi_square \\\n",
"0 'a': 1.83, 'd': 20.53, 'p': 2.154 ✅ \n",
"1 'alpha': 13.86, 'beta': 20.77, 'A': 1.344, 'B'... ✅ \n",
"2 'xi': 0.6761, 'lambda': 10.56, 'gamma': 1.031,... ✅ \n",
"3 'm': 11.06, 'omega': 27.06 ✅ \n",
"4 'alpha': 227.2, 'loc': -6.6, 'beta': 0.05169 ✅ \n",
"5 'gamma': 0.04952, 'loc': -10.59, 'scale': 15.71 ✅ \n",
"6 'mu': 17.62, 'lambda': 9005, 'loc': -12.47 ✅ \n",
"7 'k': 227, 'beta': 0.05169, 'loc': -6.6 ✖️ \n",
"8 'alpha': 218, 'beta': 1161, 'loc': -5.393, 'sc... ✖️ \n",
"9 'lambda': 11.26, 'n': 328.2, 'loc': -2.878, 's... ✖️ \n",
"10 'alpha': 265.8, 'loc': -7.6, 'beta': 3375 ✖️ \n",
"11 'xi': -0.2257, 'mu': 4.847, 'sigma': 0.7586 ✖️ \n",
"12 'xi': -123.2, 'lambda': 313.2, 'gamma': -173.4... ✖️ \n",
"13 'A': 4.368, 'B': 4.747, 'C': 4.689, 'loc': 2.172 ✖️ \n",
"14 'v': 5.082, 'sigma': 0.7839 ✖️ \n",
"15 'lambda': 131.7, 'n1': 31.75, 'n2': 3.735e+06 ✖️ \n",
"16 'mu': 5.143, 'sigma': 0.7791 ✖️ \n",
"17 'mu': 5.143, 'sigma': 0.7791 ✖️ \n",
"18 'df': 2.326e+09, 'loc': 5.143, 'scale': 0.779 ✖️ \n",
"19 'alpha': 21.5, 'loc': -11.52, 'scale': 357.4 ✖️ \n",
"\n",
" kolmogorov_smirnov anderson_darling \n",
"0 ✅ ✅ \n",
"1 ✅ ✅ \n",
"2 ✅ ✅ \n",
"3 ✅ ✅ \n",
"4 ✅ ✅ \n",
"5 ✅ ✅ \n",
"6 ✅ ✅ \n",
"7 ✅ ✅ \n",
"8 ✅ ✅ \n",
"9 ✅ ✅ \n",
"10 ✅ ✅ \n",
"11 ✅ ✅ \n",
"12 ✅ ✅ \n",
"13 ✅ ✅ \n",
"14 ✅ ✖️ \n",
"15 ✅ ✖️ \n",
"16 ✅ ✖️ \n",
"17 ✅ ✖️ \n",
"18 ✅ ✖️ \n",
"19 ✅ ✖️ "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"phitter_cont.summarize()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Loading

0 comments on commit 7beb0e3

Please sign in to comment.