Giter Club home page Giter Club logo

deer's People

Contributors

jeffhj avatar zhukerui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

esmailza minghua3

deer's Issues

Issues in collect samples function

After the graph.pickle is generated, we should run the collect sample function to create the dataset for the next step, but we faced this issue mentioned in the screenshot.

Screen Shot 2022-11-02 at 4 24 41 PM

wiki_ij_pr.dat files are empty

I am figuring out how the digraph.pickle file is created because I need to create mine in my research on a subset of Wikipedia. So I downloaded a small subset of Wikipedia and extracted the plain text using WikiExtractor.
I am getting this error while running the following command:

python extract_wiki.py preprocess_wikipedia [Wikipedia/folder]

File "DEER/extract_wiki.py", line 1073, in
cal_freq = CalFreq(path_pattern_count_file)
File "DEER/extract_wiki.py", line 389, in init
c, log_max_cnt = load_pattern_freq(path_freq_file)
File "DEER/extract_wiki.py", line 382, in load_pattern_freq

One problem is that "save_pair_files" are empty! In the following code, the "len(ents) <= 1:" is always less than or equal to the 1, so data is always empty. Therefore, the path_pattern.pickle and the sub_path_pattern.pickle contain just counter()!

    print('cal_cooccur_similarity')
    
    for f_id, save_cooccur__file in enumerate(tqdm.tqdm(save_cooccur__files)):
        with open(save_cooccur__file) as f_in:
            cooccurs = f_in.read().split('\n')
            print("cooccurs is: ", cooccurs)
        data = []
        for line in cooccurs:
            ents = line.split('\t')
            certain_len = len(ents)
            **if len(ents) <= 1:
                data.append('')**
            else:
                temp_data = []
                # valid_entities = []
                matrix = []
                for ent in ents:
                    try:
                        vec = w2vec.get_entity_vector(ent)
                    except:
                        vec = np.zeros(100, dtype=np.float32)
                    matrix.append(vec)
                # Collect pairs between certain entities
                matrix = np.array(matrix)
                result = cosine_similarity(matrix, matrix)
                for i in range(certain_len):
                    for j in range(i+1, certain_len):
                        tup = (float(result[i, j]), ents[i], ents[j])
                        temp_data.append(str(tup))
                data.append('\t'.join(temp_data))
        my_write(save_pair_files[f_id], data)

Can you please help me to realize where the problem is?

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.