【问题标题】:AWS - Sage Maker Random Cut ForestAWS - Sagemaker 随机森林砍伐
【发布时间】:2019-12-06 16:49:09
【问题描述】:

我有 aws cpu-utilization 数据,NAB 使用这些数据使用 AWS-SageMaker Random Cut Forest 创建异常检测。我能够执行它,但我需要更深入的超参数调整解决方案。我已经阅读了 AWS 文档,但需要了解 Hyper Parameter 选择。参数是有根据的猜测还是我们需要计算 co_disp 的均值和标准差来推断参数。

提前致谢。

我尝试了 100 Trees 和 512/256 tree_size 来检测异常,但是如何推断这些参数

    # Set tree parameters
    num_trees = 50
    shingle_size = 48
    tree_size = 512

    # Create a forest of empty trees
    forest = []
    for _ in range(num_trees):
        tree = rrcf.RCTree()
        forest.append(tree)

    # Use the "shingle" generator to create rolling window
    #temp_data represents my aws_cpuutilization data
    points = rrcf.shingle(temp_data, size=shingle_size)

    # Create a dict to store anomaly score of each point
    avg_codisp = {}

    # For each shingle...
    for index, point in enumerate(points):
        # For each tree in the forest...
        for tree in forest:
          # If tree is above permitted size, drop the oldest point (FIFO)
          if len(tree.leaves) > tree_size:
             tree.forget_point(index - tree_size)
        # Insert the new point into the tree
        tree.insert_point(point, index=index)
        """Compute codisp on the new point and take the average among all 
         trees"""
        if not index in avg_codisp:
            avg_codisp[index] = 0
            avg_codisp[index] += tree.codisp(index) / num_trees
    values =[]   
    for key,value in avg_codisp.items():
        values.append(value)

【问题讨论】:

    标签: amazon-web-services machine-learning artificial-intelligence data-science amazon-sagemaker


    【解决方案1】:

    感谢您对 RandomCutForest 的关注。如果您标记了异常,我们建议您使用 SageMaker 自动模型调整 (https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning.html),让 SageMaker 找到最有效的组合。

    例如,如果您知道自己的数据有 0.4% 的异常,您可以将每棵树的样本数设置为 N = 1 / (0.4 / 100) = 250。这背后的想法是每棵树代表您的数据样本。树中的每个数据点都被认为是“正常的”。如果你的树点太少,例如10,那么大多数点看起来与这些“正常”点不同,即它们的异常分数很高。

    树的数量和底层数据之间的关系更复杂。随着“正常”点范围的扩大,您会想要更多的树。

    【讨论】:

    • 感谢您的帮助。但是我使用的是 RRCF 库,我没有使用 AWS 服务来找出异常,而是我自己编写整个代码。所以我需要一种方法来概括应用程序或一种从 co_disp 分数自动设置参数的方法。就像 if mean , std of co_disp 一样,我将设置我的超参数。希望我得到回应。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-16
    • 1970-01-01
    • 2012-01-02
    • 2019-11-06
    • 2021-12-22
    • 1970-01-01
    • 2017-03-15
    相关资源
    最近更新 更多