GithubHelp home page GithubHelp logo

Comments (3)

mscheltienne avatar mscheltienne commented on May 26, 2024

Can you precise this a bit? I'm not sure I'm following

from mne-icalabel.

adam2392 avatar adam2392 commented on May 26, 2024

It's mainly code like this in the GUI:

        for label, comp_list in labels2save.items():
            mne_label = ICLABEL_LABELS_TO_MNE[label]
            if mne_label not in self._ica.labels_:
                self._ica.labels_[mne_label] = comp_list
                continue
            for comp in comp_list:
                if comp not in self._ica.labels_[mne_label]:
                    self._ica.labels_[mne_label].append(comp)

and code like this in write_components_tsv

    # extract the component labels if they are present in the ICA instance
    if ica.labels_:
        for label, comps in ica.labels_.items():
            this_status = "good" if label == "brain" else "bad"
            if label in ICLABEL_LABELS_TO_MNE.values():
                for comp in comps:
                    status[comp] = this_status
                    ic_type[comp] = label

and we'll probably want to modify the ICA instance in place when running the automated models, so like in ICLabel:

    if inplace:
        from mne_icalabel.config import ICLABEL_LABELS_TO_MNE

        ica.labels_scores_ = labels_pred_proba
        argmax_labels = np.argmax(labels_pred_proba, axis=1)

        # add labels to the ICA instance
        for idx, (_, mne_label) in enumerate(ICLABEL_LABELS_TO_MNE.items()):
            auto_labels = argmax_labels.index[idx]
            if mne_label not in ica.labels_:
                ica.labels_[mne_label] = auto_labels
                continue
            for comp in auto_labels:
                if comp not in ica.labels_[mne_label]:
                    ica.labels_[mne_label].append(comp)

These I just wrote up for the sake of making it work, but prolly best to have a private API for interfacing the conversion between MNE and our ICA label semantics.

from mne-icalabel.

mscheltienne avatar mscheltienne commented on May 26, 2024

OK sure!

from mne-icalabel.

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.