コード例 #1
0
for alpha in alpha_list:
    positive_count = sum([1 for x in X_positive if x >= alpha])
    positive_rate = positive_count / float(len(X_positive))

    negative_count = sum([1 for x in X_negative if x >= alpha])
    negative_rate = negative_count / float(len(X_negative))

    roc_X.append(negative_rate)
    roc_Y.append(positive_rate)

#print roc_X

plt.plot(roc_X, roc_Y, color="green")

classify = IterativeEM()
classify.__classify__(vote_list, 2)
estimates = classify.__getEstimates__()
X_positive = []
X_negative = []
for subject_index, zooniverse_id in enumerate(big_subjectList):
    probability = estimates[subject_index]
    wreness_condor = gold_condor[subject_index]

    if wreness_condor == 0:
        X_negative.append(probability)
    else:
        X_positive.append(probability)

alpha_list = X_negative[:]
alpha_list.extend(X_positive)
alpha_list.sort()
コード例 #2
0
ファイル: condor_IBCC.py プロジェクト: JiaminXuan/aggregation
    negative_count = sum([1 for x in X_negative if x >= alpha])
    negative_rate = negative_count/float(len(X_negative))

    roc_X.append(negative_rate)
    roc_Y.append(positive_rate)



#print roc_X

plt.plot(roc_X,roc_Y,color="green")


classify = IterativeEM()
classify.__classify__(vote_list,2)
estimates = classify.__getEstimates__()
X_positive = []
X_negative = []
for subject_index,zooniverse_id in enumerate(big_subjectList):
    probability = estimates[subject_index]
    wreness_condor = gold_condor[subject_index]

    if wreness_condor == 0:
        X_negative.append(probability)
    else:
        X_positive.append(probability)

alpha_list = X_negative[:]
alpha_list.extend(X_positive)
alpha_list.sort()
コード例 #3
0
ファイル: animal_EM.py プロジェクト: lelou6666/aggregation
                        votes.append((user_index, animal_index, 1))
                        if not (animal_index in animal_votes):
                            animal_votes[animal_index] = [1]
                        else:
                            animal_votes[animal_index].append(1)
                    else:
                        votes.append((user_index, animal_index, 0))
                        if not (animal_index in animal_votes):
                            animal_votes[animal_index] = [0]
                        else:
                            animal_votes[animal_index].append(0)

print "=====---"
#print votes
classify = IterativeEM()
classify.__classify__(votes)

most_likely = classify.__getMostLikely__()
estimates = classify.__getEstimates__()

X = []
Y = []
X2 = []
Y2 = []

#for subject_index,zooniverse_id in enumerate(big_subjectList):
for ii in range(animal_index):
    x = np.mean(animal_votes[ii])

    y = estimates[ii][1]
    X.append(x)
コード例 #4
0
ファイル: condor_EM.py プロジェクト: alexbfree/aggregation
                votes.append((user_index, subject_index, 0))
                if not (zooniverse_id in subject_vote):
                    subject_vote[zooniverse_id] = [0]
                else:
                    subject_vote[zooniverse_id].append(0)

        except ValueError:
            votes.append((user_index, subject_index, 0))
            if not (zooniverse_id in subject_vote):
                subject_vote[zooniverse_id] = [0]
            else:
                subject_vote[zooniverse_id].append(0)

print "=====---"
classify = IterativeEM()
classify.__classify__(votes)

most_likely = classify.__getMostLikely__()
estimates = classify.__getEstimates__()

X = []
Y = []
X2 = []
Y2 = []

for subject_index, zooniverse_id in enumerate(big_subjectList):
    subject = subject_collection.find_one({"zooniverse_id": zooniverse_id})
    if zooniverse_id in subject_vote:
        x = np.mean(subject_vote[zooniverse_id])

        y = estimates[subject_index][1]
コード例 #5
0
ファイル: animal_EM3.py プロジェクト: JiaminXuan/aggregation
for animal,most_likely in zip(animal_votes,plurality_vote):
    for reported in animal:
        confusion[reported][most_likely] += 1

confusion = [[max(c/sum(row),0.005) for c in row] for row in confusion]


#print (confusion[3][0],confusion[3][3])

confusion_list= individual_confusion(votes,plurality_vote)
#for c in confusion_list:
#    print c
#assert False
#print votes
classify = IterativeEM()
classify.__classify__(votes,len(animals),confusion_list)

most_likely = classify.__getMostLikely__()
estimates = classify.__getEstimates__()

X = []
Y = []
X2 = []
Y2 = []
#print animals
#for subject_index,zooniverse_id in enumerate(big_subjectList):
for ii,votes in enumerate(animal_votes):
    percentage = [sum([1 for v in votes if v == a_t])/float(len(votes)) for a_t in range(len(animals))]
    EM_percentage = estimates[ii]

コード例 #6
0
ファイル: animal_EM3.py プロジェクト: lelou6666/aggregation
for animal, most_likely in zip(animal_votes, plurality_vote):
    for reported in animal:
        confusion[reported][most_likely] += 1

confusion = [[max(c / sum(row), 0.005) for c in row] for row in confusion]

#print (confusion[3][0],confusion[3][3])

confusion_list = individual_confusion(votes, plurality_vote)
#for c in confusion_list:
#    print c
#assert False
#print votes
classify = IterativeEM()
classify.__classify__(votes, len(animals), confusion_list)

most_likely = classify.__getMostLikely__()
estimates = classify.__getEstimates__()

X = []
Y = []
X2 = []
Y2 = []
#print animals
#for subject_index,zooniverse_id in enumerate(big_subjectList):
for ii, votes in enumerate(animal_votes):
    percentage = [
        sum([1 for v in votes if v == a_t]) / float(len(votes))
        for a_t in range(len(animals))
    ]
コード例 #7
0
ファイル: animal_EM2.py プロジェクト: lelou6666/aggregation
# #print (confusion[3][0],confusion[3][3])
#
# X,Y= individual_confusion(votes,plurality_vote)
# print X
# print Y
# plt.hist(X,bins=20)
# # plt.plot(X,Y,'.',color="blue")
# # plt.plot([X_avg,],[Y_avg,],'.',color="green")
# # plt.xlim((-0.05,1.05))
# # plt.ylim((0.95,1.05))
# plt.show()
# assert False

#print votes
classify = IterativeEM()
classify.__classify__(votes,len(animals),confusion,gold_values=gold_values)

most_likely = classify.__getMostLikely__()
estimates = classify.__getEstimates__()

X = []
Y = []
X2 = []
Y2 = []
#print animals
#for subject_index,zooniverse_id in enumerate(big_subjectList):
for ii,votes in enumerate(animal_votes):
    percentage = [sum([1 for v in votes if v == a_t])/float(len(votes)) for a_t in range(len(animals))]
    EM_percentage = estimates[ii]