madlib-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hpandeycodeit <...@git.apache.org>
Subject [GitHub] madlib pull request #204: Added additional distance metrics for k-NN: Jira-1...
Date Tue, 21 Nov 2017 22:26:22 GMT
Github user hpandeycodeit commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/204#discussion_r152419373
  
    --- Diff: src/ports/postgres/modules/knn/test/knn.sql_in ---
    @@ -73,23 +73,23 @@ copy knn_test_data (id, data) from stdin delimiter '|';
     \.
     
     drop table if exists madlib_knn_result_classification;
    -select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,False);
    +select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,False,'madlib.squared_dist_norm2');
     select assert(array_agg(prediction order by id)='{1,1,0,1,0,0}', 'Wrong output in classification
with k=3') from madlib_knn_result_classification;
     
     drop table if exists madlib_knn_result_classification;
    -select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,True);
    +select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,True,'madlib.squared_dist_norm2');
     select assert(array_agg(x)= '{1,2,3}','Wrong output in classification with k=3') from
(select unnest(k_nearest_neighbours) as x from madlib_knn_result_classification where id =
1 order by x asc) y;
     
     drop table if exists madlib_knn_result_regression;
    -select knn('knn_train_data_reg','data','id','label','knn_test_data','data','id','madlib_knn_result_regression',4,False);
    +select knn('knn_train_data_reg','data','id','label','knn_test_data','data','id','madlib_knn_result_regression',4,False,'madlib.squared_dist_norm2');
     select assert(array_agg(prediction order by id)='{1,1,0.5,1,0.25,0.25}', 'Wrong output
in regression') from madlib_knn_result_regression;
     
     drop table if exists madlib_knn_result_regression;
    -select knn('knn_train_data_reg','data','id','label','knn_test_data','data','id','madlib_knn_result_regression',3,True);
    +select knn('knn_train_data_reg','data','id','label','knn_test_data','data','id','madlib_knn_result_regression',3,True,'madlib.squared_dist_norm2');
     select assert(array_agg(x)= '{1,2,3}' , 'Wrong output in regression with k=3') from (select
unnest(k_nearest_neighbours) as x from madlib_knn_result_regression where id = 1 order by
x asc) y;
     
     drop table if exists madlib_knn_result_classification;
    -select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',False);
    +select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,False,'madlib.squared_dist_norm2');
    --- End diff --
    
    Added few more test functions where fn_dist is passed as NULL. All the above changes are
committed. 


---

Mime
View raw message