TF
TF copied to clipboard
non integer value for feature
def read_data(file_name):
'''
X: index
Y: rating values
'''
X = np.loadtxt(file_name, dtype=float, delimiter=',')
ndims = X.shape[1]-1
Y = X.T[ndims] # rating values
X = np.delete(X, ndims, 1).astype(int) # index values
dims = [X.T[i].max()+1 for i in range(ndims)]
return [X, Y], dims
In the code, i saw you force the value of X to be integer. Why do you need this?
If I remember correctly, Tensor Factorization only allows categorical features (which are integer). You can read the reference for more details. Thanks!