예제 #1
0
 def __init__(self):
     self.iforest_obj = isolation_forest.IForest()
     self.ewma_obj = ewma.Ewma()
     self.polynomial_obj = polynomial_interpolation.PolynomialInterpolation(
     )
     self.statistic_obj = statistic.Statistic()
     self.supervised_obj = xgboosting.XGBoosting()
예제 #2
0
    def __generate_model(self, data, task_id):
        """
        Start train a model

        :param data: Training dataset.
        :param task_id: The id of the training task.
        """
        xgb_obj = xgboosting.XGBoosting()
        # pylint: disable=unused-variable
        ret_code, ret_data = xgb_obj.xgb_train(data, task_id)
        current_timestamp = int(time.time())
        train_op_obj = train_op.TrainOperation()
        if ret_code == 0:
            train_status = "complete"
            params = {
                "task_id": task_id,
                "end_time": current_timestamp,
                "status": train_status,
                "model_name": task_id + "_model"
            }
        else:
            train_status = "failed"
            params = {
                "task_id": task_id,
                "end_time": current_timestamp,
                "status": train_status,
                "model_name": ""
            }
        train_op_obj.update_model_info(params)
    def __generate_model(self, data, task_id):
        """
        Start train a model

        :param data: Training dataset.This is a list and data such as below:
                data -> samples_list=[{"flag": x, "data": "346", "353", "321", ...},
                                      {"flag": y, "data": "346", "353", "321", ...},
                                      {"flag": z, "data": "346", "353", "321", ...},
                                       ......
                                    ]
        :param task_id: The id of the training task.
        """
        xgb_obj = xgboosting.XGBoosting()
        # pylint: disable=unused-variable
        # jizhi 调用 xgboost 算法模型,
        #       传输参数:
        #           task_id - 时间戳
        #           data - 样本数据集
        #       返回值含义:
        #           ret_code: 执行正确or错误码
        ret_code, ret_data = xgb_obj.xgb_train(data, task_id)
        current_timestamp = int(time.time())
        # jizhi 初始化数据库的链接
        train_op_obj = train_op.TrainOperation()
        if ret_code == 0:
            train_status = "complete"
            params = {
                "task_id": task_id,
                "end_time": current_timestamp,
                "status": train_status,
                "model_name": task_id + "_model"
            }
        else:
            train_status = "failed"
            params = {
                "task_id": task_id,
                "end_time": current_timestamp,
                "status": train_status,
                "model_name": ""
            }
        # jizhi 到此,模型训练成功,在表 train_task 更新训练完成的模型信息
        train_op_obj.update_model_info(params)
예제 #4
0
            601, 549, 571, 566, 584, 598, 617, 627, 652, 667, 603, 575, 633,
            565, 596, 570, 581, 636, 678, 670, 590, 597, 626, 628, 694, 638,
            618, 578, 617, 570, 611, 577, 634, 552, 560, 591, 615, 562, 636,
            611, 579, 589, 593, 618, 591, 602, 600, 589, 584, 591, 605, 623,
            621, 605, 596, 564, 526, 601, 598, 645, 565, 582, 606, 555, 554,
            604, 591, 620, 578, 621, 618, 594, 618, 629, 596, 610, 606, 566,
            567, 593, 564, 540, 597, 551, 580, 544, 622, 606, 559, 571, 609,
            598, 643, 571, 634, 610, 554, 603, 627, 645, 616, 560, 578, 564,
            670, 585, 663, 614, 605, 595, 598, 613, 636, 591, 619, 588, 597,
            521, 618, 647, 597, 601, 579, 634, 626, 562, 632, 605, 633, 560,
            581, 557, 584, 600, 573, 551, 621, 753, 706, 762, 721, 728, 737,
            796, 756, 745, 722, 717, 702, 693, 741, 733, 675, 731, 821, 955,
            745, 765, 781, 740, 680, 691, 686, 642, 681, 627, 674, 729, 741,
            691, 653, 629, 627, 644, 642, 695, 643, 603, 614, 598, 632, 597,
            567, 578, 582, 613, 620, 597, 573, 551, 525, 514, 528, 502, 528,
            504, 512, 473, 542, 544, 560, 591, 549, 564, 550, 491, 482, 530,
            490, 537, 535, 563, 568, 525, 535, 485, 542, 551, 529, 481, 517,
            518, 521, 554, 525, 508, 577, 564, 575, 568, 548, 546, 511, 523,
            549, 564, 585, 576, 582, 559, 566, 527, 569, 534, 519, 545, 548,
            521, 596, 574, 569, 587, 578, 534, 570, 650, 580, 551, 601, 560,
            612, 609, 586, 551, 560, 568, 593, 641, 589, 549, 564, 566, 545,
            578, 543, 610, 578, 625, 625, 628, 693, 746, 627, 605, 583, 586,
            655, 613, 618, 672, 670, 634, 617, 584, 574, 609, 613, 620, 641,
            620, 608, 645, 635, 674, 645, 632, 661, 682, 772, 843, 818, 953,
            953, 970, 961, 989, 1014, 997
        ]
    }]
    task_id = '1234'
    xgb_obj = xgboosting.XGBoosting()
    ret_code, ret_data = xgb_obj.xgb_train(data, task_id)