Git Product home page Git Product logo

Comments (4)

may- avatar may- commented on June 7, 2024

Hi,

Could you please refer issue#1 (how to check prediction) and issue#2 (how to create source.att), at first?

MLMI stands for multi-label multi-instance training, that is, the labels are not mutually exclusive.
My task is to predict the relationship between two entities. For example, if you have the entity pair:

Berlin <relation> Germany

then the correct prediction will be: country, located_in and capital_of. (In this case, three correct labels according to WikiData)

Let's say, I found the following sentence online:

The city of Berlin is located in eastern Germany on the River Spree. 

Then the training data looks like:

  • source.txt (Berlin has entity ID: <Q64>, Germany: <Q183>)

    The city of <Q64> is located in eastern <Q183> on the River Spree . 
    
  • source.left

    The city of <Q64>
    
  • source.middle

    is located in eastern
    
  • source.right

    <Q183> on the River Spree . 
    
  • target.txt (assume that the first column represents whether the sentence has the label country, second column: located_in, third column: capital_of, etc.)

    1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    

Here is the list of 23 labels (and the class-wise results):
class-wise results

If you still have any questions, describe them little bit more concretely, please? I don't have any clue what your task is, how your data look like etc...

from cnn-re-tf.

ArijeetC avatar ArijeetC commented on June 7, 2024

Hi, thanks for the explanation. My task is also relationship extraction, I need to find the relations that exist in a given set of documents. I plan to first create a dataset from the documents with the entities and relations annotated, and then train a model on it to predict relations for new documents. Will this project be suitable for my task?

from cnn-re-tf.

may- avatar may- commented on June 7, 2024

It sounds pretty similar to my task.
Ah, so, your question is how to do distant supervision, right?

I'm not sure if it helps, but I describe here the four steps I did in the distant_supervision.py script.

  1. Download raw text data (if you already have the documents, you can replace this with your data)
    For example:
    The city of Berlin is located in eastern Germany on the River Spree. 
    
  2. Find entity
    • execute StanfordNER (demo)
      The city of <Berlin_LOCATION> is located in eastern <Germany_LOCATION> on the <River Spree_LOCATION>. 
      
    • extract all combinations. In the case above:
      <Berlin_LOCATION> <Germany_LOCATION>
      <Berlin_LOCATION> <River Spree_LOCATION>
      <Germany_LOCATION> <River Spree_LOCATION>
      
  3. Find entity ID (using SPARQL on WikiData API (sample))
    <Q64 Berlin> <Q183 Germany>
    <Q64 Berlin> <Q1684 River Spree>
    <Q183 Germany> <Q1684 River Spree>
    
  4. Find relation (using SPARQL on WikiData API (sample))
    <Q64 Berlin> <Q183 Germany> --> <P17 country>, <P1376 capital_of>, <P131 located_in>
    <Q64 Berlin> <Q1684 River Spree> --> <P206 located_next_to>
    <Q183 Germany> <Q1684 River Spree> --> None
    

At the end of these four steps, we get

  • source.txt
The city of <Q64> is located in eastern <Q183> on the River Spree . 
The city of <Q64> is located in eastern Germany on the <Q1684> . 

and

  • target.txt
1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

If you want to learn the theory, I recommend to read:

from cnn-re-tf.

ArijeetC avatar ArijeetC commented on June 7, 2024

Thanks for the detailed explanation, I think I might be able to solve my task with this.

from cnn-re-tf.

Related Issues (8)

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.