Coder Social home page Coder Social logo

Comments (7)

haochuanwei avatar haochuanwei commented on May 12, 2024 1

Sure, great point! The catch is that one may want to "lock" the configuration upon any read operation. We don't want the user to inadvertently mix two sets of configs in one process.

  • the right scope to load custom configurations should be between import hover and the creation of any dataset/explorer objects that depend on the configuration values.
  • probably a "ModuleConfig" object with config values as properties, and a hover.reconfigure() method to trigger the setter of those properties.

from hover.

haochuanwei avatar haochuanwei commented on May 12, 2024

@robinsonkwame
With c4d1642, you can now use hover.config.update("myconfig.ini") where myconfig.ini looks like:

hover/hover/config.ini

Lines 1 to 15 in c4d1642

[.]
abstain_decoded = ABSTAIN
abstain_encoded = -1
abstain_hexcolor = #dcdcdc
encoded_label_key = label_encoded
data_save_dir = .
[core]
dataset_subset_field = SUBSET
embedding_field_prefix = embed_
[core.explorer]
source_color_field = __COLOR__
source_alpha_field = __ALPHA__
search_score_field = __SEARCH_SCORE__

Two caveats:

  • this change is not yet merged to main, you need to use nightly for the moment.
  • if any hover component has already used a config value, that config value can no longer be assigned to.
    • so if you'd like to hover.config.update("myconfig.ini"), do it right after import hover.
    • this is by design to prevent error-prone mixed configs. Made possible through LockableConfig.

from hover.

robinsonkwame avatar robinsonkwame commented on May 12, 2024

excellent 👍🏽

from hover.

haochuanwei avatar haochuanwei commented on May 12, 2024

from hover.

haochuanwei avatar haochuanwei commented on May 12, 2024

How to use a custom palette

from bokeh.palettes import Turbo256

# you can use a bokeh built-in palette, or any iterable of hex-colors like "#dcdcdc"
hover.config["visual"]["bokeh_palette"] = Turbo256

See bokeh.palettes for more info on what's available.

How to list the config options and what value to use

We have added more configurable options inside hover.config.

hover.config.hint() will show this:

{'data.columns': {'dataset_subset_field': 'The column name for dataset '
                                          'subsets.. Example: SUBSET',
                  'embedding_field_prefix': 'The prefix of column names for '
                                            'embedding coordinates.. Example: embed_',
                  'encoded_label_key': 'The column name for the encoded '
                                       'label.. Example: label_encoded',
                  'search_score_field': "The column name for data points' "
                                        'score from search widgets.. Example: '
                                        '__SEARCH_SCORE__',
                  'source_alpha_field': 'The column name for plotted data '
                                        'point color alpha (opacity).. '
                                        'Example: __ALPHA__',
                  'source_color_field': 'The column name for plotted data '
                                        'point color.. Example: __COLOR__'},
 'data.embedding': {'default_reduction_method': 'Default method for '
                                                'dimensionality reduction. '
                                                "Currently either 'umap' or "
                                                "'ivis'.. Example: umap"},
 'data.values': {'abstain_decoded': "The placeholder label indicating 'no "
                                    "label yet'.. Example: ABSTAIN",
                 'abstain_encoded': "The encoded value of 'no label yet' which "
                                    'should almost always be -1, never 0 or '
                                    'positive.. Example: -1'},
 'io': {'data_save_dir': 'The directory path for saving labeled data.. '
                         'Example: .'},
 'visual': {'abstain_hexcolor': 'Hex code of RGB color.. Example: #dcdcdc',
            'bokeh_palette': 'The bokeh color palette to use for plotting.. '
                             "Example: ('#30123b', '#311542', '#32184a', "
                             "'#341b51', '#351e58', '#36215f', '#372365', "
                             "'#38266c', '#392972', '#3a2c79', '#3b2f7f', "
                             "'#3c3285', '#3c358b', '#3d3791', '#3e3a96', "
                             "'#3f3d9c', '#4040a1', '#4043a6', '#4145ab', "
                             "'#4148b0', '#424bb5', '#434eba', '#4350be', "
                             "'#4353c2', '#4456c7', '#4458cb', '#455bce', "
                             "'#455ed2', '#4560d6', '#4563d9', '#4666dd', "
                             "'#4668e0', '#466be3', '#466de6', '#4670e8', "
                             "'#4673eb', '#4675ed', '#4678f0', '#467af2', "
                             "'#467df4', '#467ff6', '#4682f8', '#4584f9', "
                             "'#4587fb', '#4589fc', '#448cfd', '#438efd', "
                             "'#4291fe', '#4193fe', '#4096fe', '#3f98fe', "
                             "'#3e9bfe', '#3c9dfd', '#3ba0fc', '#39a2fc', "
                             "'#38a5fb', '#36a8f9', '#34aaf8', '#33acf6', "
                             "'#31aff5', '#2fb1f3', '#2db4f1', '#2bb6ef', "
                             "'#2ab9ed', '#28bbeb', '#26bde9', '#25c0e6', "
                             "'#23c2e4', '#21c4e1', '#20c6df', '#1ec9dc', "
                             "'#1dcbda', '#1ccdd7', '#1bcfd4', '#1ad1d2', "
                             "'#19d3cf', '#18d5cc', '#18d7ca', '#17d9c7', "
                             "'#17dac4', '#17dcc2', '#17debf', '#18e0bd', "
                             "'#18e1ba', '#19e3b8', '#1ae4b6', '#1be5b4', "
                             "'#1de7b1', '#1ee8af', '#20e9ac', '#22eba9', "
                             "'#24eca6', '#27eda3', '#29eea0', '#2cef9d', "
                             "'#2ff09a', '#32f197', '#35f394', '#38f491', "
                             "'#3bf48d', '#3ff58a', '#42f687', '#46f783', "
                             "'#4af880', '#4df97c', '#51f979', '#55fa76', "
                             "'#59fb72', '#5dfb6f', '#61fc6c', '#65fc68', "
                             "'#69fd65', '#6dfd62', '#71fd5f', '#74fe5c', "
                             "'#78fe59', '#7cfe56', '#80fe53', '#84fe50', "
                             "'#87fe4d', '#8bfe4b', '#8efe48', '#92fe46', "
                             "'#95fe44', '#98fe42', '#9bfd40', '#9efd3e', "
                             "'#a1fc3d', '#a4fc3b', '#a6fb3a', '#a9fb39', "
                             "'#acfa37', '#aef937', '#b1f836', '#b3f835', "
                             "'#b6f735', '#b9f534', '#bbf434', '#bef334', "
                             "'#c0f233', '#c3f133', '#c5ef33', '#c8ee33', "
                             "'#caed33', '#cdeb34', '#cfea34', '#d1e834', "
                             "'#d4e735', '#d6e535', '#d8e335', '#dae236', "
                             "'#dde036', '#dfde36', '#e1dc37', '#e3da37', "
                             "'#e5d838', '#e7d738', '#e8d538', '#ead339', "
                             "'#ecd139', '#edcf39', '#efcd39', '#f0cb3a', "
                             "'#f2c83a', '#f3c63a', '#f4c43a', '#f6c23a', "
                             "'#f7c039', '#f8be39', '#f9bc39', '#f9ba38', "
                             "'#fab737', '#fbb537', '#fbb336', '#fcb035', "
                             "'#fcae34', '#fdab33', '#fda932', '#fda631', "
                             "'#fda330', '#fea12f', '#fe9e2e', '#fe9b2d', "
                             "'#fe982c', '#fd952b', '#fd9229', '#fd8f28', "
                             "'#fd8c27', '#fc8926', '#fc8624', '#fb8323', "
                             "'#fb8022', '#fa7d20', '#fa7a1f', '#f9771e', "
                             "'#f8741c', '#f7711b', '#f76e1a', '#f66b18', "
                             "'#f56817', '#f46516', '#f36315', '#f26014', "
                             "'#f15d13', '#ef5a11', '#ee5810', '#ed550f', "
                             "'#ec520e', '#ea500d', '#e94d0d', '#e84b0c', "
                             "'#e6490b', '#e5460a', '#e3440a', '#e24209', "
                             "'#e04008', '#de3e08', '#dd3c07', '#db3a07', "
                             "'#d93806', '#d73606', '#d63405', '#d43205', "
                             "'#d23005', '#d02f04', '#ce2d04', '#cb2b03', "
                             "'#c92903', '#c72803', '#c52602', '#c32402', "
                             "'#c02302', '#be2102', '#bb1f01', '#b91e01', "
                             "'#b61c01', '#b41b01', '#b11901', '#ae1801', "
                             "'#ac1601', '#a91501', '#a61401', '#a31201', "
                             "'#a01101', '#9d1001', '#9a0e01', '#970d01', "
                             "'#940c01', '#910b01', '#8e0a01', '#8b0901', "
                             "'#870801', '#840701', '#810602', '#7d0502', "
                             "'#7a0402')"}}

from hover.

github-actions avatar github-actions commented on May 12, 2024

This issue is stale because it has been open for 30 days with no activity.

from hover.

github-actions avatar github-actions commented on May 12, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

from hover.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.