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 #225: Added option for weighted average for both classif...
Date Mon, 29 Jan 2018 23:09:10 GMT
Github user hpandeycodeit commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/225#discussion_r164594150
  
    --- Diff: src/ports/postgres/modules/knn/test/knn.sql_in ---
    @@ -72,43 +72,55 @@ 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,'MADLIB_SCHEMA.squared_dist_norm2');
    +select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,False,'MADLIB_SCHEMA.squared_dist_norm2',False);
     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);
     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,'MADLIB_SCHEMA.squared_dist_norm2');
    +select knn('knn_train_data_reg','data','id','label','knn_test_data','data','id','madlib_knn_result_regression',4,False,'MADLIB_SCHEMA.squared_dist_norm2',False);
     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 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',3,False,NULL);
    +select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,False,NULL,False);
     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,False,'MADLIB_SCHEMA.dist_norm1');
    +select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,False,'MADLIB_SCHEMA.dist_norm1',False);
     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,False,'MADLIB_SCHEMA.dist_angle');
    +select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,False,'MADLIB_SCHEMA.dist_angle',False);
     select assert(array_agg(prediction order by id)='{1,0,0,1,0,1}', '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,False,'MADLIB_SCHEMA.dist_tanimoto');
    +select knn('knn_train_data','data','id','label','knn_test_data','data','id','madlib_knn_result_classification',3,False,'MADLIB_SCHEMA.dist_tanimoto',False);
     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_regression;
    -select knn('knn_train_data_reg','data','id','label','knn_test_data','data','id','madlib_knn_result_regression',4,False,'MADLIB_SCHEMA.dist_norm1');
    +select knn('knn_train_data_reg','data','id','label','knn_test_data','data','id','madlib_knn_result_regression',4,False,'MADLIB_SCHEMA.dist_norm1',False);
     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',4,False,'MADLIB_SCHEMA.dist_angle');
    +select knn('knn_train_data_reg','data','id','label','knn_test_data','data','id','madlib_knn_result_regression',4,False,'MADLIB_SCHEMA.dist_angle',False);
     select assert(array_agg(prediction order by id)='{0.75,0.25,0.25,0.75,0.25,1}', 'Wrong
output in regression') from madlib_knn_result_regression;
    --- End diff --
    
    Changed these test cases as suggested. 


---

Mime
View raw message