Two codes for the same dataset have different root mean square error values
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, i am working on wknn for localization, the first code requires input of the rss values and the error is less than 5m but the second code has a training and a test set and the error is above 500m, i cannot figure why this is happening. I have attached the code and the dataset. Thank you.
0 件のコメント
回答 (1 件)
Drishti
2024 年 10 月 1 日
Hi Chinaza,
On reproducing the code on my end, I encountered a similar issue ‘error value exceeding 500’ for file named ‘havershinewknntest’.
The file 'wknntestwithinput' localizes a single point, which is not a recommended method for assessing performance and calculating errors. On the other hand, the 'havershinewknntest' file employs an iterative method throughout the dataset, providing enhancements over the initial code.
The ‘havershinewknntest’ approach can be improved by utilizing techniques like normalization of RSS values and distributing dataset in robust manner.
You can refer to the below code snippet to get an overview of the same.
% Normalize the RSS values (feature scaling)
rss_values = (rss_values - mean(rss_values)) ./ std(rss_values);
% Split data into training and testing sets
train_ratio = 0.7;
Additionally, you can also utilize the ‘cvpartition’ function for partioning data for cross-validation.
Refer to the implementation below:
% Create a cross-validation partition object
cv = cvpartition(n_train, 'KFold', 5);
Refer to the MATLAB Documentation of the ‘cvpartition’ function:
I hope this helps.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!