Changeset eb2904 in git


Ignore:
Timestamp:
Jul 29, 2019, 2:57:21 PM (4 years ago)
Author:
Murray Heymann <heymann.murray@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
9f0f63787f503527775273cff2d354bd558c9cda
Parents:
91d4aef86185a730eb9b18bef092b9b2a784f0fa
Message:
Cleanup
Location:
machine_learning/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • machine_learning/common/keyword_vector.py

    r91d4ae reb2904  
    3737    if not os.path.isfile(filename):
    3838        print("Please provide a valid input file as argument")
    39         return {}
     39        return []
    4040    if dictionary == []:
    4141        print("Please provide a valid dictionary as argument")
    42         return {}
     42        return []
    4343    if dictionary is None:
    4444        print("Please provide a valid dictionary as argument")
    45         return {}
     45        return []
    4646    vector = create_vector_dictionary(dictionary)
    4747    with open(filename, "r+") as file:
     
    8585    Create a zero vector for a given dictionary
    8686    """
     87    assert not dictionary == None, "Please give a dictionary"
     88    assert not len(dictionary) == 0, "Please give a dictionary"
    8789    vector = {}
    8890    for word in dictionary:
     
    99101        return -1
    100102
    101     diff_vec = vec1 - vec2
    102     dist = np.linalg.norm(diff_vec)
     103    dist = np.linalg.norm(vec1 - vec2)
    103104
    104105    return dist
  • machine_learning/common/lookuptable.py

    r91d4ae reb2904  
    9595    test_vec = count_occurances(os.path.join(HELP_FILE_PATH, "html",
    9696                                             files[1]), dictionary)
    97     print(test_vec == vectors[1])
     97    print((test_vec == vectors[1]).all())
    9898
    9999
Note: See TracChangeset for help on using the changeset viewer.