Skip to content

improve standardizeMissing.m#419

Open
AvanishSalunke wants to merge 1 commit intognu-octave:mainfrom
AvanishSalunke:standardizemissing
Open

improve standardizeMissing.m#419
AvanishSalunke wants to merge 1 commit intognu-octave:mainfrom
AvanishSalunke:standardizemissing

Conversation

@AvanishSalunke
Copy link
Contributor

  1. If an unsupported type is passed, octave will ignore it and return the input unchanged.
octave:4> standardizeMissing ({'abc', 1}, 1)
ans =
  1x2 cell array

    {'abc'}    {[1]}    

octave:5> standardizeMissing ({'abc', 1}, 3)
ans =
  1x2 cell array

    {'abc'}    {[1]}    
  1. For indicators in numeric , it just checked whether the indicators are numeric are not.
octave:6> standardizeMissing (int8 ([1, 2, 3]), int16 (2))
ans =

  1  2  3

matlab

>> standardizeMissing (int8 ([1, 2, 3]), int16 (2))
Error using matlab.internal.math.ismissingKernel>arraySwitchIndicators (line 164)
Second argument must be int8 or double.

Error in matlab.internal.math.ismissingKernel (line 40)
        IA = arraySwitchIndicators(A,false,indstruct,stdize);
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in standardizeMissing (line 15)
    B = matlab.internal.math.ismissingKernel(A,indicators,true);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1. check for logical arrays has been added.

One thing that is not handled in this PR is how this function handles categorical array while using a char indicator,
For eg:
in octave:

octave:18>  A = categorical ({'a', 'b', 'c'});
octave:19>  indicator = 'b';
octave:20> standardizeMissing (A , indicator)
ans =
  1x3 categorical array

    <undefined>    b    c  

in matlab:

>> A = categorical ({'a', 'b', 'c'});
>> indicator = 'b';
>> standardizeMissing (A , indicator)

ans = 

  1×3 categorical array

     a      <undefined>      c 

the possible reason for it can be since isordinal function is not yet implemented in octave.
(my version is 11.0.0)

octave:21> ismember (A, indicator)
error: 'isordinal' undefined near line 1069, column 32

The ‘isordinal’ function is not yet implemented in Octave.

Please read <https://www.octave.org/missing.html> to learn how you can
contribute missing functionality.
error: called from
    ismember at line 1069 column 15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant