Skip to content

side effects on input data frame #39

@agisga

Description

@agisga

Statsample::GLM.compute unexpectedly removes the vector, that was used as the response variable, from the input data frame. Here is an example:

pry(main)> df.head
=> #<Daru::DataFrame(10x5)>
                     a          b          c          d          y
          0 0.27479519 1.80480199 -1.2751421 0.76081756          1
          1 0.17901102 0.00871009 1.76578726 0.16944012          0
          2 0.20252454 -0.3102766 0.82447408 -1.2664713          0
          3 -0.5319133 -1.0773630 0.17109189 -0.7032551          0
          4 1.45333302 -0.3011709 -1.3940893 -0.2989374          1
          5 2.06299880 -2.9378197 -0.7312268 -1.9596163          0
          6 0.74102859 0.51499638 2.05479393 -0.5436751          1
          7 -0.4118809 0.43495358 -1.1746620 1.28345001          1
          8 -0.6430840 -2.0152451 2.08489362 -1.8998193          0
          9 0.05172997 0.25161886 -0.3881732 0.03106442          1

pry(main)> opt = Statsample::GLM.compute df, :y, :logistic, algorithm: :mle

pry(main)> df.head
=> #<Daru::DataFrame(10x4)>
                     a          b          c          d
          0 0.27479519 1.80480199 -1.2751421 0.76081756
          1 0.17901102 0.00871009 1.76578726 0.16944012
          2 0.20252454 -0.3102766 0.82447408 -1.2664713
          3 -0.5319133 -1.0773630 0.17109189 -0.7032551
          4 1.45333302 -0.3011709 -1.3940893 -0.2989374
          5 2.06299880 -2.9378197 -0.7312268 -1.9596163
          6 0.74102859 0.51499638 2.05479393 -0.5436751
          7 -0.4118809 0.43495358 -1.1746620 1.28345001
          8 -0.6430840 -2.0152451 2.08489362 -1.8998193
          9 0.05172997 0.25161886 -0.3881732 0.03106442

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions