[ 
https://issues.apache.org/jira/browse/MADLIB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16277369#comment-16277369
 ] 

Frank McQuillan commented on MADLIB-1059:
-----------------------------------------

Testing this, seem we need to make the last param on distance function 
optional.  It seems to be mandatory currently which is incorrect:

{code}
DROP TABLE IF EXISTS knn_result_classification;
SELECT * FROM madlib.knn( 
                'knn_train_data',      -- Table of training data
                'data',                -- Col name of training data
                'id',                  -- Col name of id in train data 
                'label',               -- Training labels
                'knn_test_data',       -- Table of test data
                'data',                -- Col name of test data
                'id',                  -- Col name of id in test data 
                'knn_result_classification',  -- Output table
                 3,                    -- Number of nearest neighbors
                 True                  -- True if you want to show 
nearest-neighbors, False otherwise
                );
SELECT * from knn_result_classification ORDER BY id;
{code}

which does not work:

{code}
ERROR:  function madlib.knn(unknown, unknown, unknown, unknown, unknown, 
unknown, unknown, unknown, integer, boolean) does not exist
LINE 1: SELECT * FROM madlib.knn(                 ^
HINT:  No function matches the given name and argument types. You may need to 
add explicit type casts.
{code}

> Add additional distance metrics for k-NN
> ----------------------------------------
>
>                 Key: MADLIB-1059
>                 URL: https://issues.apache.org/jira/browse/MADLIB-1059
>             Project: Apache MADlib
>          Issue Type: Improvement
>          Components: k-NN
>            Reporter: Frank McQuillan
>            Assignee: Himanshu Pandey
>              Labels: starter
>             Fix For: v1.13
>
>
> Follow on from https://issues.apache.org/jira/browse/MADLIB-927
> which supports one distance function.  This JIRA is to 
> (1)
> add additional distance metrics.  The model is follow is
> http://madlib.incubator.apache.org/docs/latest/group__grp__kmeans.html
> fn_dist (optional)
> TEXT, default: squared_dist_norm2'. The name of the function to use to 
> calculate the distance between data points.
> The following distance functions can be used (computation of barycenter/mean 
> in parentheses):
> dist_norm1: 1-norm/Manhattan (element-wise median [Note that MADlib does not 
> provide a median aggregate function for support and performance reasons.])
> dist_norm2: 2-norm/Euclidean (element-wise mean)
> squared_dist_norm2: squared Euclidean distance (element-wise mean)
> dist_angle: angle (element-wise mean of normalized points)
> dist_tanimoto: tanimoto (element-wise mean of normalized points [5])
> user defined function with signature DOUBLE PRECISION[] x, DOUBLE PRECISION[] 
> y -> DOUBLE PRECISION
> and also check of there are other distance functions under
> http://madlib.apache.org/docs/latest/group__grp__linalg.html
> that might make sense to include while you are at it, in addition to the ones 
> listed above
> (2) Add an option for weighted average in the voting.
> * this requirement moved to a separate JIRA: 
> https://issues.apache.org/jira/browse/MADLIB-1181



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to