PATTERN_MINKOWSKI_CVIP
pattern_minkowski_cvip() - takes two csv files as input, test and training set, then calculates the minkowski distance metric by comparing each vector in the test set to each in the training set.
Contents
SYNTAX
d = pattern_minkowski_cvip(file_tt, file_tr, r)
Input Parameters include :
- file_tt - Name of the test set file. A CSV file with a predefined structure.
- file_tr - Name of the training set file. A CSV file with a predefined structure.
- r - The parameter for mikowski distance metric. A real number greater than or equal to 1.
Output Parameters include :
- d - A matrix containing the distances between each vector in the test set to each vector in the training set. Each column represents a vector in training set. Each row represents a vector in test set.
DESCRIPTION
Using minkowski metric, the function calculates the distance between the vectors in training set and the test set.The minkowski metric has an extra argument r which needs to be given as input.The distances are returned in a matrix form whose rows represent the test vectors and columns represent the training vectors.
REFERENCE
1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.
EXAMPLE
% Test set file file_tt = 'myTestVectors.CSV'; % Training set file file_tr = 'myTrainingVectors.CSV'; % Calling function d = pattern_minkowski_cvip(file_tt, file_tr,3)
d = Columns 1 through 4 12.5000 -21.6506i 10.0266 -17.3666i 10.6900 -18.5157i 7.4941 -12.9801i 12.6047 -21.8320i 11.3742 -19.7007i 12.9219 -22.3813i 7.5471 -13.0720i 10.5241 -18.2283i 8.3203 -14.4112i 9.3983 -16.2783i 5.8517 -10.1354i 13.0604 -22.6212i 11.7304 -20.3176i 13.2292 -22.9136i 8.0415 -13.9282i 10.0518 -17.4103i 8.0052 -13.8654i 9.2312 -15.9888i 5.4104 - 9.3711i 11.5003 -19.9191i 9.0638 -15.6990i 9.8253 -17.0179i 6.5343 -11.3178i 0.0000 + 0.0000i 3.9365 + 0.0000i 3.8259 - 6.6266i 11.3393 + 0.0000i 1.9682 - 3.4091i 0.0000 + 0.0000i 2.0104 - 3.4821i 13.1250 + 0.0000i 7.6517 + 0.0000i 4.0207 + 0.0000i 0.0000 + 0.0000i 17.1430 + 0.0000i 5.6696 - 9.8201i 6.5625 -11.3666i 8.5715 -14.8462i 0.0000 + 0.0000i 7.1047 -12.3057i 5.6696 - 9.8201i 7.3658 -12.7579i 1.9682 - 3.4091i 6.5010 -11.2600i 4.3021 - 7.4515i 5.6696 - 9.8201i 7.6517 + 0.0000i Columns 5 through 7 5.3221 - 9.2182i 5.9988 -10.3903i 5.9988 -10.3903i 5.7388 - 9.9399i 7.2582 -12.5716i 7.2582 -12.5716i 3.4966 - 6.0563i 4.0691 - 7.0479i 4.0691 - 7.0479i 6.1303 -10.6179i 7.5595 -13.0935i 7.5595 -13.0935i 3.0000 - 5.1962i 3.7054 - 6.4179i 3.7054 - 6.4179i 4.3643 - 7.5591i 5.0000 - 8.6603i 5.0000 - 8.6603i 14.2094 + 0.0000i 13.0020 + 0.0000i 13.0020 + 0.0000i 11.3393 + 0.0000i 8.6043 + 0.0000i 8.6043 + 0.0000i 14.7315 + 0.0000i 11.3393 + 0.0000i 11.3393 + 0.0000i 3.9365 + 0.0000i 3.8259 - 6.6266i 3.8259 - 6.6266i 0.0000 + 0.0000i 2.0104 - 3.4821i 2.0104 - 3.4821i 4.0207 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
CREDITS
Author: Mehrdad Alvandipour, March 2017
Copyright © 2017-2018 Scott
E Umbaugh
For updates visit CVIP Toolbox Website