forked from peret/visualize-bovw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runClassification.py
32 lines (24 loc) · 870 Bytes
/
runClassification.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Helper script to run the training for a single category."""
import sys
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier
from sklearn.svm import LinearSVC, SVC
from vcd import VisualConceptDetection
import os
import time
from util import svm
from datamanagers.CaltechManager import CaltechManager
import numpy as np
import pylab as pl
from runGridSearch import GridSearch
if __name__ == "__main__":
category = "airplanes"
total = time.time()
clf = RandomForestClassifier(n_estimators = 2000)
# clf = AdaBoostClassifier(n_estimators = 2000)
# clf.base_estimator.max_depth = 4
# clf = LinearSVC(C=100)
# clf = SVC(C=10)
dm = CaltechManager()
vcd = VisualConceptDetection(classifier=clf, datamanager=dm)
vcd.run(category)
print "Total execution time: %f minutes" % ((time.time() - total) / 60.0)