clear, close all
addpath(genpath(pwd));

load ..\data\primary\correction_parameters b posi_prop nega_prop bestprobdiffthreshold K
load('..\data\primary\WellTime.mat')

y_train=cell(5,1);
yy_train=cell(5,1);
yy_train_after=cell(5,1);
sd_train=cell(5,1);
train_indices=cell(5,1);
y_test=cell(5,1);
yy_test=cell(5,1);
yy_test_after=cell(5,1);
sd_test=cell(5,1);
test_indices=cell(5,1);

k=66;
for q=1:5
	% 导入训练集真值
	filename=sprintf('%s%d%s%d','y_train_experiment',k,'_well',q);
	filepath=strcat('../data/intermediate/multitests_results_2/',filename,'.mat');
	load(filepath);
    y_train{q}=eval(filename);
    
    % 导入训练集预测值
	filename=sprintf('%s%d%s%d','yy_train_experiment',k,'_well',q);
	filepath=strcat('../data/intermediate/multitests_results_2/',filename,'.mat');
	load(filepath);
    yy_train{q}=eval(filename);

	% 导入训练集不确定性
	filename=sprintf('%s%d%s%d','sd_train_experiment',k,'_well',q);
	filepath=strcat('../data/intermediate/multitests_results_2/',filename,'.mat');
	load(filepath);
    sd_train{q}=eval(filename);

    % 导入训练集索引
	filename=sprintf('%s%d%s%d','train_indices_experiment',k,'_well',q);
	filepath=strcat('../data/intermediate/multitests_results_2/',filename,'.mat');
	load(filepath);
    train_indices{q}=eval(filename);
        
	% 导入测试集真值
	filename=sprintf('%s%d%s%d','y_test_experiment',k,'_well',q);
	filepath=strcat('../data/intermediate/multitests_results_2/',filename,'.mat');
	load(filepath);
    y_test{q}=eval(filename);
        
	% 导入测试集预测值
	filename=sprintf('%s%d%s%d','yy_test_experiment',k,'_well',q);
	filepath=strcat('../data/intermediate/multitests_results_2/',filename,'.mat');
	load(filepath);
    yy_test{q}=eval(filename);

	% 导入测试集不确定性
	filename=sprintf('%s%d%s%d','sd_test_experiment',k,'_well',q);
	filepath=strcat('../data/intermediate/multitests_results_2/',filename,'.mat');
	load(filepath);
    sd_test{q}=eval(filename);

    % 导入测试集索引
	filename=sprintf('%s%d%s%d','test_indices_experiment',k,'_well',q);
	filepath=strcat('../data/intermediate/multitests_results_2/',filename,'.mat');   
	load(filepath);
    test_indices{q}=eval(filename);
end

yy_train_after{1}=correction(yy_train{1},sd_train{1},b,posi_prop,nega_prop,bestprobdiffthreshold,K);
yy_train_after{2}=correction(yy_train{2},sd_train{2},b,posi_prop,nega_prop,bestprobdiffthreshold,K);
yy_train_after{3}=correction(yy_train{3},sd_train{3},b,posi_prop,nega_prop,bestprobdiffthreshold,K);
yy_train_after{4}=correction(yy_train{4},sd_train{4},b,posi_prop,nega_prop,bestprobdiffthreshold,K);
yy_train_after{5}=correction(yy_train{5},sd_train{5},b,posi_prop,nega_prop,bestprobdiffthreshold,K);

yy_test_after{1}=correction(yy_test{1},sd_test{1},b,posi_prop,nega_prop,bestprobdiffthreshold,K);
yy_test_after{2}=correction(yy_test{2},sd_test{2},b,posi_prop,nega_prop,bestprobdiffthreshold,K);
yy_test_after{3}=correction(yy_test{3},sd_test{3},b,posi_prop,nega_prop,bestprobdiffthreshold,K);
yy_test_after{4}=correction(yy_test{4},sd_test{4},b,posi_prop,nega_prop,bestprobdiffthreshold,K);
yy_test_after{5}=correction(yy_test{5},sd_test{5},b,posi_prop,nega_prop,bestprobdiffthreshold,K);

h=figure; 
set(h,'Color','w');
curvesaftercorrection(1,time1,y_train{1},yy_train{1},yy_train_after{1},train_indices{1},y_test{1},yy_test{1},yy_test_after{1},test_indices{1},h)
curvesaftercorrection(2,time2,y_train{2},yy_train{2},yy_train_after{2},train_indices{2},y_test{2},yy_test{2},yy_test_after{2},test_indices{2},h)
curvesaftercorrection(3,time3,y_train{3},yy_train{3},yy_train_after{3},train_indices{3},y_test{3},yy_test{3},yy_test_after{3},test_indices{3},h)
curvesaftercorrection(4,time4,y_train{4},yy_train{4},yy_train_after{4},train_indices{4},y_test{4},yy_test{4},yy_test_after{4},test_indices{4},h)
curvesaftercorrection(5,time5,y_train{5},yy_train{5},yy_train_after{5},train_indices{5},y_test{5},yy_test{5},yy_test_after{5},test_indices{5},h)
