I have a dataset with a row that has unknowns which I thought I could use k-Nearest Neighbor on. When I read through the description of the function
knnimpute in Matlab it says that it replaces the NaN values with their closest neighbor column value. So I did a transpose on that column so all of the data is now in a single row. However, I get an error saying all the rows have NaN values in them. So I am a bit confused as to how to go about it.
Here's the code I ran:
knnimp = knnimpute(transpose(ds.stage),k);
I couldn't put a screen shot of the data but here's what it looks like (all of the data is in a row):
1 2 4 3 2 1 1 NaN 3 3 3 1 NaN 2 NaN
Here's the output I get after running the code on the transposed data:
All rows of the input data contains missing values. Unable to impute missing values.