Ejemplo n.º 1
0
 def test_four(self):
     labels, truth = create_sim_dataset(1000, 6, 3, 0.8, 0.8, True, False,
                                        False)
     MLE = MLEOneParameterPerLabeler()
     ll_list = []
     results_list = []
     for i in range(5):
         results_list.append(MLE.fit(labels))
         ll_list.append(
             MLE.expert_models.log_likelihood(
                 labels, results_list[i]['class_names']))
     index = np.argmax(np.asarray(ll_list))
     accuracy = results_list[index]['accuracies']
     self.assertTrue(np.all(np.abs(accuracy - truth) < 0.075))
Ejemplo n.º 2
0
def no_oracle(y_noisy, p_classifier, y_vetted, X=None):

    y_classifier = np.argmax(p_classifier, axis=1)[:, np.newaxis]
    if y_noisy.ndim == 1:
        y_noisy = y_noisy.reshape(-1, 1)
    y_vetted = y_vetted.reshape(-1, 1)
    all_labels = np.hstack((y_classifier, y_noisy, y_vetted))
    all_labels = np.asarray(all_labels, dtype=np.object)
    all_labels[all_labels == -1] = np.nan

    results = MLEOneParameterPerLabeler(n_classes=np.size(p_classifier, axis=1)).fit(all_labels)
    return results['probs']
Ejemplo n.º 3
0
 def test_return_fields(self):
     mle_obj = MLEOneParameterPerLabeler()
     result = mle_obj.fit(MED_MATRIX)
     self.assertEqual(set(result.keys()), FIT_RETURN_SET)