Skip to content

Conversation

@shrit
Copy link
Member

@shrit shrit commented Jan 17, 2024

This PR converts all the arma::Mat<eT> in the init methods to MatType.
This should be merged quickly.

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, another easy PR to review. Everything here looks good. 👍

template<typename MatType>
struct GetColType
{
typedef arma::Row<typename MatType::elem_type> type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thank you!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are welcome, it is my fault, I reviewed this and it was good for me 😵‍💫

ColType s;

arma::svd_econ(W, s, V, arma::randu<arma::Mat<eT> >(rows, cols));
svd_econ(W, s, V, arma::randu<MatType>(rows, cols));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that Bandicoot doesn't currently have svd_econ(), but we can fix that later of course. 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, all of these need to be handled later, I will add this to the list in bandicoot we will do it in the next version.
I do not think a lot of us are using orthogonal initialisation for now

{
arma::Row<eT> b = s * arma::sqrt(3 / (W.n_rows * dataSum));
typedef typename GetRowType<MatType>::type RowType;
RowType b = s * arma::sqrt(3 / (W.n_rows * dataSum));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if for most of these implementations we could just call Initialize(W, W.n_rows, W.n_cols). Up to you if you want to take the effort to do that refactoring... and that assumes that the two functions are the same otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, maybe at the very end, because this will get refactored. We need to get rid of arma::sqrt and create a new safe function, so will see.

Copy link

@mlpack-bot mlpack-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second approval provided automatically after 24 hours. 👍

@shrit shrit merged commit b922d26 into mlpack:master Jan 19, 2024
This was referenced May 26, 2024
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.

2 participants