/* ----------------------------------------------------------------------- *//** * * @file MultiResponseGLM_proto.hpp * *//* ----------------------------------------------------------------------- */ #ifndef MADLIB_MODULES_GLM_MULTIRESPONSEGLM_PROTO_HPP #define MADLIB_MODULES_GLM_MULTIRESPONSEGLM_PROTO_HPP #include "family.hpp" #include "link.hpp" #include namespace madlib { namespace modules { namespace glm { // Use Eigen using namespace dbal; using namespace dbal::eigen_integration; template class MultiResponseGLMAccumulator : public DynamicStruct,Container> { public: typedef DynamicStruct Base; MADLIB_DYNAMIC_STRUCT_TYPEDEFS; typedef std::tuple tuple_type; MultiResponseGLMAccumulator(Init_type& inInitialization); void bind(ByteStream_type& inStream); MultiResponseGLMAccumulator& operator<<(const tuple_type& inTuple); template MultiResponseGLMAccumulator& operator<<(const MultiResponseGLMAccumulator& inOther); template MultiResponseGLMAccumulator& operator=(const MultiResponseGLMAccumulator& inOther); void apply(); void reset(); bool empty() const { return this->num_rows == 0; } uint16_type num_features; uint16_type num_categories; uint64_type num_rows; bool_type terminated; double_type loglik; convex::Newton optimizer; Matrix_type vcov; }; // ------------------------------------------------------------------------ class MultiResponseGLMResult { public: template MultiResponseGLMResult( const MultiResponseGLMAccumulator& inState); template MultiResponseGLMResult& compute( const MultiResponseGLMAccumulator& inState); // native arrays returns to db without copying double loglik; MutableNativeMatrix coef; MutableNativeMatrix std_err; MutableNativeMatrix z_stats; MutableNativeMatrix p_values; uint64_t num_rows_processed; }; } // namespace glm } // namespace modules } // namespace madlib #endif // defined(MADLIB_MODULES_GLM_MULTIRESPONSEGLM_PROTO_HPP)