Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

R sample() funciton in python


import numpy as np
np.random.choice(values, size=1000,  replace=True, p=probability)

# values is the input values that correspond to the weights
# size is the number of samples to generate
# Replace specifies if it's with or without replacement
# p is the probability of choosing each corresponding value in values
 
PREVIOUS NEXT
Tagged: #R #funciton #python
ADD COMMENT
Topic
Name
8+5 =