Consider the following code:
Eigen::VectorXf classify()
{
Eigen::VectorXf probability(4);
probability << 0.9, 0.8, -0.1, 0.2;
auto y_pred = probability.array() > 0.8; //what is the type of y_pred?
//y_pred looks like [1 0 0 0]
// how to return y_pred as a VectorXf?
// I'm trying this, but it is not working:
return static_cast<Eigen::VectorXf>(y_pred); //doesn't work
}
int main()
{
classify();
}
2 questions:
- (for my understanding) What is the type of
y_pred
? I was thinking it is anArrayXf
but it seems not to be the case - (the question this post is about) how can I convert
y_pred
to an Eigen vector (VectorXf
or something else)?