function [rmse_value] = driver_predict_cross_validate(data,training_indices,labels_all_data)
    training_data = data(:,training_indices);
    overall_label_values = labels_all_data(training_indices);
    sampling_rate = 20000;
    speed = 2000/60;
    window_size = ceil(sampling_rate/speed); %samples per cycle
    n_level = 6;
    kernel = 'linear';
    c_value = -5:1:3; %changed from 15 to 5
    epsilon_value = [0.001:0.001:0.01 0.01:0.01:0.10];
    gamma_value = -15:1:3; 

    %Extracting features for the data
    i = 1;
    while(i <= length(training_indices))
        feature_data(:,:,i) = feat_select(training_data(:,i),n_level,window_size);
        i = i + 1;
    end
    %Based on the feature dimensions, adjusting the feature values. 
    size_feature = size(feature_data);
    n_train_datapoints = size_feature(1);
    n_test_datapoints = size_feature(1);
    n_train_classes = size_feature(3)-1;
    rmse_value = 0;

    current_test_value = 1;
    count= 0;
    while(current_test_value <= length(training_indices))
        dummy = current_test_value+1:1:current_test_value+length(training_indices);
        j = 1;
        while(j < length(training_indices))
            if(dummy(j) > length(training_indices))
                dummy2(j) = mod(dummy(j),length(training_indices));
            else 
                dummy2(j) = dummy(j);
            end
            j = j + 1;
        end
        test_class_values = overall_label_values(current_test_value);
        train_label_values = overall_label_values(dummy2);
        i = 1;
        train_data = feature_data(:,:,dummy2(i));
        i = 2;
        while(i <= length(training_indices)-1)
            train_data = [train_data;feature_data(:,:,dummy2(i))];
            i = i + 1;
        end
        [mean_value,var_value,dummy3] = para_optimization(train_data,feature_data(:,:,current_test_value),n_train_datapoints,n_train_classes,test_class_values,n_test_datapoints,kernel,c_value,epsilon_value,gamma_value,train_label_values);
        rmse_value = rmse_value + dummy3;
        current_test_value = current_test_value + 1;
        count = count + 1;
    end
    size_rmse = size(rmse_value);
    i = 1;
    while(i < size_rmse(2))
        rmse_value(:,i+1) = rmse_value(:,i+1)/count;
        i =  i + 1;
    end
end
