Changeset 872089 in git
- Timestamp:
- Jul 26, 2019, 4:13:00 PM (4 years ago)
- Branches:
- (u'spielwiese', 'd1ba061a762c62d3a25159d8da8b6e17332291fa')
- Children:
- 55a5abbd0397943b2c98a4492b27ecbc050c20ef
- Parents:
- 746d3db65a7b75cbc29407ee9382332483801f1d
- Files:
-
- 2 added
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r746d3d r872089 120 120 keywords.txt 121 121 helpfiles 122 *.npy -
machine_learning/common/lookuptable.py
r746d3d r872089 1 1 """ 2 j 2 3 A Module for fetching helpfiles, creating vectors for each and bundling 3 4 these up in a lookup table. … … 13 14 14 15 # local imports 15 from keyword_vector import count_occurances, read_dictionary16 from co nstants import HELP_FILE_URL, HELP_FILE_PATH, SINGULAR_BIN, \16 from common.keyword_vector import count_occurances, read_dictionary 17 from common.constants import HELP_FILE_URL, HELP_FILE_PATH, SINGULAR_BIN, \ 17 18 EXTRACT_SCRIPT, KEYWORDS_FILE, HELPFILE_NPY, \ 18 19 VECTORS_NPY … … 51 52 52 53 53 def create_table( ):54 def create_table(dictionary=read_dictionary(KEYWORDS_FILE)): 54 55 """ 55 56 Get a list of helpfiles, and generate a word occurance vector for each. 56 57 """ 57 vectors = [] 58 dictionary = read_dictionary(KEYWORDS_FILE) 58 vectors = [] 59 59 60 60 if not os.path.isfile(VECTORS_NPY) or not os.path.isfile(HELPFILE_NPY): -
machine_learning/model/predictor.py
r746d3d r872089 8 8 9 9 # Local imports 10 from keyword_vector import vector_distance 10 from common.keyword_vector import vector_distance, count_occurances, \ 11 read_dictionary 12 from common.lookuptable import create_table 13 from common.constants import KEYWORDS_FILE 11 14 12 15 … … 89 92 print(prediction) 90 93 94 dictionary = read_dictionary(KEYWORDS_FILE) 95 vectors, file_list = create_table(dictionary=dictionary) 96 test_vec = count_occurances("extract.lib", dictionary) 97 predictor.fit(vectors, file_list) 98 prediction = predictor.predict(np.array([test_vec])) 99 print(prediction) 100 91 101 if __name__ == '__main__': 92 102 main()
Note: See TracChangeset
for help on using the changeset viewer.