I want to implement dropout i.e. randomly replace elements with NAs and return the vector/list back with NA values.
The wanted result is to reduce overfitting so there may be better convenience functions for this.
Approach 1
b<-rnorm(100); b[match(sample(b,10),b)] <- NA
where 10 values replaced with NA.
Approach 2. how to remove 90% of population? Not working, getting less than 90%:
b<-rnorm(99); b[match(sample(b,length(b)*0.9),b)] <- NA
that actually does not work because of possible matches i.e. selecting the same element.
Is there any builtin or convenience function for dropout?