如何在Oracle中创建数据挖掘模型?

时间:2018-12-15 15:52:14

标签: oracle stored-procedures machine-learning plsql oracle-sqldeveloper

我正在尝试使用Oracle SQL开发人员创建数据挖掘模型。但是,它不起作用。在发布到此处之前,我已经检查了Oracle文档,但无法解决。

我正在尝试以下代码:

    -- Create the settings table for DT
    CREATE TABLE decision_tree_model_settings (
    setting_name VARCHAR2(30),
    setting_value VARCHAR2(30));

    BEGIN
    INSERT INTO decision_tree_model_settings (setting_name, setting_value)
    VALUES (dbms_data_mining.algo_name,dbms_data_mining.algo_decision_tree); 

    INSERT INTO decision_tree_model_settings (setting_name, setting_value)
    VALUES (dbms_data_mining.prep_auto,dbms_data_mining.prep_auto_on); 
    COMMIT;
    END; 
    /

   -- CREATE MODEL
   -- Create the model using the specified settings 
   BEGIN
   DBMS_DATA_MINING.CREATE_MODEL(
   model_name          => 'Decision_Tree_Model',
   mining_function     => dbms_data_mining.classification,
   data_table_name     => 'TRAIN_SET',
   target_column_name  => 'Y',
   settings_table_name => 'decision_tree_model_settings');
   END;
   /

创建模型的代码返回以下错误:

PLS-00306: wrong number or types of arguments in call to 'CREATE_MODEL'
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored

谢谢

爱德华多

1 个答案:

答案 0 :(得分:2)

您缺少第四个必需 CREATE_MODEL的参数:CASE_ID_COLUMN_NAME

这是程序的描述:

DBMS_DATA_MINING.CREATE_MODEL (
      model_name            IN VARCHAR2,               --> you have it
      mining_function       IN VARCHAR2,               --> you have it
      data_table_name       IN VARCHAR2,               --> you have it
      case_id_column_name   IN VARCHAR2,               --> YOU DO NOT HAVE IT!
      target_column_name    IN VARCHAR2 DEFAULT NULL,
      settings_table_name   IN VARCHAR2 DEFAULT NULL,
      data_schema_name      IN VARCHAR2 DEFAULT NULL,
      settings_schema_name  IN VARCHAR2 DEFAULT NULL,
      xform_list            IN TRANSFORM_LIST DEFAULT NULL);

默认值为NULL的参数不是强制性的,但是您必须提供所有必需的参数(即前四个参数,无例外)。

一旦包含它,就可以了。我自己无法尝试,因为11g XE没有启用挖掘选项。