LambdaMart icon indicating copy to clipboard operation
LambdaMart copied to clipboard

getdata function doesn't function,only returns the first line

Open cuihuahuahua opened this issue 7 years ago • 1 comments

Dear,

I run the function on my computer. But the final file including training and test both contains only one record and the rest of the record in the file is the same as the first one.

def get_data(file_loc): f = open(file_loc, 'r') data = [] for line in f: new_arr = [] arr = line.split(' #')[0].split() score = arr[0] q_id = arr[1].split(':')[1] new_arr.append(int(score)) new_arr.append(int(q_id)) arr = arr[2:] for el in arr: new_arr.append(float(el.split(':')[1])) data.append(new_arr) f.close() return np.array(data)

cuihuahuahua avatar Nov 27 '17 04:11 cuihuahuahua

It's 4 years late but I just came across the same problem and what you can do is to use this version instead https://github.com/lezzago/LambdaMart/blob/master/test.py#L5-L20.

The one from the README is buggy indeed.

geraldzakwan avatar Mar 28 '22 11:03 geraldzakwan