Hi!
I am thinking about adding new pretty-print features for new objects based on the Markdown format. Indeed, in the PR 2282 on polynomial chaos expansion, I created two pretty-print features for the PCE:
- an HTML pretty-print, for the Jupyter Notebook rendering and the help pages (see the result here),
- a Markdown pretty-print available with the Python interpreter and which is correctly rendered in Github, Obsidian (and any other Markdown editor).
This prints the Sobol’ indices of a PCE very nicely (see it here).
I am thinking about adding this feature for the linear regression models, such as LinearModelResult
and LinearModelAnalysis
. Often, a table can be created that better organizes the results, e.g. the ANOVA table of the coefficients. The current implementation is based on ASCII-art, see here:
Coefficients:
| Estimate | Std Error | t value | Pr(>|t|) |
--------------------------------------------------------------------
[x,y]->[1] | 2.99847 | 0.0204173 | 146.859 | 9.82341e-41 |
[x,y]->[x] | 2.02079 | 0.0210897 | 95.8186 | 9.76973e-36 |
[x,y]->[y] | -0.994327 | 0.0215911 | -46.0527 | 3.35854e-27 |
--------------------------------------------------------------------
Implementing the HTML rendering is straightforward, but the Markdown rendering is trickier, because we have to deal with column alignment. Hence, the coding might be difficult to maintain: what if we add a new attribute that we want to pretty-print?
So I am thinking on the following development process. If the Sample
class provided a Markdown pretty-print, then we could use it in other classes to pretty-print more easily other tables. In the previous linear regression example, we may create a Sample
in dimension 5 and trigger the pretty-print of the Sample. This will make impossible to create the first column in the previous table, which contains strings that cannot be stored within a Sample
. In this case, could we use Pandas.DataFrame
in the Python layour, just for its pretty-print features? Would this raise a dependency issue in terms of Conda or Pip requirements?
Regards,
Michaël