random realizations given probability

Viewed 41

I have a features matrix X (Nx3) and a labeled target y (Nx1). The number of labels is 7. I want to predict to X_new (Mx3)

I use random forest

clf = RandomForestClassifier(random_state=0)
clf.fit(X,y)
prediction=clf.predict(X_new)
probability=clf.predit_proba(X_new)

Now, I have prediction (Mx1) and probability (Mx7).

I want to make 1000 random realizations from the prediction, using of course the probability. That means, if probability==1 in one predicted value, it will never change, while if probability==0.5 it can vary. Where can I start looking?

0 Answers
Related