Skip to content

Instantly share code, notes, and snippets.

@drewsday
Created July 25, 2018 19:47
Show Gist options
  • Save drewsday/10fb7ab6080f4456c6ed65caf2ecf006 to your computer and use it in GitHub Desktop.
Save drewsday/10fb7ab6080f4456c6ed65caf2ecf006 to your computer and use it in GitHub Desktop.
My attempt to simulate the retirement of images from a Zooniverse project given a retirement limit (variable = limit) and the number of subjects (variable = subjects).
import numpy as np
sim_trial = []
num_sim_trials = 100
for i in range(num_sim_trials):
#initiate a dictionary of subject ids with counts all set to 0
subjects = 3500
subject_counts = {}
for i in range(subjects):
subject_counts[i] = 0
#Initiate some other parameters
retired_count = 0
num_classifications = 0
limit = 6
count = 0
while count < limit*subjects:
x = np.random.randint(0,subjects)
if subject_counts[x]< limit:
subject_counts[x] = subject_counts[x]+1
count = count +1
if subject_counts[x] == limit:
retired_count = retired_count + 1
#print(retired_count," items retired! After ",100*count/(limit*subjects),"% classifications.")
#if retired_count == 1:
sim_trial.append(100*count/(limit*subjects))
print(np.mean(sim_trial[1::3500]))
print(np.std(sim_trial[1::3500]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment