Coder Social home page Coder Social logo

allennlp-multi-label's People

Contributors

dependabot[bot] avatar johngiorgi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

allennlp-multi-label's Issues

Write make_human_readable

Each AllenNLP model has a method make_output_human_readable which typically is used to add a new field to the output_dict with human-readable labels. This will need to be re-written for the multi-label setup (likely just by dropping the argmax)

Write extensive unit tests for the dataloader

Write extensive unit tests for the MultiLabelTextClassificationJsonReader. We can likely copy those of TextClassificationJsonReader from AllenNLP.

Side note, in the future we might consider re-writting TextClassificationJsonReader to be both multi-label and multi-class. It could just inspect the label field of the file it was passed to figure this out.

Why do tensors remain attached in FBetaMeasureMultiLabel?

In FBetaMeasureMultiLabel there is a function that is supposed to detach any tensors involved in the computation of metrics from the computation graph, but this does not work, so we currently detach them manually in the models forward pass. Why is this not working?

Incorrect F1 scores

You're calculating the F-score using logits but passing a default threshold of 0.5

I'm fairly sure you should be passing probabilities instead or set the threshold to 0.0 - as far as I can see F1MultiLabelMeasure doesn't convert logits to probabilities, it simply compares the predictions with the threshold.

installing via pip does not work

Hi,
I tried to use pip to install but it did not work.
We are working with conda so using poetry will be problematic for us.
Could you add this project to pypi.org or add a setup.py to install from git?

Thanks,
Naama

Tokens shouldn't be indexed in text_to_instance

I get the exception

ValueError: Found a TextField (tokens) with token_indexers already applied, but you're using num_workers > 0 in your data loader. Make sure your dataset reader's text_to_instance() method doesn't add any token_indexers to the TextFields it creates. Instead, the token_indexers should be added to the instances in the apply_token_indexers() method of your dataset reader (which you'll have to implement if you haven't done so already).

In your dataset readers text_to_instance instead of

        fields["tokens"] = TextField(tokens, self._token_indexers)

You should simply use

        fields["tokens"] = TextField(tokens)

And override apply_token_indexers ie

@overrides
def apply_token_indexers(self, instance: Instance) -> None:
    if self._segment_sentences:
        for text_field in instance.fields["tokens"]:  # type: ignore
            text_field._token_indexers = self._token_indexers
    else:
        instance.fields["tokens"]._token_indexers = self._token_indexers  # type: ignore

Also the read method should call shard_iterable ie

for line in self.shard_iterable(data_file.readlines()):

Automatic weights for BCE

We should have a way to automatically generate weights for the BinaryCrossEntropy loss function when reading in the data:

Weight should be:

weight = (num_datapoints - num_occurences_label) / num_occurences_label for the labels with count > 0 and num_datapoints + 1 otherwise.

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.