X_train = features[:Ntrain] X_test = features[Ntrain:] y_train = label[:Ntrain] y_test = label[Ntrain:] ############################################################################ # simulate active learning process accuracy = [] Nrecs = 200; # number of new labels in each iteration for k in range(6): # 1. train model with training data, and recommend samples for labeling out = AL.process(X_train, y_train, X_test, Nrecs, 'SVM') IDtoLabel = out['IDtoLabel'] relevanceScore = out['relevanceScore'] # 2. assume get the expert feedback y_newlabel = y_test[IDtoLabel] # For Simulation purpose # performance evaluation: calculate prediction accuracy classifier = out['classifier'] y_test_predicted = classifier.predict(X_test) out = evaluate(y_test, y_test_predicted) accuracy.append(out['accuracy']) # updated y_test
X_train = features[:Ntrain] X_test = features[Ntrain:] y_train = label[:Ntrain] y_test = label[Ntrain:] ############################################################################ # simulate active learning process accuracy = [] Nrecs = 50; # number of new labels in each iteration for k in range(6): # 1. train model with training data, and recommend samples for labeling out = AL.process(X_train, y_train, X_test, Nrecs, 'SVM', 'entropy') IDtoLabel = out['IDtoLabel'] relevanceScore = out['relevanceScore'] # 2. assume get the expert feedback y_newlabel = y_test[IDtoLabel] # For Simulation purpose # performance evaluation: calculate prediction accuracy classifier = out['classifier'] y_test_predicted = classifier.predict(X_test) out = evaluate(y_test, y_test_predicted) accuracy.append(out['accuracy']) # updated y_test