Changeset eb2904 in git
- Timestamp:
- Jul 29, 2019, 2:57:21 PM (4 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 9f0f63787f503527775273cff2d354bd558c9cda
- Parents:
- 91d4aef86185a730eb9b18bef092b9b2a784f0fa
- Location:
- machine_learning/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
machine_learning/common/keyword_vector.py
r91d4ae reb2904 37 37 if not os.path.isfile(filename): 38 38 print("Please provide a valid input file as argument") 39 return {}39 return [] 40 40 if dictionary == []: 41 41 print("Please provide a valid dictionary as argument") 42 return {}42 return [] 43 43 if dictionary is None: 44 44 print("Please provide a valid dictionary as argument") 45 return {}45 return [] 46 46 vector = create_vector_dictionary(dictionary) 47 47 with open(filename, "r+") as file: … … 85 85 Create a zero vector for a given dictionary 86 86 """ 87 assert not dictionary == None, "Please give a dictionary" 88 assert not len(dictionary) == 0, "Please give a dictionary" 87 89 vector = {} 88 90 for word in dictionary: … … 99 101 return -1 100 102 101 diff_vec = vec1 - vec2 102 dist = np.linalg.norm(diff_vec) 103 dist = np.linalg.norm(vec1 - vec2) 103 104 104 105 return dist -
machine_learning/common/lookuptable.py
r91d4ae reb2904 95 95 test_vec = count_occurances(os.path.join(HELP_FILE_PATH, "html", 96 96 files[1]), dictionary) 97 print( test_vec == vectors[1])97 print((test_vec == vectors[1]).all()) 98 98 99 99
Note: See TracChangeset
for help on using the changeset viewer.