Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance primitive object display in the frontend #393

Open
rouk1 opened this issue Sep 24, 2024 · 9 comments
Open

Enhance primitive object display in the frontend #393

rouk1 opened this issue Sep 24, 2024 · 9 comments
Assignees
Labels
epic This issue represents major product increments

Comments

@rouk1
Copy link
Contributor

rouk1 commented Sep 24, 2024

For now we use basic JSON serialization and code highlight.
Log lists / dict should be trimmed to avoid painful scrolling.

          > Could we store a plotted representation of the series ? The markdow layout will be bad especially for large series. [Pandas offers this](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.plot.html#pandas-series-plot) with a default matplotlib backend (which is supported by the frontend).

I think its hard to find a generic plot which can represent all sort of series, while remaining easy to understand.
Maybe we can just display a sample of the series when its too long ? As done by pandas in python (0, 1, 2, [...], 3, 4).

@rouk1 is there the same problem on list-primitive type?
@MarieS-WiMLDS @sylvaincom what do you think?

Keep in mind that, as for python list, the user can put whatever he wants in his series (str, number, str & number etc).

Originally posted by @thomass-dev in #378 (comment)

@thomass-dev
Copy link
Collaborator

Do you need the backend to identify list-like object in the API?

@tuscland
Copy link
Member

We should not try to give a representation to objects that don't have one. It is a choice of the user to represent things, and MediaItem is made to work around this need.

In the future, we might want to offer the ability to create a visualization from data saved in the project.

@tuscland
Copy link
Member

In the future, we should be able to create plots and charts from data stored in skore.
For now, we need to pick a sensible default.

@MarieS-WiMLDS suggests to limits the amount of series items.
@sylvaincom suggests to use the default plotting function of pandas, because it is convenient.

I would suggest to use Sylvain's suggestion for a start.

@sylvaincom
Copy link
Contributor

For more information:

numpy

numpy.set_printoptions

Example:

import numpy as np
np.set_printoptions(threshold=5)
np.arange(10)

returns array([0, 1, 2, ..., 7, 8, 9])

pandas

Options and settings

Example:

import pandas as pd
pd.set_option("display.max_rows", 999)
pd.set_option("display.max_columns", 999)
pd.set_option("max_colwidth", 40)

@thomass-dev
Copy link
Collaborator

thomass-dev commented Sep 30, 2024

So what is proposed here is to call repr on Numpy/Pandas object (and so getting a string representation) before sending it to the frontend?

@tuscland
Copy link
Member

It is just an inspiration to design our own display options. How it should be implemented is another matter.

@tuscland
Copy link
Member

Let's focus on #394 before this one.

@tuscland
Copy link
Member

Solution suggestion @anasstarfaoui @rouk1

Primitive list:

  • Show as a table with a limited height. The user can use more height by dragging the component vertically.

Series:

  • Use the default plotting function of pandas.
  • The user can also switch to a table view like primitive lists.

Primitive dictionary:

  • use disclosure buttons to show/hide dictionary values. Use Option or Alt to recursively show/hide values.

@tuscland tuscland added question Further information is requested epic This issue represents major product increments labels Oct 23, 2024
@tuscland tuscland removed the question Further information is requested label Nov 25, 2024
@tuscland
Copy link
Member

tuscland commented Dec 6, 2024

This problem lacks proper framing, though the pain point remains valid.
Pausing until we have more feedback about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic This issue represents major product increments
Projects
None yet
Development

No branches or pull requests

5 participants