示例#1
0
    rmse_dict = {}
    rmse_ratio_dict = {}
    n_cps_detected_dict = {}
    n_refits_dict = {}
    rmse_base_dict = {}

    # iterate over all seasonal lengths
    for seas_len in seasons_list:
        print('+++++++++++ Seasonal Length ' + str(seas_len) + ' +++++++++++')
        # create base data
        season_length = seas_len
        X = TrainHelper.get_periodic_noisy_x(x_base=np.linspace(
            -0.5 * math.pi, 1.5 * math.pi, season_length),
                                             n_periods=n_periods)
        Y = TrainHelper.noisy_sin(X)
        data = pd.DataFrame(columns=['X', 'Y'])
        data['X'] = X
        data['Y'] = Y
        train_ind = int(0.6 * data.shape[0])
        train = data[0:train_ind]
        # Train offline base model
        target_column = 'Y'
        kernel = ExpSineSquared()
        alpha = 0.1
        n_restarts_optimizer = 10
        standardize = False
        normalize_y = True
        model_sine = ModelsGaussianProcessRegression.GaussianProcessRegression(
            target_column=target_column,
            seasonal_periods=season_length,
示例#2
0
    # CPD Params
    cpd = args.change_point_detection
    const_hazard_factor = args.constant_hazard_factor
    const_hazard = args.constant_hazard
    const_hazard = const_hazard_factor * season_length if const_hazard == 9999 else const_hazard
    cf_r = args.changefinder_r
    cf_order = args.changefinder_order
    cf_smooth = args.changefinder_smooth
    cf_thr_perc = args.changefinder_threshold_percentile

    # get base data
    X = TrainHelper.get_periodic_noisy_x(x_base=np.linspace(
        -0.5 * math.pi, 1.5 * math.pi, season_length),
                                         n_periods=n_periods,
                                         noise=noise)
    Y = TrainHelper.noisy_sin(X, noise=noise, offset=offset)
    data = pd.DataFrame(columns=['X', 'Y'])
    data['X'] = X
    data['Y'] = Y
    train_ind = int(0.6 * data.shape[0])
    train = data[0:train_ind]
    # Train offline base model
    target_column = 'Y'
    kernel = ExpSineSquared()
    alpha = 0.1
    n_restarts_optimizer = 10
    standardize = False
    normalize_y = True

    model_sine = ModelsGaussianProcessRegression.GaussianProcessRegression(
        target_column=target_column,