Skip to content

Conversation

@shrit
Copy link
Member

@shrit shrit commented Feb 10, 2024

No description provided.

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.

I have not reviewed this deeply (yet). Another option that may be better is the use of fill::randu or fill::randn in the constructor, or the use of member .randu() or .randn().

*
* @code
* // 100-point 5-dimensional random dataset.
* arma::mat data = arma::randu<arma::mat>(5, 100);
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't change the examples.

* the 3-clause BSD license along with ensmallen. If not, see
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#ifndef MLPACK_CORE_UTIL_RAND_HPP
Copy link
Member

Choose a reason for hiding this comment

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

There is already a lot of random number support in math/ (I just documented it). Although these functions are internal, and we shouldn't document them externally, it would still be a good idea to see if we can make them match our existing RNG functionalities a bit better.

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe mix this file with that one?

@shrit
Copy link
Member Author

shrit commented Feb 14, 2024

Actually, it makes sense to use .randu and .randn I will apply these changes.
I will keep the overload of these functions as Randu and Randn in cases we might need them

@shrit
Copy link
Member Author

shrit commented Feb 15, 2024

This is ready for review, I am not adding anything else

@shrit shrit requested a review from rcurtin February 24, 2024 15:44
@shrit
Copy link
Member Author

shrit commented Feb 24, 2024

@rcurtin this is ready finally for a review

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.

Looks good---the changes are much simpler with using instead of ADL. 👍

DataType sample = arma::randu<DataType>
(probability.n_rows, probability.n_cols);
DataType sample;
sample.randu(probability.n_rows, probability.n_cols);
Copy link
Member

Choose a reason for hiding this comment

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

We could go back to the standalone randu now, but, totally up to you---I think it's fine either way.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be honest, I would keep it this way, and I think we should do it this way going forward.

size_t upperBound = full ? capacity : position;
arma::uvec sampledIndices = arma::randi<arma::uvec>(
arma::uvec sampledIndices = randi<arma::uvec>(
batchSize, arma::distr_param(0, upperBound - 1));
Copy link
Member

Choose a reason for hiding this comment

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

This is a comment for later, but I'm interested what will happen here when we remove the arma:: from distr_param. If we have Bandicoot available, then both the arma::distr_param and coot::distr_param classes will be available, and the compiler will have to correctly select arma::distr_param. I think that this will work fine when we do it, but there is a possibility that there could be a problem we need to work around.

Anyway, nothing to do about that now, just a comment.

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 know, when I had ADL I was planning to use an additional template parameter DistrParam. However, there is a high chance that we will not needed for now.

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 104f158 into mlpack:master Feb 28, 2024
@shrit shrit deleted the coot_10 branch February 28, 2024 11:21
@rcurtin rcurtin mentioned this pull request May 26, 2024
@rcurtin rcurtin mentioned this pull request 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