Exemple #1
0
 def test_submission(self):
     train_data = extract_features(load_adult_train_data())
     valid_data = extract_features(load_adult_valid_data())
     model = submission(train_data)
     predictions = [predict(model, p) for p in train_data]
     print
     print
     print "Training Accuracy:", accuracy(train_data, predictions)
     predictions = [predict(model, p) for p in valid_data]
     print "Validation Accuracy:", accuracy(valid_data, predictions)
     print
Exemple #2
0
 def test_submission(self):
     train_data = extract_features(load_adult_train_data())
     valid_data = extract_features(load_adult_valid_data())
     model = submission(train_data)
     predictions = [predict(model, p) for p in train_data]
     print()
     print()
     print("Training Accuracy:", accuracy(train_data, predictions))
     predictions = [predict(model, p) for p in valid_data]
     print("Validation Accuracy:", accuracy(valid_data, predictions))
     print()
 def test_submission(self):
     """Overall test.
     """
     train_data = extract_features(load_adult_train_data())
     valid_data = extract_features(load_adult_valid_data())
     model = submission(train_data)
     predictions = [predict(model, p) for p in train_data]
     print("Training Accuracy: {0}".format(
         accuracy(train_data, predictions)))
     predictions = [predict(model, p) for p in valid_data]
     print("Validation Accuracy: {0}".format(
         accuracy(valid_data, predictions)))
Exemple #4
0
 def test_accuracy(self):
     data = extract_features(load_adult_train_data())
     a = accuracy(data, [0.4]*len(data))
     self.assertAlmostEqual(a, 0.751077514754)
Exemple #5
0
 def test_accuracy(self):
     data = extract_features(load_adult_train_data())
     a = accuracy(data, [0]*len(data))
     self.assertAlmostEqual(a, 0.751077514754)
Exemple #6
0
        max_num_faces = max(max_num_faces, len(item_dict))

        # predict for result of one picture
        predictions = []
        for i in range(0, len(item_dict)):
            face = {}
            face["faceRectangle"] = item_dict[i]["faceRectangle"]
            face["result"] = (predict(
                model, extract_features_single_point(item_dict[i]["scores"]))
                              >= 0.5)
            predictions.append(face)
        predictions_all.append(predictions)

    print max_num_faces
    return predictions_all, max_num_faces


if __name__ == "__main__":
    # prepare the model
    train_data = extract_features(load_adult_train_data())
    model = submission(train_data)
    print model
    predictions = [predict(model, p) for p in train_data]
    print
    print
    print "Training Accuracy:", accuracy(train_data, predictions)

    app.run(host='ec2-52-206-17-234.compute-1.amazonaws.com',
            port=8000,
            threaded=True)
Exemple #7
0
 def test_accuracy(self):
     """Tests the accuracy calculation.
     """
     data = extract_features(load_adult_train_data())
     a = accuracy(data, [0] * len(data))
     self.assertAlmostEqual(a, 0.7636129)