简体   繁体   English

AWS Kinesis SQL 的问题 - 随机森林砍伐算法

[英]Issue with AWS Kinesis SQL - Random Cut Forest algorithm

I have this code in an AWS Kinesis application:我在 AWS Kinesis 应用程序中有此代码:

CREATE OR REPLACE STREAM "OUT_FILE" (
        "fechaTS"              timestamp,
        "celda"                varchar(25),
        "Field1"               DOUBLE,
        "Field2"               DOUBLE,
        "ANOMALY_SCORE"        DOUBLE,
        "ANOMALY_EXPLANATION"  varchar(1024)
        );

CREATE OR REPLACE PUMP "PMP_OUT" AS
   INSERT INTO "OUT_FILE"
      SELECT STREAM 
        "fechaTS",
        "celda",
        "Field1",
        "Field2",
        "ANOMALY_SCORE",
        "ANOMALY_EXPLANATION"
      FROM TABLE(RANDOM_CUT_FOREST_WITH_EXPLANATION(
                 CURSOR(SELECT STREAM * FROM "SOURCE_SQL_STREAM_001"), 300, 512, 8064, 4, true))
  WHERE "celda" = 'CELLNUMBER' 
         ;

I just expect the usual output of anomaly scores calculations per each input record.我只是期望每个输入记录的异常分数计算的通常输出。

Instead, I get this error mesage:相反,我收到此错误消息:

Number of numeric attributes should be less than or equal to 30 (Please check the documentation to know the supported numeric SQL types)

The number of numerical attributes I am feeding into the model is just 2. On the other hand, supported SQL numeric types are these, according with the documentation: DOUBLE, INTEGER, FLOAT, TINYINT, SMALLINT, REAL, and BIGINT.我提供给模型的数字属性的数量只有 2。另一方面,支持的 SQL 数字类型是这些,根据文档:DOUBLE、INTEGER、FLOAT、TINYINT、SMALLINT、REAL 和 BIGINT。 (I have tried also with FLOAT). (我也尝试过 FLOAT)。

What am I doing wrong?我究竟做错了什么?

The solution is to define the variables as DOUBLE (or other accepted type), at the level of input schema: to define them as DOUBLE in SQL is not enough.解决方案是在输入模式级别将变量定义为 DOUBLE(或其他可接受的类型):在 SQL 中将它们定义为 DOUBLE 是不够的。

I tried a JSON like this and worked:我尝试了这样的 JSON 并工作:

{"ApplicationName": "<myAppName>",
 "Inputs": [{
   "InputSchema": {
            "RecordColumns": [{"Mapping": "fechaTS", "Name": "fechaTS", "SqlType": "timestamp"},
                              {"Mapping": "celda","Name": "celda","SqlType": "varchar(25)"},
                              {"Mapping": "Field1","Name": "Field1","SqlType": "DOUBLE"},
                              {"Mapping": "Field2","Name": "Field2","SqlType": "DOUBLE"},
                              {"Mapping": "Field3","Name": "Field3","SqlType": "DOUBLE"}],
            "RecordFormat": {"MappingParameters": {"JSONMappingParameters": {"RecordRowPath": "$"}},
                             "RecordFormatType": "JSON"}
            },
    "KinesisStreamsInput": {"ResourceARN": "<myInputARN>", "RoleARN": "<myRoleARN>"},
    "NamePrefix": "<myNamePrefix>"
    }]
  }

Additional information: if you save this JSON in myJson.json, then issue this command:附加信息:如果您将此 JSON 保存在 myJson.json 中,则发出以下命令:

aws kinesisanalytics create-application --cli-input-json file://myJson.json

AWS Command Line Interface (CLI) must be previously installed and configured.必须事先安装和配置 AWS 命令​​行界面 (CLI)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS SageMaker随机砍伐森林还是Kinesis Data Analytics随机砍伐森林? - AWS SageMaker Random Cut Forest or Kinesis Data Analytics Random Cut Forest? 什么是类似于 AWS 的 Kinesis Random Cut Forest 算法的用于时间序列流数据的 Google Clouds 异常检测解决方案? - What is Google Clouds anomaly detection solution for time series streaming data similar to AWS' Kinesis Random Cut Forest algorithm? AWS-Sage Maker随机砍伐森林 - AWS - Sage Maker Random Cut Forest 在本地使用 AWS ML model 随机森林砍伐森林 - Use AWS ML model Random Cut Forest locally 随机砍伐森林的超参数调整 - Hyper parameter tuning for Random cut forest aws kinesis put_record 问题 - aws kinesis put_record issue AWS Kinesis Analytics SQL 将行转换为列表 - AWS Kinesis Analytics SQL to transform rows to a list AWS Kinesis Analytics-Apache定制访问日志架构问题 - AWS Kinesis Analytics - Apache custom access log schema issue 行未添加到 AWS Kinesis 分析 Kinesis 数据流的应用程序内 SQL 流 - Rows are not getting added on AWS Kinesis analytics In-application SQL stream from Kinesis data stream InvalidSignatureException 从 SQL 向 AWS Kinesis 发送 POST 请求 - InvalidSignatureException Sending POST request to AWS Kinesis from SQL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM