Home > brede > brede_mat_knn.m

brede_mat_knn

PURPOSE ^

brede_mat_knn - k nearest neighbor

SYNOPSIS ^

function Y2 = brede_mat_knn(X2, X1, Y1, varargin)

DESCRIPTION ^

 brede_mat_knn        - k nearest neighbor

       Y2 = brede_mat_knn(X2, X1, Y1, 'PropertyName', 'PropertyValue')  

       Input:  X2    Input to use as independent variable for prediction
                     as 'mat' structure or matrix
               X1    Input/independent variable associated with a known
                     output/dependent variable as 'mat' structure or
                     matrix 
               Y1    Known output/dependent variable as 'mat' structure
                     or matrix
   
       Output: Y2    Predicted output as a 'mat' structure with the same
                     number of rows as X2 and the same number of columns
                     as Y1.

       K-nearest neighbor regression. 

       The function may not work well if there are many rows in X1 or X2.

       Example
         % Univariate linear problem
         x1=rand(20,1); y1=x1+0.1*randn(20,1); x2=rand(5,1);
         y2 = brede_mat_knn(x2, x1, y1);
         figure, plot(x1, y1, '.', x2, y2.matrix, 'rs')

       See also BREDE, BREDE_MAT, BREDE_MAT_GLM.

 $Id: brede_mat_knn.m,v 1.1 2008/06/04 19:26:29 fn Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 27-Nov-2009 18:11:22 by m2html © 2005