Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/315#discussion_r213807744
  
    --- Diff: src/ports/postgres/modules/knn/test/knn.sql_in ---
    @@ -122,5 +122,13 @@ select 
knn('knn_train_data_reg','data','id','label','knn_test_data','data','id',
     select assert(array_agg(prediction::numeric order by 
id)='{1,1,0.0408728591876018,1,0,0}', 'Wrong output in regression') from 
madlib_knn_result_regression;
     
     
    +drop table if exists madlib_knn_result_classification;
    +select 
knn('knn_train_data','data[1:1]||data[2:2]','id','label','knn_test_data','data[1:1]||data[2:2]','id','madlib_knn_result_classification',3,False,'MADLIB_SCHEMA.squared_dist_norm2',
 True);
    +select assert(array_agg(prediction::numeric order by id)='{1,1,0,1,0,0}', 
'Wrong output in classification') from madlib_knn_result_classification;
    +
    +drop table if exists madlib_knn_result_regression;
    +select 
knn('knn_train_data_reg','data[1:1]||data[2:2]','id','label','knn_test_data','data[1:1]||data[2:2]','id','madlib_knn_result_regression',3,False,'MADLIB_SCHEMA.squared_dist_norm2',
 True);
    +select assert(array_agg(prediction::numeric order by 
id)='{1,1,0.0408728591876018,1,0,0}', 'Wrong output in regression') from 
madlib_knn_result_regression;
    +
    --- End diff --
    
    We could add another test case, where we use `ARRAY(d1, d2)` as the 
expression, say for `point_column_name`. Of course, you will then have to add 
two new columns d1 and d2 while creating the input table `knn_train_data` in 
that case.


---

Reply via email to