statsample-glm icon indicating copy to clipboard operation
statsample-glm copied to clipboard

#coefficients output type

Open lokeshh opened this issue 9 years ago • 1 comments

I want to talk about two things:

(1). #coefficients(:hash) return vector names mapping the coefficients but the type of vector names is not preserved. They are all converted to symbols. This leads to problem in prediction as the new_data has to contain all vector names as symbols.

[6] pry(main)> x.coefficients :hash
=> {:a=>1.144620819921843,
 :b=>-0.042921191993683674,
 :"a:b"=>-0.03010679572782158,
 :constant=>4.738219960853547}

(2). #coefficients(:vector) returns a vector as follow:

=> #<Daru::Vector(4)>
                    0    1.144620819921843
                    1 -0.04292119199368367
                    2 -0.03010679572782158
                    3    4.738219960853547

The vector is not indexed by vector names which is little inconvenient.

WDYT about these two?

lokeshh avatar Jul 14 '16 14:07 lokeshh

(1). #coefficients(:hash) return vector names mapping the coefficients but the type of vector names is not preserved. They are all converted to symbols. This leads to problem in prediction as the new_data has to contain all vector names as symbols.

The keys should be of the same type as the names of the vector, i.e. symbol if it's originally a symbol and something else otherwise.

(2). #coefficients(:vector) returns a vector as follow:

Yes this should be indexed on the vector names.

v0dro avatar Jul 21 '16 18:07 v0dro