15 m4_include(`SQLCommon.m4
')
200 * @brief The result data type for the association rule API
202 * output_schema the name of the output schema.
203 * output_table the name of the output table.
204 * total_rules the number of total rules.
205 * total_time the running time.
207 CREATE TYPE MADLIB_SCHEMA.assoc_rules_results AS
217 * @brief Given the text form of a closed frequent pattern (cfp), this function
218 * generates the association rules for that pattern. We use text format
219 * because text values are hash joinable. The output is a set of text
220 * array. For example, assuming the input pattern is '1,2,3
'.
228 * Note that two meaningless rules will be excluded:
229 * array['1,2,3
', NULL]
230 * array[NULL, '1,2,3
']
232 * @param arg 1 The text form of a closed frequent pattern.
233 * @param arg 2 The number of items in the pattern.
235 * @return A set of text array. Each array has two elements, corresponding to
236 * the left and right parts of an association rule.
239 CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.gen_rules_from_cfp
244 RETURNS SETOF TEXT[] AS 'MODULE_PATHNAME
'
245 LANGUAGE C STRICT IMMUTABLE;
271 CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.assoc_rules
281 RETURNS MADLIB_SCHEMA.assoc_rules_results
284 PythonFunctionBodyOnly(`assoc_rules', `
assoc_rules')
286 plpy.execute("SET client_min_messages = error;")
288 # schema_madlib comes from PythonFunctionBodyOnly
289 return assoc_rules.assoc_rules(
300 $$ LANGUAGE plpythonu;
308 CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.assoc_rules
317 RETURNS MADLIB_SCHEMA.assoc_rules_results
320 PythonFunctionBodyOnly(`assoc_rules', `
assoc_rules')
322 plpy.execute("SET client_min_messages = error;")
324 # schema_madlib comes from PythonFunctionBodyOnly
325 return assoc_rules.assoc_rules(
336 $$ LANGUAGE plpythonu;