blockwise-direct-search / bds_matlab

Blockwise Direct Search (MATLAB version)
GNU General Public License v3.0
1 stars 1 forks source link

"noise_classification" is not a good name and it is not needed #34

Closed zaikunzhang closed 1 year ago

zaikunzhang commented 1 year ago

For this part of the code,

https://github.com/blockwise-direct-search/bds/blob/463c431e5351d7f0785323127a88acac1779c4d9/tests/private/get_profile_options.m#L164-L176

please change

if ~isfield(parameters, "noise_level") && ~isfield(parameters, "noise_classification")
    parameters.noise_level = 1e-3;
else
    if isfield(parameters, "noise_classification")
        if parameters.noise_classification == "small"
            parameters.noise_level = 1e-9;
        elseif parameters.noise_classification == "medium"
            parameters.noise_level = 1e-6;
        else
            parameters.noise_level = 1e-3;
        end
    end
end

to (please correct the indentation of the following code)

if ~isfield(parameters, "noise_level")
    parameters.noise_level = 1.0e-3;
elseif  isa(parameters.noise_level, "char") || isa(parameters.noise_level, "string")
    switch lower(parameters.noise_level)
        case "negligible"
                parameters.noise_level = 1.0e-7;
         case "low"
                parameters.noise_level = 1.0e-5;
         case "medium"
                parameters.noise_level = 1.0e-3;
         case "high"
                parameters.noise_level = 1.0e-1;
         case "excessive"
                parameters.noise_level = 2.0e-1;              
         otherwise
                error("Unkown noise level %s", parameters.noise_level);
     end 
end

Then your code will understand it correctly if you set parameters.noise_level = "low". You do not need to define another field called "noise_classification". This is an advantage of MATLAB. Note that I have changed your definition of low/medium/high noise level, which is now 1.0e-5/-3/-1 and was 1.0e-9/-6/-3. This can be tuned later.

Besides, note the following.

  1. "small, medium, high" is obviously problematic. It should be "small, medium, big" or "low, medium, high" (it is good that you use "medium").

  2. ~1.0e-1 is better than 1e-3~ 1.0e-1 is better than 1e-1.

zaikunzhang commented 1 year ago
  1. 1.0e-1 is better than 1e-3.

There is a typo. I mean, it is better to write 1.0e-1 than to write 1e-1.