Github user iyerr3 commented on a diff in the pull request: https://github.com/apache/incubator-madlib/pull/168#discussion_r133628425 --- Diff: src/ports/postgres/modules/knn/knn.py_in --- @@ -127,5 +124,102 @@ def knn_validate_src(schema_madlib, point_source, point_column_name, label_colum "Data type '{0}' is not a valid type for column '{1}' in table '{2}'.".format(colType, id_column_name, test_source)) return k -# ---------------------------------------------------------------------- -m4_changequote(<!`!>, <!'!>) + + + + +def knn(schema_madlib, point_source, point_column_name, label_column_name, + test_source, test_column_name, id_column_name, output_table, operation, k): + + """ + KNN function to find the K Nearest neighbours + Args: + @param schema_madlib Name of the Madlib Schema + @param point_source Training data table + @param point_column_name Name of the column with training data points. + @param label_column_name Name of the column with labels/values of training data points. + @param test_source Name of the table containing the test data points. + @param test_column_name Name of the column with testing data points. + @param id_column_name Name of the column having ids of data points in test data table. + @param output_table Name of the table to store final results. + @param k default: 1. Number of nearest neighbors to consider + + + Returns: + VARCHAR Name of the output table. + """ + + + oldClientMinMessages = plpy.execute("SELECT setting FROM pg_settings WHERE name = 'client_min_messages'")[0]['setting']; --- End diff -- Better to use the context manager: `with MinWarning('warning'): `
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---