├── .gitignore ├── LICENSE ├── README.md ├── al ├── __init__.py ├── instance_strategies.py └── learning_curve.py ├── documentation ├── Makefile ├── _build │ ├── doctrees │ │ ├── code.doctree │ │ ├── environment.pickle │ │ └── index.doctree │ └── html │ │ ├── .buildinfo │ │ ├── _images │ │ ├── choose_clas_strat.png │ │ ├── choose_data.png │ │ ├── edit_parameters.png │ │ ├── gui_main.png │ │ ├── loaded_gui.png │ │ ├── run1.png │ │ └── show_plots.png │ │ ├── _sources │ │ ├── code.txt │ │ └── index.txt │ │ ├── _static │ │ ├── ajax-loader.gif │ │ ├── basic.css │ │ ├── comment-bright.png │ │ ├── comment-close.png │ │ ├── comment.png │ │ ├── contents.png │ │ ├── doctools.js │ │ ├── down-pressed.png │ │ ├── down.png │ │ ├── file.png │ │ ├── jquery-1.11.1.js │ │ ├── jquery.js │ │ ├── minus.png │ │ ├── navigation.png │ │ ├── plus.png │ │ ├── pygments.css │ │ ├── searchtools.js │ │ ├── sphinxdoc.css │ │ ├── underscore-1.3.1.js │ │ ├── underscore.js │ │ ├── up-pressed.png │ │ ├── up.png │ │ └── websupport.js │ │ ├── code.html │ │ ├── genindex.html │ │ ├── index.html │ │ ├── objects.inv │ │ ├── py-modindex.html │ │ ├── search.html │ │ └── searchindex.js ├── _images │ ├── choose_clas_strat.png │ ├── choose_data.png │ ├── edit_parameters.png │ ├── gui_main.png │ ├── loaded_gui.png │ ├── run1.png │ └── show_plots.png ├── _static │ ├── ajax-loader.gif │ ├── basic.css │ ├── comment-bright.png │ ├── comment-close.png │ ├── comment.png │ ├── contents.png │ ├── doctools.js │ ├── down-pressed.png │ ├── down.png │ ├── file.png │ ├── jquery-1.11.1.js │ ├── jquery.js │ ├── minus.png │ ├── navigation.png │ ├── plus.png │ ├── pygments.css │ ├── searchtools.js │ ├── sphinxdoc.css │ ├── underscore-1.3.1.js │ ├── underscore.js │ ├── up-pressed.png │ ├── up.png │ └── websupport.js ├── code.rst ├── conf.py └── index.rst ├── empirical_study_datasets ├── real │ ├── calhousing.zip │ ├── hiva.zip │ ├── ibn_sina.zip │ ├── kdd99_10perc.zip │ ├── letterAM.zip │ ├── letterO.zip │ ├── nova.zip │ ├── orange.zip │ ├── sylva.zip │ └── zebra.zip └── synthetic │ ├── nb_1001att_0_0025mi_10sd_0_01_0_99dist_test.zip │ ├── nb_1001att_0_0025mi_10sd_0_01_0_99dist_train.zip │ ├── nb_1001att_0_0025mi_10sd_0_1_0_9dist_test.zip │ ├── nb_1001att_0_0025mi_10sd_0_1_0_9dist_train.zip │ ├── nb_1001att_0_0025mi_10sd_0_25_0_75dist_test.zip │ ├── nb_1001att_0_0025mi_10sd_0_25_0_75dist_train.zip │ ├── nb_1001att_0_0025mi_10sd_0_5_0_5dist_test.zip │ └── nb_1001att_0_0025mi_10sd_0_5_0_5dist_train.zip ├── front_end ├── __init__.py ├── cl │ ├── __init__.py │ ├── avg_results.txt │ ├── run_al_cl.py │ └── run_t_test.py └── gui │ ├── __init__.py │ ├── files │ └── run_list.txt │ ├── img │ ├── background.jpg │ ├── blank_acc.png │ └── blank_auc.png │ ├── plot_vals.py │ └── run_al_gui.py ├── setup.py └── utils ├── __init__.py └── utils.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | bin/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # Installer logs 26 | pip-log.txt 27 | pip-delete-this-directory.txt 28 | 29 | # Unit test / coverage reports 30 | htmlcov/ 31 | .tox/ 32 | .coverage 33 | .cache 34 | nosetests.xml 35 | coverage.xml 36 | 37 | # Translations 38 | *.mo 39 | 40 | # Mr Developer 41 | .mr.developer.cfg 42 | .project 43 | .pydevproject 44 | 45 | # Rope 46 | .ropeproject 47 | 48 | # Django stuff: 49 | *.log 50 | *.pot 51 | 52 | # Sphinx documentation 53 | docs/_build/ 54 | 55 | # Projects Pycharm 56 | .idea/ 57 | generate_plot_web.py -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Active Learning Library 2 | == 3 | # pyAL 4 | -------------- 5 | pyAL is an python library that implements common active learning strategies. The project is currently developed by the members of the Machine Learning Lab at IIT: (http://ml.cs.iit.edu). 6 | 7 | This work is supported by NSF CAREER Award #1350337. http://nsf.gov/awardsearch/showAward?AWD_ID=1350337 8 | 9 | Currently supported strategies: 10 | 11 | 1. Random sampling 12 | 2. Uncertainty sampling by Lewis and Gale, 1994. A sequential algorithm for training text classifiers. Proceedings of the 17th annual international ACM SIGIR conference on Research and development in information retrieval. 13 | 3. Query-by-committee by Seung et al, 1992. Query by committee. Proceedings of the fifth annual workshop on Computational learning theory. 14 | 4. Expected error reduction by Roy and McCallum, 2001. Toward optimal active learning through monte carlo estimation of error reduction. Proceedings of the Eighteenth International Conference on Machine Learning. 15 | 16 | # Related Links 17 | -------------- 18 | * Machine Learning Lab @ IIT (http://cs.iit.edu/~ml) 19 | * Documentation: (http://iitml.github.io/AL/) 20 | 21 | 22 | # Dependencies 23 | ----------- 24 | pyAL is tested to work under Python 2.7. The required dependencies to build the software are scikit-learn >= 0.15, NumPy >= 1.6.2, and SciPy >= 0.9. 25 | 26 | 27 | # Installation 28 | ---------------- 29 | This package uses distutils, which is the default way of installing python modules. To install in your home directory, use: 30 | 31 | python setup.py install --user 32 | To install for all users on Unix/Linux: 33 | ``` 34 | $ python setup.py build 35 | $ sudo python setup.py install 36 | ``` 37 | 38 | # Content of this Repository 39 | This repository is organized as follows: 40 | 41 | * ```al```: contains the code 42 | * ```documentation```: contains the documentation of the classes 43 | * ```front_end```: containts the GUI 44 | * ```utils```: contains the utilities 45 | 46 | # Development 47 | 48 | ## Code - GIT 49 | 50 | You can check the latest sources with the command: 51 | 52 | ``` 53 | git clone git@github.com:iitml/AL.git 54 | ``` 55 | 56 | # How to use this Library 57 | 58 | ## GUI Example 59 | 60 | * Example about how to use the GUI: (http://iitml.github.io/AL/code.html#id1) 61 | 62 | ## Module Example 63 | ```python 64 | from al.learning_curve import LearningCurve 65 | 66 | learning_api = LearningCurve() 67 | 68 | training_size, avg_accu, avg_auc = learning_api.run_trials(X_pool, y_pool, X_test, y_test, strategy, classifier, alpha, boot_strap_size, step_size, budget, num_trials) 69 | ``` 70 | -------------------------------------------------------------------------------- /al/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/al/__init__.py -------------------------------------------------------------------------------- /al/instance_strategies.py: -------------------------------------------------------------------------------- 1 | """ 2 | The :mod:`al.instance_strategies` implements various active learning strategies. 3 | """ 4 | 5 | import math 6 | import numpy as np 7 | from collections import defaultdict 8 | 9 | import scipy.sparse as ss 10 | 11 | class RandomBootstrap(object): 12 | """Class - used if strategy selected is rand""" 13 | def __init__(self, seed): 14 | """Instantiate :mod:`al.instance_strategies.RandomBootstrap` 15 | 16 | **Parameters** 17 | 18 | * seed (*int*) - trial number. 19 | 20 | """ 21 | self.randS = RandomStrategy(seed) 22 | 23 | def bootstrap(self, pool, y=None, k=1): 24 | """ 25 | 26 | **Parameters** 27 | 28 | * pool (*int*) - range of numbers within length of pool 29 | * y - None or possible pool 30 | * k (*int*) - 1 or possible bootstrap size 31 | 32 | **Returns** 33 | 34 | * randS.chooseNext(pool, k=k) - choose next pool 35 | 36 | """ 37 | return self.randS.chooseNext(pool, k=k) 38 | 39 | class BootstrapFromEach(object): 40 | """Class - used if not bootstrapped""" 41 | def __init__(self, seed): 42 | """Instantiate :mod:`al.instance_strategies.BootstrapFromEach` 43 | 44 | **Parameters** 45 | 46 | * seed (*int*) - trial number. 47 | 48 | """ 49 | self.randS = RandomStrategy(seed) 50 | 51 | def bootstrap(self, pool, y, k=1): 52 | """ 53 | 54 | **Parameters** 55 | 56 | * pool (*int*) - range of numbers within length of pool 57 | * y - None or possible pool 58 | * k (*int*) - 1 or possible bootstrap size 59 | 60 | **Returns** 61 | 62 | * chosen array of indices 63 | 64 | """ 65 | data = defaultdict(lambda: []) 66 | for i in pool: 67 | data[y[i]].append(i) 68 | chosen = [] 69 | num_classes = len(data.keys()) 70 | for label in data.keys(): 71 | candidates = data[label] 72 | indices = self.randS.chooseNext(candidates, k=k/num_classes) 73 | chosen.extend(indices) 74 | return chosen 75 | 76 | 77 | class BaseStrategy(object): 78 | """Class - Base strategy""" 79 | def __init__(self, seed=0): 80 | """Instantiate :mod:`al.instance_strategies.BaseStrategy` 81 | 82 | **Parameters** 83 | 84 | * seed (*int*) - 0 or trial number. 85 | 86 | """ 87 | self.randgen = np.random.RandomState(seed) 88 | 89 | def chooseNext(self, pool, X=None, model=None, k=1, current_train_indices = None, current_train_y = None): 90 | pass 91 | 92 | class RandomStrategy(BaseStrategy): 93 | """Class - used if strategy is rand, inherits from :mod:`al.instance_strategies.BaseStrategy`""" 94 | def chooseNext(self, pool, X=None, model=None, k=1, current_train_indices = None, current_train_y = None): 95 | """Overide method BaseStrategy.chooseNext 96 | 97 | **Parameters** 98 | 99 | * pool (*int*) - range of numbers within length of pool 100 | * X - None or pool.toarray() 101 | * model - None 102 | * k (*int*) - 1 or step size 103 | * current_train_indices - None or array of trained indices 104 | * current_train_y - None or train_indices specific to y_pool 105 | 106 | **Returns** 107 | 108 | * [list_pool[i] for i in rand_indices[:k]] - array of random permutations given pool 109 | 110 | """ 111 | list_pool = list(pool) 112 | rand_indices = self.randgen.permutation(len(pool)) 113 | return [list_pool[i] for i in rand_indices[:k]] 114 | 115 | class UncStrategy(BaseStrategy): 116 | """Class - used if strategy selected is unc, inherits from :mod:`al.instance_strategies.BaseStrategy`""" 117 | def __init__(self, seed=0, sub_pool = None): 118 | """Instantiate :mod:`al.instance_strategies.UncStrategy` 119 | 120 | **Parameters** 121 | 122 | * seed (*int*) - 0 or trial number. 123 | * sub_pool - None or sub_pool parameter 124 | 125 | """ 126 | super(UncStrategy, self).__init__(seed=seed) 127 | self.sub_pool = sub_pool 128 | 129 | def chooseNext(self, pool, X=None, model=None, k=1, current_train_indices = None, current_train_y = None): 130 | """Overide method BaseStrategy.chooseNext 131 | 132 | **Parameters** 133 | 134 | * pool (*int*) - range of numbers within length of pool 135 | * X - None or pool.toarray() 136 | * model - None 137 | * k (*int*) - 1 or step size 138 | * current_train_indices - None or array of trained indices 139 | * current_train_y - None or train_indices specific to y_pool 140 | 141 | **Returns** 142 | 143 | * [candidates[i] for i in uis[:k]] 144 | 145 | """ 146 | 147 | if not self.sub_pool: 148 | rand_indices = self.randgen.permutation(len(pool)) 149 | array_pool = np.array(list(pool)) 150 | candidates = array_pool[rand_indices[:self.sub_pool]] 151 | else: 152 | candidates = list(pool) 153 | 154 | if ss.issparse(X): 155 | if not ss.isspmatrix_csr(X): 156 | X = X.tocsr() 157 | 158 | probs = model.predict_proba(X[candidates]) 159 | uncerts = np.min(probs, axis=1) 160 | uis = np.argsort(uncerts)[::-1] 161 | chosen = [candidates[i] for i in uis[:k]] 162 | return chosen 163 | 164 | class QBCStrategy(BaseStrategy): 165 | """Class - used if strategy selected is qbc, inherits from :mod:`al.instance_strategies.BaseStrategy`""" 166 | def __init__(self, classifier, classifier_args, seed=0, sub_pool = None, num_committee = 10): 167 | """Instantiate :mod:`al.instance_strategies.QBCStrategy` 168 | 169 | **Parameters** 170 | 171 | * classifier - Represents the classifier that will be used (default: MultinomialNB). 172 | * classifier_args - Represents the arguments that will be passed to the classifier (default: ''). 173 | * seed (*int*) - 0 or trial number. 174 | * sub_pool - None or sub_pool parameter 175 | * num_committee - 4 176 | 177 | """ 178 | super(QBCStrategy, self).__init__(seed=seed) 179 | self.sub_pool = sub_pool 180 | self.num_committee = num_committee 181 | self.classifier = classifier 182 | self.classifier_args = classifier_args 183 | 184 | 185 | def vote_entropy(self, sample): 186 | """ Computes vote entropy. 187 | 188 | **Parameters** 189 | 190 | * sample 191 | 192 | **Returns** 193 | 194 | * out (*int*) 195 | 196 | """ 197 | votes = defaultdict(lambda: 0.0) 198 | size = float(len(sample)) 199 | 200 | for i in sample: 201 | votes[i] += 1.0 202 | 203 | out = 0 204 | for i in votes: 205 | aux = (float(votes[i]/size)) 206 | out += ((aux*math.log(aux, 2))*-1.) 207 | 208 | return out 209 | 210 | def chooseNext(self, pool, X=None, model=None, k=1, current_train_indices = None, current_train_y = None): 211 | """Overide method BaseStrategy.chooseNext 212 | 213 | **Parameters** 214 | 215 | * pool (*int*) - range of numbers within length of pool 216 | * X - None or pool.toarray() 217 | * model - None 218 | * k (*int*) - 1 or step size 219 | * current_train_indices - None or array of trained indices 220 | * current_train_y - None or train_indices specific to y_pool 221 | 222 | **Returns** 223 | 224 | * [candidates[i] for i in dis[:k]] 225 | 226 | """ 227 | 228 | if not self.sub_pool: 229 | rand_indices = self.randgen.permutation(len(pool)) 230 | array_pool = np.array(list(pool)) 231 | candidates = array_pool[rand_indices[:self.sub_pool]] 232 | else: 233 | candidates = list(pool) 234 | 235 | if ss.issparse(X): 236 | if not ss.isspmatrix_csr(X): 237 | X = X.tocsr() 238 | 239 | # Create bags 240 | 241 | comm_predictions = [] 242 | 243 | for c in range(self.num_committee): 244 | # Make sure that we have at least one of each label in each bag 245 | bfe = BootstrapFromEach(seed=c) 246 | num_labels = len(np.unique(current_train_y)) 247 | initial = bfe.bootstrap(range(len(current_train_indices)), current_train_y, num_labels) 248 | 249 | r_inds = self.randgen.randint(0, len(current_train_indices), size=len(current_train_indices)-num_labels) 250 | r_inds = np.hstack((r_inds, np.array(initial))) 251 | 252 | bag = [current_train_indices[i] for i in r_inds] 253 | bag_y = [current_train_y[i] for i in r_inds] 254 | new_classifier = self.classifier(**self.classifier_args) 255 | new_classifier.fit(X[bag], bag_y) 256 | 257 | predictions = new_classifier.predict(X[candidates]) 258 | 259 | comm_predictions.append(predictions) 260 | 261 | # Compute disagreement for com_predictions 262 | 263 | disagreements = [] 264 | for i in range(len(comm_predictions[0])): 265 | aux_candidates = [] 266 | for prediction in comm_predictions: 267 | aux_candidates.append(prediction[i]) 268 | disagreement = self.vote_entropy(aux_candidates) 269 | disagreements.append(disagreement) 270 | 271 | dis = np.argsort(disagreements)[::-1] 272 | chosen = [candidates[i] for i in dis[:k]] 273 | 274 | return chosen 275 | 276 | class LogGainStrategy(BaseStrategy): 277 | """Class - used if strategy selected is loggain, inherits from :mod:`al.instance_strategies.BaseStrategy`""" 278 | def __init__(self, classifier, classifier_args, seed = 0, sub_pool = None): 279 | """Instantiate :mod:`al.instance_strategies.UncStrategy` 280 | 281 | **Parameters** 282 | 283 | * classifier - Represents the classifier that will be used (default: MultinomialNB). 284 | * classifier_args - Represents the arguments that will be passed to the classifier (default: ''). 285 | * seed (*int*) - 0 or trial number. 286 | * sub_pool - None or sub_pool parameter 287 | 288 | """ 289 | super(LogGainStrategy, self).__init__(seed=seed) 290 | self.classifier = classifier 291 | self.sub_pool = sub_pool 292 | self.classifier_args = classifier_args 293 | 294 | def log_gain(self, probs, labels): 295 | """Computes log_gain 296 | 297 | **Parameters** 298 | 299 | * probs, labels 300 | 301 | **Returns** 302 | 303 | * lg - computed log_gain 304 | 305 | """ 306 | lg = 0 307 | for i in xrange(len(probs)): 308 | lg -= np.log(probs[i][int(labels[i])]) 309 | return lg 310 | 311 | def chooseNext(self, pool, X=None, model=None, k=1, current_train_indices = None, current_train_y = None): 312 | """Overide method BaseStrategy.chooseNext 313 | 314 | **Parameters** 315 | 316 | * pool (*int*) - range of numbers within length of pool 317 | * X - None or pool.toarray() 318 | * model - None 319 | * k (*int*) - 1 or step size 320 | * current_train_indices - None or array of trained indices 321 | * current_train_y - None or train_indices specific to y_pool 322 | 323 | **Returns** 324 | 325 | * [candidates[i] for i in uis[:k]] 326 | 327 | """ 328 | 329 | 330 | if not self.sub_pool: 331 | rand_indices = self.randgen.permutation(len(pool)) 332 | array_pool = np.array(list(pool)) 333 | candidates = array_pool[rand_indices[:self.sub_pool]] 334 | else: 335 | candidates = list(pool) 336 | 337 | if ss.issparse(X): 338 | if not ss.isspmatrix_csr(X): 339 | X = X.tocsr() 340 | 341 | cand_probs = model.predict_proba(X[candidates]) 342 | 343 | utils = [] 344 | 345 | for i in xrange(len(candidates)): 346 | #assume binary 347 | new_train_inds = list(current_train_indices) 348 | new_train_inds.append(candidates[i]) 349 | util = 0 350 | for c in [0, 1]: 351 | new_train_y = list(current_train_y) 352 | new_train_y.append(c) 353 | new_classifier = self.classifier(**self.classifier_args) 354 | new_classifier.fit(X[new_train_inds], new_train_y) 355 | new_probs = new_classifier.predict_proba(X[current_train_indices]) 356 | util += cand_probs[i][c] * self.log_gain(new_probs, current_train_y) 357 | 358 | utils.append(util) 359 | 360 | uis = np.argsort(utils) 361 | 362 | 363 | chosen = [candidates[i] for i in uis[:k]] 364 | 365 | return chosen 366 | 367 | class ErrorReductionStrategy(BaseStrategy): 368 | """Class - used if strategy selected is erreduct, inherits from :mod:`al.instance_strategies.BaseStrategy`""" 369 | def __init__(self, classifier, classifier_args, seed = 0, sub_pool = None): 370 | """Instantiate :mod:`al.instance_strategies.ErrorReductionStrategy` 371 | 372 | **Parameters** 373 | 374 | * classifier - Represents the classifier that will be used (default: MultinomialNB). 375 | * classifier_args - Represents the arguments that will be passed to the classifier (default: ''). 376 | * seed (*int*) - 0 or trial number. 377 | * sub_pool - None or sub_pool parameter 378 | 379 | """ 380 | super(ErrorReductionStrategy, self).__init__(seed=seed) 381 | self.classifier = classifier 382 | self.sub_pool = sub_pool 383 | self.classifier_args = classifier_args 384 | 385 | def log_loss(self, probs): 386 | """Computes log_loss 387 | 388 | **Parameters** 389 | 390 | * probs 391 | 392 | **Returns** 393 | 394 | * ll/(len(probs)*1.) 395 | 396 | """ 397 | ll = 0 398 | 399 | for i in xrange(len(probs)): 400 | for prob in probs[i]: 401 | ll -= (prob*np.log(prob)) 402 | 403 | return ll/(len(probs)*1.) 404 | 405 | def chooseNext(self, pool, X=None, model=None, k=1, current_train_indices = None, current_train_y = None): 406 | """Overide method BaseStrategy.chooseNext 407 | 408 | **Parameters** 409 | 410 | * pool (*int*) - range of numbers within length of pool 411 | * X - None or pool.toarray() 412 | * model - None 413 | * k (*int*) - 1 or step size 414 | * current_train_indices - None or array of trained indices 415 | * current_train_y - None or train_indices specific to y_pool 416 | 417 | **Returns** 418 | 419 | * [candidates[i] for i in uis[:k]] 420 | 421 | """ 422 | 423 | if not self.sub_pool: 424 | rand_indices = self.randgen.permutation(len(pool)) 425 | array_pool = np.array(list(pool)) 426 | candidates = array_pool[rand_indices[:self.sub_pool]] 427 | else: 428 | candidates = list(pool) 429 | 430 | if ss.issparse(X): 431 | if not ss.isspmatrix_csr(X): 432 | X = X.tocsr() 433 | 434 | cand_probs = model.predict_proba(X[candidates]) 435 | 436 | utils = [] 437 | 438 | for i in xrange(len(candidates)): 439 | #assume binary 440 | new_train_inds = list(current_train_indices) 441 | new_train_inds.append(candidates[i]) 442 | util = 0 443 | for c in [0, 1]: 444 | new_train_y = list(current_train_y) 445 | new_train_y.append(c) 446 | new_classifier = self.classifier(**self.classifier_args) 447 | new_classifier.fit(X[new_train_inds], new_train_y) 448 | new_probs = new_classifier.predict_proba(X[candidates]) #X[current_train_indices] = labeled = L 449 | util += cand_probs[i][c] * self.log_loss(new_probs) 450 | 451 | utils.append(util) 452 | 453 | uis = np.argsort(utils) 454 | 455 | 456 | chosen = [candidates[i] for i in uis[:k]] 457 | 458 | return chosen 459 | 460 | 461 | class RotateStrategy(BaseStrategy): 462 | """Class - inherits from :mod:`al.instance_strategies.BaseStrategy`""" 463 | def __init__(self, strategies): 464 | """Instantiate :mod:`al.instance_strategies.ErrorReductionStrategy` 465 | 466 | **Parameters** 467 | 468 | * strategies 469 | 470 | """ 471 | super(RotateStrategy, self).__init__(seed=0) 472 | self.strategies = strategies 473 | self.counter = -1 474 | 475 | def chooseNext(self, pool, X=None, model=None, k=1, current_train_indices = None, current_train_y = None): 476 | """Overide method BaseStrategy.chooseNext 477 | 478 | **Parameters** 479 | 480 | * pool (*int*) - range of numbers within length of pool 481 | * X - None or pool.toarray() 482 | * model - None 483 | * k (*int*) - 1 or step size 484 | * current_train_indices - None or array of trained indices 485 | * current_train_y - None or train_indices specific to y_pool 486 | 487 | **Returns** 488 | 489 | * self.strategies[self.counter].chooseNext(pool, X, model, k=k, current_train_indices = current_train_indices, current_train_y = current_train_y) 490 | 491 | """ 492 | self.counter = (self.counter+1) % len(self.strategies) 493 | return self.strategies[self.counter].chooseNext(pool, X, model, k=k, current_train_indices = current_train_indices, current_train_y = current_train_y) 494 | -------------------------------------------------------------------------------- /al/learning_curve.py: -------------------------------------------------------------------------------- 1 | """ 2 | The :mod:`al.learning_curve` implements the methods needed to 3 | run a given active learning strategy. 4 | """ 5 | 6 | import numpy as np 7 | 8 | 9 | from collections import defaultdict 10 | 11 | from sklearn import metrics 12 | 13 | from sklearn.naive_bayes import MultinomialNB, GaussianNB, BernoulliNB 14 | from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier 15 | from sklearn.linear_model import LogisticRegression 16 | from sklearn.neighbors import KNeighborsClassifier 17 | from sklearn.svm import SVC 18 | from sklearn.tree import DecisionTreeClassifier 19 | 20 | from instance_strategies import LogGainStrategy, RandomStrategy, UncStrategy, BootstrapFromEach, QBCStrategy, ErrorReductionStrategy 21 | 22 | class LearningCurve(object): 23 | """Class - run multiple trials or run trials one at a time""" 24 | def run_trials(self, X_pool, y_pool, X_test, y_test, al_strategy, classifier_name, classifier_arguments, bootstrap_size, step_size, budget, num_trials): 25 | """Runs a given active learning strategy multiple trials and returns 26 | the average performance. 27 | 28 | **Parameters** 29 | 30 | * X_pool - returned from load_svmlight_file 31 | * y_pool - returned from load_svmlight_file 32 | * X_test - returned from load_svmlight_file 33 | * y_test - returned from load_svmlight_file 34 | * al_strategy - Represent a list of strategies for choosing next samples (default - rand). 35 | * classifier_name - Represents the classifier that will be used (default - MultinomialNB) . 36 | * classifier_arguments - Represents the arguments that will be passed to the classifier (default - ''). 37 | * bootstrap_size - Sets the Boot strap (default - 10). 38 | * step_size - Sets the step size (default - 10). 39 | * budget - Sets the budget (default - 500). 40 | * num_trials - Number of trials (default - 10). 41 | 42 | **Returns** 43 | 44 | * (values, avg_accu, avg_auc) - training_size, respective average performance 45 | 46 | """ 47 | 48 | self.all_performances = {} 49 | 50 | average_performances = {} 51 | 52 | labels = np.unique(y_pool) 53 | 54 | measures = ["accuracy", "auc"] 55 | 56 | for measure in ["precision_", "recall_", "f1_"]: 57 | for label in labels: 58 | measures.append(measure+str(label)) 59 | 60 | 61 | for measure in measures: 62 | self.all_performances[measure] = defaultdict(list) 63 | average_performances[measure] = {} 64 | 65 | for t in range(num_trials): 66 | print "trial", t 67 | self._run_a_single_trial(X_pool, y_pool, X_test, y_test, al_strategy, classifier_name, classifier_arguments, bootstrap_size, step_size, budget, t) 68 | 69 | return self.all_performances 70 | 71 | # For now, assume each performance measure is evaluated at the same budget levels 72 | bs = sorted(self.all_performances["accuracy"].keys()) 73 | 74 | for b in bs: 75 | for measure in measures: 76 | average_performances[measure][b] = np.mean(self.all_performances[measure][b]) 77 | 78 | # for compatibility with the command line and gui, for now return only budget, accuracy, and auc 79 | 80 | return bs, average_performances["accuracy"], average_performances["auc"] 81 | 82 | def _run_a_single_trial(self, X_pool, y_pool, X_test, y_test, al_strategy, classifier_name, classifier_arguments, bootstrap_size, step_size, budget, t): 83 | """Helper method for running multiple trials.""" 84 | 85 | # This is a hack for running the empirical study experiments 86 | 87 | if len(y_pool) > 10000: 88 | rs = np.random.RandomState(t) 89 | indices = rs.permutation(len(y_pool)) 90 | pool = set(indices[:10000]) 91 | else: 92 | pool = set(range(len(y_pool))) 93 | 94 | trainIndices = [] 95 | 96 | bootstrapped = False 97 | 98 | # Choosing strategy 99 | if al_strategy == 'erreduct': 100 | active_s = ErrorReductionStrategy(classifier=classifier_name, seed=t, classifier_args=classifier_arguments) 101 | elif al_strategy == 'loggain': 102 | active_s = LogGainStrategy(classifier=classifier_name, seed=t, classifier_args=classifier_arguments) 103 | elif al_strategy == 'qbc': 104 | active_s = QBCStrategy(classifier=classifier_name, classifier_args=classifier_arguments) 105 | elif al_strategy == 'rand': 106 | active_s = RandomStrategy(seed=t) 107 | elif al_strategy == 'unc': 108 | active_s = UncStrategy(seed=t) 109 | 110 | model = None 111 | 112 | labels = np.unique(y_pool) 113 | 114 | #Loop for prediction 115 | while len(trainIndices) < budget and len(pool) >= step_size: 116 | 117 | if not bootstrapped: 118 | boot_s = BootstrapFromEach(t) 119 | newIndices = boot_s.bootstrap(pool, y=y_pool, k=bootstrap_size) 120 | bootstrapped = True 121 | else: 122 | newIndices = active_s.chooseNext(pool, X_pool, model, k=step_size, current_train_indices = trainIndices, current_train_y = y_pool[trainIndices]) 123 | 124 | pool.difference_update(newIndices) 125 | 126 | trainIndices.extend(newIndices) 127 | 128 | model = classifier_name(**classifier_arguments) 129 | 130 | model.fit(X_pool[trainIndices], y_pool[trainIndices]) 131 | 132 | # Prediction 133 | y_probas = model.predict_proba(X_test) 134 | y_pred = model.predict(X_test) 135 | 136 | # Measures 137 | 138 | self.all_performances["accuracy"][len(trainIndices)].append(metrics.accuracy_score(y_test, y_pred)) 139 | self.all_performances["auc"][len(trainIndices)].append(metrics.roc_auc_score(y_test, y_probas[:,1])) 140 | 141 | for label in labels: 142 | self.all_performances["precision_"+str(label)][len(trainIndices)].append(metrics.precision_score(y_test, y_pred, pos_label=label)) 143 | self.all_performances["recall_"+str(label)][len(trainIndices)].append(metrics.recall_score(y_test, y_pred, pos_label=label)) 144 | self.all_performances["f1_"+str(label)][len(trainIndices)].append(metrics.f1_score(y_test, y_pred, pos_label=label)) 145 | 146 | 147 | -------------------------------------------------------------------------------- /documentation/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | @echo " coverage to run coverage check of the documentation (if enabled)" 49 | 50 | clean: 51 | rm -rf $(BUILDDIR)/* 52 | 53 | html: 54 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 55 | @echo 56 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 57 | 58 | dirhtml: 59 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 60 | @echo 61 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 62 | 63 | singlehtml: 64 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 65 | @echo 66 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 67 | 68 | pickle: 69 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 70 | @echo 71 | @echo "Build finished; now you can process the pickle files." 72 | 73 | json: 74 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 75 | @echo 76 | @echo "Build finished; now you can process the JSON files." 77 | 78 | htmlhelp: 79 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 80 | @echo 81 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 82 | ".hhp project file in $(BUILDDIR)/htmlhelp." 83 | 84 | qthelp: 85 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 86 | @echo 87 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 88 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 89 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ActiveLearning.qhcp" 90 | @echo "To view the help file:" 91 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ActiveLearning.qhc" 92 | 93 | devhelp: 94 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 95 | @echo 96 | @echo "Build finished." 97 | @echo "To view the help file:" 98 | @echo "# mkdir -p $$HOME/.local/share/devhelp/ActiveLearning" 99 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ActiveLearning" 100 | @echo "# devhelp" 101 | 102 | epub: 103 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 104 | @echo 105 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 106 | 107 | latex: 108 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 109 | @echo 110 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 111 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 112 | "(use \`make latexpdf' here to do that automatically)." 113 | 114 | latexpdf: 115 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 116 | @echo "Running LaTeX files through pdflatex..." 117 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 118 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 119 | 120 | latexpdfja: 121 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 122 | @echo "Running LaTeX files through platex and dvipdfmx..." 123 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 124 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 125 | 126 | text: 127 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 128 | @echo 129 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 130 | 131 | man: 132 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 133 | @echo 134 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 135 | 136 | texinfo: 137 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 138 | @echo 139 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 140 | @echo "Run \`make' in that directory to run these through makeinfo" \ 141 | "(use \`make info' here to do that automatically)." 142 | 143 | info: 144 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 145 | @echo "Running Texinfo files through makeinfo..." 146 | make -C $(BUILDDIR)/texinfo info 147 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 148 | 149 | gettext: 150 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 151 | @echo 152 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 153 | 154 | changes: 155 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 156 | @echo 157 | @echo "The overview file is in $(BUILDDIR)/changes." 158 | 159 | linkcheck: 160 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 161 | @echo 162 | @echo "Link check complete; look for any errors in the above output " \ 163 | "or in $(BUILDDIR)/linkcheck/output.txt." 164 | 165 | doctest: 166 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 167 | @echo "Testing of doctests in the sources finished, look at the " \ 168 | "results in $(BUILDDIR)/doctest/output.txt." 169 | 170 | coverage: 171 | $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage 172 | @echo "Testing of coverage in the sources finished, look at the " \ 173 | "results in $(BUILDDIR)/coverage/python.txt." 174 | 175 | xml: 176 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 177 | @echo 178 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 179 | 180 | pseudoxml: 181 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 182 | @echo 183 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 184 | -------------------------------------------------------------------------------- /documentation/_build/doctrees/code.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/doctrees/code.doctree -------------------------------------------------------------------------------- /documentation/_build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/doctrees/environment.pickle -------------------------------------------------------------------------------- /documentation/_build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/doctrees/index.doctree -------------------------------------------------------------------------------- /documentation/_build/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 9691994a4fd31b98469cec333eade392 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /documentation/_build/html/_images/choose_clas_strat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_images/choose_clas_strat.png -------------------------------------------------------------------------------- /documentation/_build/html/_images/choose_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_images/choose_data.png -------------------------------------------------------------------------------- /documentation/_build/html/_images/edit_parameters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_images/edit_parameters.png -------------------------------------------------------------------------------- /documentation/_build/html/_images/gui_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_images/gui_main.png -------------------------------------------------------------------------------- /documentation/_build/html/_images/loaded_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_images/loaded_gui.png -------------------------------------------------------------------------------- /documentation/_build/html/_images/run1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_images/run1.png -------------------------------------------------------------------------------- /documentation/_build/html/_images/show_plots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_images/show_plots.png -------------------------------------------------------------------------------- /documentation/_build/html/_sources/code.txt: -------------------------------------------------------------------------------- 1 | Documentation 2 | ==================== 3 | 4 | al 5 | ---- 6 | 7 | al.instance_strategies 8 | ^^^^^^^^^^^^^^^^^^^^^^ 9 | 10 | .. automodule:: al.instance_strategies 11 | :members: 12 | 13 | al.learning_curve 14 | ^^^^^^^^^^^^^^^^^ 15 | 16 | .. automodule:: al.learning_curve 17 | :members: 18 | 19 | front_end.cl 20 | ------------ 21 | 22 | .. automodule:: front_end.cl.run_al_cl 23 | :members: 24 | 25 | Examples 26 | ^^^^^^^^ 27 | The following code runs :mod:`front_end.cl.run_al_cl` with the following parameters: 28 | 29 | * number of trials - 5 30 | * strategy - rand 31 | * bootstrap - 10 32 | * budget - 500 33 | * step size - 10 34 | * subpool - 250 35 | * data paths - ../../../data/imdb-binary-pool-mindf5-ng11 ../../../data/imdb-binary-test-mindf5-ng11 36 | 37 | .. code-block:: python 38 | 39 | python run_al_cl.py -c MultinomialNB -nt 5 -st rand -bs 10 -b 500 -sz 10 -sp 250 -d ../../../data/imdb-binary-pool-mindf5-ng11 ../../../data/imdb-binary-test-mindf5-ng11 40 | 41 | *The output of this code is:* 42 | 43 | *Status:* 44 | 45 | .. code-block:: python 46 | 47 | Loading took 17.88s. 48 | 49 | trial 0 50 | trial 1 51 | trial 2 52 | trial 3 53 | trial 4 54 | 55 | *Data output is placed in a file in your current working directory. The 56 | default filename is avg_results.txt.* 57 | 58 | *Sample Data Output:* 59 | 60 | .. code-block:: python 61 | 62 | rand 63 | accuracy 64 | train size,mean 65 | 10,0.557016 66 | 20,0.538432 67 | 30,0.534664 68 | 40,0.575320 69 | 50,0.651672 70 | 60,0.621416 71 | 70,0.670400 72 | 80,0.645680 73 | 90,0.659520 74 | 100,0.610160 75 | 110,0.658024 76 | 77 | *Plot Image:* 78 | 79 | .. image:: _images/run1.png 80 | :width: 50% 81 | 82 | front_end.gui 83 | ------------- 84 | 85 | .. automodule:: front_end.gui.run_al_gui 86 | :members: 87 | 88 | Examples 89 | ^^^^^^^^ 90 | 91 | The following provides an in-depth look at a sample run of :mod:`front_end.gui.run_al_gui` 92 | 93 | .. code-block:: python 94 | 95 | python run_al_gui.py 96 | 97 | *GUI Main Window (with all values reset)* 98 | 99 | .. image:: _images/gui_main.png 100 | :width: 80% 101 | 102 | *Setting up the gui to run the following equivalent run of the command line interface:* 103 | 104 | .. code-block:: python 105 | 106 | python run_al_cl.py -c MultinomialNB -d /home/geet/Dropbox/Research/Bilgic/data/20_newsgroups_train /home/geet/Dropbox/Research/Bilgic/data/20_newsgroups_train hash -nt 5 -st rand -bs 10 -b 500 -sz 10 -sp 250 107 | 108 | *Choose train and test data files:* 109 | 110 | .. image:: _images/choose_data.png 111 | :width: 50% 112 | :align: left 113 | 114 | .. image:: _images/loaded_gui.png 115 | :width: 80% 116 | 117 | *Edit parameters to match specified run:* 118 | 119 | .. image:: _images/edit_parameters.png 120 | :width: 20% 121 | 122 | *Choose MultinomialNB and rand as the classifier-strategy combination:* 123 | 124 | .. image:: _images/choose_clas_strat.png 125 | :width: 30% 126 | 127 | *Run terminal output:* 128 | 129 | .. code-block:: python 130 | 131 | python run_al_cl.py -pf MultinomialNB-rand -c MultinomialNB -d /home/geet/Dropbox/Research/Bilgic/data/20_newsgroups_train /home/geet/Dropbox/Research/Bilgic/data/20_newsgroups_train hash -nt 5 -st rand -bs 10 -b 500 -sz 10 -sp 250 132 | trial 0 133 | trial 1 134 | trial 2 135 | trial 3 136 | trial 4 137 | 138 | *Show plots when done:* 139 | 140 | .. image:: _images/show_plots.png 141 | :width: 50% 142 | 143 | utils.utils 144 | ----------- 145 | 146 | .. automodule:: utils.utils 147 | :members: 148 | -------------------------------------------------------------------------------- /documentation/_build/html/_sources/index.txt: -------------------------------------------------------------------------------- 1 | .. Active Learning documentation master file, created by 2 | sphinx-quickstart on Wed Jan 7 00:37:28 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Active Learning's documentation! 7 | =========================================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | code 15 | 16 | 17 | Indices and tables 18 | ================== 19 | 20 | * :ref:`genindex` 21 | * :ref:`modindex` 22 | * :ref:`search` 23 | 24 | -------------------------------------------------------------------------------- /documentation/_build/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /documentation/_build/html/_static/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * basic.css 3 | * ~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- basic theme. 6 | * 7 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /* -- main layout ----------------------------------------------------------- */ 13 | 14 | div.clearer { 15 | clear: both; 16 | } 17 | 18 | /* -- relbar ---------------------------------------------------------------- */ 19 | 20 | div.related { 21 | width: 100%; 22 | font-size: 90%; 23 | } 24 | 25 | div.related h3 { 26 | display: none; 27 | } 28 | 29 | div.related ul { 30 | margin: 0; 31 | padding: 0 0 0 10px; 32 | list-style: none; 33 | } 34 | 35 | div.related li { 36 | display: inline; 37 | } 38 | 39 | div.related li.right { 40 | float: right; 41 | margin-right: 5px; 42 | } 43 | 44 | /* -- sidebar --------------------------------------------------------------- */ 45 | 46 | div.sphinxsidebarwrapper { 47 | padding: 10px 5px 0 10px; 48 | } 49 | 50 | div.sphinxsidebar { 51 | float: left; 52 | width: 230px; 53 | margin-left: -100%; 54 | font-size: 90%; 55 | } 56 | 57 | div.sphinxsidebar ul { 58 | list-style: none; 59 | } 60 | 61 | div.sphinxsidebar ul ul, 62 | div.sphinxsidebar ul.want-points { 63 | margin-left: 20px; 64 | list-style: square; 65 | } 66 | 67 | div.sphinxsidebar ul ul { 68 | margin-top: 0; 69 | margin-bottom: 0; 70 | } 71 | 72 | div.sphinxsidebar form { 73 | margin-top: 10px; 74 | } 75 | 76 | div.sphinxsidebar input { 77 | border: 1px solid #98dbcc; 78 | font-family: sans-serif; 79 | font-size: 1em; 80 | } 81 | 82 | div.sphinxsidebar #searchbox input[type="text"] { 83 | width: 170px; 84 | } 85 | 86 | div.sphinxsidebar #searchbox input[type="submit"] { 87 | width: 30px; 88 | } 89 | 90 | img { 91 | border: 0; 92 | max-width: 100%; 93 | } 94 | 95 | /* -- search page ----------------------------------------------------------- */ 96 | 97 | ul.search { 98 | margin: 10px 0 0 20px; 99 | padding: 0; 100 | } 101 | 102 | ul.search li { 103 | padding: 5px 0 5px 20px; 104 | background-image: url(file.png); 105 | background-repeat: no-repeat; 106 | background-position: 0 7px; 107 | } 108 | 109 | ul.search li a { 110 | font-weight: bold; 111 | } 112 | 113 | ul.search li div.context { 114 | color: #888; 115 | margin: 2px 0 0 30px; 116 | text-align: left; 117 | } 118 | 119 | ul.keywordmatches li.goodmatch a { 120 | font-weight: bold; 121 | } 122 | 123 | /* -- index page ------------------------------------------------------------ */ 124 | 125 | table.contentstable { 126 | width: 90%; 127 | } 128 | 129 | table.contentstable p.biglink { 130 | line-height: 150%; 131 | } 132 | 133 | a.biglink { 134 | font-size: 1.3em; 135 | } 136 | 137 | span.linkdescr { 138 | font-style: italic; 139 | padding-top: 5px; 140 | font-size: 90%; 141 | } 142 | 143 | /* -- general index --------------------------------------------------------- */ 144 | 145 | table.indextable { 146 | width: 100%; 147 | } 148 | 149 | table.indextable td { 150 | text-align: left; 151 | vertical-align: top; 152 | } 153 | 154 | table.indextable dl, table.indextable dd { 155 | margin-top: 0; 156 | margin-bottom: 0; 157 | } 158 | 159 | table.indextable tr.pcap { 160 | height: 10px; 161 | } 162 | 163 | table.indextable tr.cap { 164 | margin-top: 10px; 165 | background-color: #f2f2f2; 166 | } 167 | 168 | img.toggler { 169 | margin-right: 3px; 170 | margin-top: 3px; 171 | cursor: pointer; 172 | } 173 | 174 | div.modindex-jumpbox { 175 | border-top: 1px solid #ddd; 176 | border-bottom: 1px solid #ddd; 177 | margin: 1em 0 1em 0; 178 | padding: 0.4em; 179 | } 180 | 181 | div.genindex-jumpbox { 182 | border-top: 1px solid #ddd; 183 | border-bottom: 1px solid #ddd; 184 | margin: 1em 0 1em 0; 185 | padding: 0.4em; 186 | } 187 | 188 | /* -- general body styles --------------------------------------------------- */ 189 | 190 | a.headerlink { 191 | visibility: hidden; 192 | } 193 | 194 | h1:hover > a.headerlink, 195 | h2:hover > a.headerlink, 196 | h3:hover > a.headerlink, 197 | h4:hover > a.headerlink, 198 | h5:hover > a.headerlink, 199 | h6:hover > a.headerlink, 200 | dt:hover > a.headerlink, 201 | caption:hover > a.headerlink, 202 | p.caption:hover > a.headerlink, 203 | div.code-block-caption:hover > a.headerlink { 204 | visibility: visible; 205 | } 206 | 207 | div.body p.caption { 208 | text-align: inherit; 209 | } 210 | 211 | div.body td { 212 | text-align: left; 213 | } 214 | 215 | .field-list ul { 216 | padding-left: 1em; 217 | } 218 | 219 | .first { 220 | margin-top: 0 !important; 221 | } 222 | 223 | p.rubric { 224 | margin-top: 30px; 225 | font-weight: bold; 226 | } 227 | 228 | img.align-left, .figure.align-left, object.align-left { 229 | clear: left; 230 | float: left; 231 | margin-right: 1em; 232 | } 233 | 234 | img.align-right, .figure.align-right, object.align-right { 235 | clear: right; 236 | float: right; 237 | margin-left: 1em; 238 | } 239 | 240 | img.align-center, .figure.align-center, object.align-center { 241 | display: block; 242 | margin-left: auto; 243 | margin-right: auto; 244 | } 245 | 246 | .align-left { 247 | text-align: left; 248 | } 249 | 250 | .align-center { 251 | text-align: center; 252 | } 253 | 254 | .align-right { 255 | text-align: right; 256 | } 257 | 258 | /* -- sidebars -------------------------------------------------------------- */ 259 | 260 | div.sidebar { 261 | margin: 0 0 0.5em 1em; 262 | border: 1px solid #ddb; 263 | padding: 7px 7px 0 7px; 264 | background-color: #ffe; 265 | width: 40%; 266 | float: right; 267 | } 268 | 269 | p.sidebar-title { 270 | font-weight: bold; 271 | } 272 | 273 | /* -- topics ---------------------------------------------------------------- */ 274 | 275 | div.topic { 276 | border: 1px solid #ccc; 277 | padding: 7px 7px 0 7px; 278 | margin: 10px 0 10px 0; 279 | } 280 | 281 | p.topic-title { 282 | font-size: 1.1em; 283 | font-weight: bold; 284 | margin-top: 10px; 285 | } 286 | 287 | /* -- admonitions ----------------------------------------------------------- */ 288 | 289 | div.admonition { 290 | margin-top: 10px; 291 | margin-bottom: 10px; 292 | padding: 7px; 293 | } 294 | 295 | div.admonition dt { 296 | font-weight: bold; 297 | } 298 | 299 | div.admonition dl { 300 | margin-bottom: 0; 301 | } 302 | 303 | p.admonition-title { 304 | margin: 0px 10px 5px 0px; 305 | font-weight: bold; 306 | } 307 | 308 | div.body p.centered { 309 | text-align: center; 310 | margin-top: 25px; 311 | } 312 | 313 | /* -- tables ---------------------------------------------------------------- */ 314 | 315 | table.docutils { 316 | border: 0; 317 | border-collapse: collapse; 318 | } 319 | 320 | table caption span.caption-number { 321 | font-style: italic; 322 | } 323 | 324 | table caption span.caption-text { 325 | } 326 | 327 | table.docutils td, table.docutils th { 328 | padding: 1px 8px 1px 5px; 329 | border-top: 0; 330 | border-left: 0; 331 | border-right: 0; 332 | border-bottom: 1px solid #aaa; 333 | } 334 | 335 | table.field-list td, table.field-list th { 336 | border: 0 !important; 337 | } 338 | 339 | table.footnote td, table.footnote th { 340 | border: 0 !important; 341 | } 342 | 343 | th { 344 | text-align: left; 345 | padding-right: 5px; 346 | } 347 | 348 | table.citation { 349 | border-left: solid 1px gray; 350 | margin-left: 1px; 351 | } 352 | 353 | table.citation td { 354 | border-bottom: none; 355 | } 356 | 357 | /* -- figures --------------------------------------------------------------- */ 358 | 359 | div.figure { 360 | margin: 0.5em; 361 | padding: 0.5em; 362 | } 363 | 364 | div.figure p.caption { 365 | padding: 0.3em; 366 | } 367 | 368 | div.figure p.caption span.caption-number { 369 | font-style: italic; 370 | } 371 | 372 | div.figure p.caption span.caption-text { 373 | } 374 | 375 | 376 | /* -- other body styles ----------------------------------------------------- */ 377 | 378 | ol.arabic { 379 | list-style: decimal; 380 | } 381 | 382 | ol.loweralpha { 383 | list-style: lower-alpha; 384 | } 385 | 386 | ol.upperalpha { 387 | list-style: upper-alpha; 388 | } 389 | 390 | ol.lowerroman { 391 | list-style: lower-roman; 392 | } 393 | 394 | ol.upperroman { 395 | list-style: upper-roman; 396 | } 397 | 398 | dl { 399 | margin-bottom: 15px; 400 | } 401 | 402 | dd p { 403 | margin-top: 0px; 404 | } 405 | 406 | dd ul, dd table { 407 | margin-bottom: 10px; 408 | } 409 | 410 | dd { 411 | margin-top: 3px; 412 | margin-bottom: 10px; 413 | margin-left: 30px; 414 | } 415 | 416 | dt:target, .highlighted { 417 | background-color: #fbe54e; 418 | } 419 | 420 | dl.glossary dt { 421 | font-weight: bold; 422 | font-size: 1.1em; 423 | } 424 | 425 | .field-list ul { 426 | margin: 0; 427 | padding-left: 1em; 428 | } 429 | 430 | .field-list p { 431 | margin: 0; 432 | } 433 | 434 | .optional { 435 | font-size: 1.3em; 436 | } 437 | 438 | .sig-paren { 439 | font-size: larger; 440 | } 441 | 442 | .versionmodified { 443 | font-style: italic; 444 | } 445 | 446 | .system-message { 447 | background-color: #fda; 448 | padding: 5px; 449 | border: 3px solid red; 450 | } 451 | 452 | .footnote:target { 453 | background-color: #ffa; 454 | } 455 | 456 | .line-block { 457 | display: block; 458 | margin-top: 1em; 459 | margin-bottom: 1em; 460 | } 461 | 462 | .line-block .line-block { 463 | margin-top: 0; 464 | margin-bottom: 0; 465 | margin-left: 1.5em; 466 | } 467 | 468 | .guilabel, .menuselection { 469 | font-family: sans-serif; 470 | } 471 | 472 | .accelerator { 473 | text-decoration: underline; 474 | } 475 | 476 | .classifier { 477 | font-style: oblique; 478 | } 479 | 480 | abbr, acronym { 481 | border-bottom: dotted 1px; 482 | cursor: help; 483 | } 484 | 485 | /* -- code displays --------------------------------------------------------- */ 486 | 487 | pre { 488 | overflow: auto; 489 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ 490 | } 491 | 492 | td.linenos pre { 493 | padding: 5px 0px; 494 | border: 0; 495 | background-color: transparent; 496 | color: #aaa; 497 | } 498 | 499 | table.highlighttable { 500 | margin-left: 0.5em; 501 | } 502 | 503 | table.highlighttable td { 504 | padding: 0 0.5em 0 0.5em; 505 | } 506 | 507 | div.code-block-caption { 508 | padding: 2px 5px; 509 | font-size: small; 510 | } 511 | 512 | div.code-block-caption code { 513 | background-color: transparent; 514 | } 515 | 516 | div.code-block-caption + div > div.highlight > pre { 517 | margin-top: 0; 518 | } 519 | 520 | div.code-block-caption span.caption-number { 521 | padding: 0.1em 0.3em; 522 | font-style: italic; 523 | } 524 | 525 | div.code-block-caption span.caption-text { 526 | } 527 | 528 | div.container { 529 | padding: 1em 1em 0; 530 | } 531 | 532 | div.container div.highlight { 533 | margin: 0; 534 | } 535 | 536 | code.descname { 537 | background-color: transparent; 538 | font-weight: bold; 539 | font-size: 1.2em; 540 | } 541 | 542 | code.descclassname { 543 | background-color: transparent; 544 | } 545 | 546 | code.xref, a code { 547 | background-color: transparent; 548 | font-weight: bold; 549 | } 550 | 551 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { 552 | background-color: transparent; 553 | } 554 | 555 | .viewcode-link { 556 | float: right; 557 | } 558 | 559 | .viewcode-back { 560 | float: right; 561 | font-family: sans-serif; 562 | } 563 | 564 | div.viewcode-block:target { 565 | margin: -1px -10px; 566 | padding: 0 10px; 567 | } 568 | 569 | /* -- math display ---------------------------------------------------------- */ 570 | 571 | img.math { 572 | vertical-align: middle; 573 | } 574 | 575 | div.body div.math p { 576 | text-align: center; 577 | } 578 | 579 | span.eqno { 580 | float: right; 581 | } 582 | 583 | /* -- printout stylesheet --------------------------------------------------- */ 584 | 585 | @media print { 586 | div.document, 587 | div.documentwrapper, 588 | div.bodywrapper { 589 | margin: 0 !important; 590 | width: 100%; 591 | } 592 | 593 | div.sphinxsidebar, 594 | div.related, 595 | div.footer, 596 | #top-link { 597 | display: none; 598 | } 599 | } -------------------------------------------------------------------------------- /documentation/_build/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/comment-bright.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/comment-close.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/comment.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/contents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/contents.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for all documentation. 6 | * 7 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * select a different prefix for underscore 14 | */ 15 | $u = _.noConflict(); 16 | 17 | /** 18 | * make the code below compatible with browsers without 19 | * an installed firebug like debugger 20 | if (!window.console || !console.firebug) { 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 23 | "profile", "profileEnd"]; 24 | window.console = {}; 25 | for (var i = 0; i < names.length; ++i) 26 | window.console[names[i]] = function() {}; 27 | } 28 | */ 29 | 30 | /** 31 | * small helper function to urldecode strings 32 | */ 33 | jQuery.urldecode = function(x) { 34 | return decodeURIComponent(x).replace(/\+/g, ' '); 35 | }; 36 | 37 | /** 38 | * small helper function to urlencode strings 39 | */ 40 | jQuery.urlencode = encodeURIComponent; 41 | 42 | /** 43 | * This function returns the parsed url parameters of the 44 | * current request. Multiple values per key are supported, 45 | * it will always return arrays of strings for the value parts. 46 | */ 47 | jQuery.getQueryParameters = function(s) { 48 | if (typeof s == 'undefined') 49 | s = document.location.search; 50 | var parts = s.substr(s.indexOf('?') + 1).split('&'); 51 | var result = {}; 52 | for (var i = 0; i < parts.length; i++) { 53 | var tmp = parts[i].split('=', 2); 54 | var key = jQuery.urldecode(tmp[0]); 55 | var value = jQuery.urldecode(tmp[1]); 56 | if (key in result) 57 | result[key].push(value); 58 | else 59 | result[key] = [value]; 60 | } 61 | return result; 62 | }; 63 | 64 | /** 65 | * highlight a given string on a jquery object by wrapping it in 66 | * span elements with the given class name. 67 | */ 68 | jQuery.fn.highlightText = function(text, className) { 69 | function highlight(node) { 70 | if (node.nodeType == 3) { 71 | var val = node.nodeValue; 72 | var pos = val.toLowerCase().indexOf(text); 73 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { 74 | var span = document.createElement("span"); 75 | span.className = className; 76 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 77 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 78 | document.createTextNode(val.substr(pos + text.length)), 79 | node.nextSibling)); 80 | node.nodeValue = val.substr(0, pos); 81 | } 82 | } 83 | else if (!jQuery(node).is("button, select, textarea")) { 84 | jQuery.each(node.childNodes, function() { 85 | highlight(this); 86 | }); 87 | } 88 | } 89 | return this.each(function() { 90 | highlight(this); 91 | }); 92 | }; 93 | 94 | /* 95 | * backward compatibility for jQuery.browser 96 | * This will be supported until firefox bug is fixed. 97 | */ 98 | if (!jQuery.browser) { 99 | jQuery.uaMatch = function(ua) { 100 | ua = ua.toLowerCase(); 101 | 102 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 103 | /(webkit)[ \/]([\w.]+)/.exec(ua) || 104 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 105 | /(msie) ([\w.]+)/.exec(ua) || 106 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 107 | []; 108 | 109 | return { 110 | browser: match[ 1 ] || "", 111 | version: match[ 2 ] || "0" 112 | }; 113 | }; 114 | jQuery.browser = {}; 115 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; 116 | } 117 | 118 | /** 119 | * Small JavaScript module for the documentation. 120 | */ 121 | var Documentation = { 122 | 123 | init : function() { 124 | this.fixFirefoxAnchorBug(); 125 | this.highlightSearchWords(); 126 | this.initIndexTable(); 127 | }, 128 | 129 | /** 130 | * i18n support 131 | */ 132 | TRANSLATIONS : {}, 133 | PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, 134 | LOCALE : 'unknown', 135 | 136 | // gettext and ngettext don't access this so that the functions 137 | // can safely bound to a different name (_ = Documentation.gettext) 138 | gettext : function(string) { 139 | var translated = Documentation.TRANSLATIONS[string]; 140 | if (typeof translated == 'undefined') 141 | return string; 142 | return (typeof translated == 'string') ? translated : translated[0]; 143 | }, 144 | 145 | ngettext : function(singular, plural, n) { 146 | var translated = Documentation.TRANSLATIONS[singular]; 147 | if (typeof translated == 'undefined') 148 | return (n == 1) ? singular : plural; 149 | return translated[Documentation.PLURALEXPR(n)]; 150 | }, 151 | 152 | addTranslations : function(catalog) { 153 | for (var key in catalog.messages) 154 | this.TRANSLATIONS[key] = catalog.messages[key]; 155 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 156 | this.LOCALE = catalog.locale; 157 | }, 158 | 159 | /** 160 | * add context elements like header anchor links 161 | */ 162 | addContextElements : function() { 163 | $('div[id] > :header:first').each(function() { 164 | $('\u00B6'). 165 | attr('href', '#' + this.id). 166 | attr('title', _('Permalink to this headline')). 167 | appendTo(this); 168 | }); 169 | $('dt[id]').each(function() { 170 | $('\u00B6'). 171 | attr('href', '#' + this.id). 172 | attr('title', _('Permalink to this definition')). 173 | appendTo(this); 174 | }); 175 | }, 176 | 177 | /** 178 | * workaround a firefox stupidity 179 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 180 | */ 181 | fixFirefoxAnchorBug : function() { 182 | if (document.location.hash && $.browser.mozilla) 183 | window.setTimeout(function() { 184 | document.location.href += ''; 185 | }, 10); 186 | }, 187 | 188 | /** 189 | * highlight the search words provided in the url in the text 190 | */ 191 | highlightSearchWords : function() { 192 | var params = $.getQueryParameters(); 193 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 194 | if (terms.length) { 195 | var body = $('div.body'); 196 | if (!body.length) { 197 | body = $('body'); 198 | } 199 | window.setTimeout(function() { 200 | $.each(terms, function() { 201 | body.highlightText(this.toLowerCase(), 'highlighted'); 202 | }); 203 | }, 10); 204 | $('') 206 | .appendTo($('#searchbox')); 207 | } 208 | }, 209 | 210 | /** 211 | * init the domain index toggle buttons 212 | */ 213 | initIndexTable : function() { 214 | var togglers = $('img.toggler').click(function() { 215 | var src = $(this).attr('src'); 216 | var idnum = $(this).attr('id').substr(7); 217 | $('tr.cg-' + idnum).toggle(); 218 | if (src.substr(-9) == 'minus.png') 219 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 220 | else 221 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 222 | }).css('display', ''); 223 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 224 | togglers.click(); 225 | } 226 | }, 227 | 228 | /** 229 | * helper function to hide the search marks again 230 | */ 231 | hideSearchWords : function() { 232 | $('#searchbox .highlight-link').fadeOut(300); 233 | $('span.highlighted').removeClass('highlighted'); 234 | }, 235 | 236 | /** 237 | * make the url absolute 238 | */ 239 | makeURL : function(relativeURL) { 240 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 241 | }, 242 | 243 | /** 244 | * get the current relative url 245 | */ 246 | getCurrentURL : function() { 247 | var path = document.location.pathname; 248 | var parts = path.split(/\//); 249 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 250 | if (this == '..') 251 | parts.pop(); 252 | }); 253 | var url = parts.join('/'); 254 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 255 | } 256 | }; 257 | 258 | // quick alias for translations 259 | _ = Documentation.gettext; 260 | 261 | $(document).ready(function() { 262 | Documentation.init(); 263 | }); 264 | -------------------------------------------------------------------------------- /documentation/_build/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/down-pressed.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/down.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/file.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/minus.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/navigation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/navigation.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/plus.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 8 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 9 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 10 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 11 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 14 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 15 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 16 | .highlight .go { color: #333333 } /* Generic.Output */ 17 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 19 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 20 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 21 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 22 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 23 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 24 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 25 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 26 | .highlight .kt { color: #902000 } /* Keyword.Type */ 27 | .highlight .m { color: #208050 } /* Literal.Number */ 28 | .highlight .s { color: #4070a0 } /* Literal.String */ 29 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 30 | .highlight .nb { color: #007020 } /* Name.Builtin */ 31 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 32 | .highlight .no { color: #60add5 } /* Name.Constant */ 33 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 34 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 35 | .highlight .ne { color: #007020 } /* Name.Exception */ 36 | .highlight .nf { color: #06287e } /* Name.Function */ 37 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 38 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 39 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 40 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 41 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 42 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 44 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 45 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 46 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 47 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 48 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 49 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 50 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 51 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 52 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 53 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 54 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 55 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 56 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 57 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 58 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 59 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 60 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 61 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 62 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 63 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /documentation/_build/html/_static/sphinxdoc.css: -------------------------------------------------------------------------------- 1 | /* 2 | * sphinxdoc.css_t 3 | * ~~~~~~~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- sphinxdoc theme. Originally created by 6 | * Armin Ronacher for Werkzeug. 7 | * 8 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 9 | * :license: BSD, see LICENSE for details. 10 | * 11 | */ 12 | 13 | @import url("basic.css"); 14 | 15 | /* -- page layout ----------------------------------------------------------- */ 16 | 17 | body { 18 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 19 | 'Verdana', sans-serif; 20 | font-size: 14px; 21 | letter-spacing: -0.01em; 22 | line-height: 150%; 23 | text-align: center; 24 | background-color: #BFD1D4; 25 | color: black; 26 | padding: 0; 27 | border: 1px solid #aaa; 28 | 29 | margin: 0px 80px 0px 80px; 30 | min-width: 740px; 31 | } 32 | 33 | div.document { 34 | background-color: white; 35 | text-align: left; 36 | background-image: url(contents.png); 37 | background-repeat: repeat-x; 38 | } 39 | 40 | div.bodywrapper { 41 | margin: 0 240px 0 0; 42 | border-right: 1px solid #ccc; 43 | } 44 | 45 | div.body { 46 | margin: 0; 47 | padding: 0.5em 20px 20px 20px; 48 | } 49 | 50 | div.related { 51 | font-size: 1em; 52 | } 53 | 54 | div.related ul { 55 | background-image: url(navigation.png); 56 | height: 2em; 57 | border-top: 1px solid #ddd; 58 | border-bottom: 1px solid #ddd; 59 | } 60 | 61 | div.related ul li { 62 | margin: 0; 63 | padding: 0; 64 | height: 2em; 65 | float: left; 66 | } 67 | 68 | div.related ul li.right { 69 | float: right; 70 | margin-right: 5px; 71 | } 72 | 73 | div.related ul li a { 74 | margin: 0; 75 | padding: 0 5px 0 5px; 76 | line-height: 1.75em; 77 | color: #EE9816; 78 | } 79 | 80 | div.related ul li a:hover { 81 | color: #3CA8E7; 82 | } 83 | 84 | div.sphinxsidebarwrapper { 85 | padding: 0; 86 | } 87 | 88 | div.sphinxsidebar { 89 | margin: 0; 90 | padding: 0.5em 15px 15px 0; 91 | width: 210px; 92 | float: right; 93 | font-size: 1em; 94 | text-align: left; 95 | } 96 | 97 | div.sphinxsidebar h3, div.sphinxsidebar h4 { 98 | margin: 1em 0 0.5em 0; 99 | font-size: 1em; 100 | padding: 0.1em 0 0.1em 0.5em; 101 | color: white; 102 | border: 1px solid #86989B; 103 | background-color: #AFC1C4; 104 | } 105 | 106 | div.sphinxsidebar h3 a { 107 | color: white; 108 | } 109 | 110 | div.sphinxsidebar ul { 111 | padding-left: 1.5em; 112 | margin-top: 7px; 113 | padding: 0; 114 | line-height: 130%; 115 | } 116 | 117 | div.sphinxsidebar ul ul { 118 | margin-left: 20px; 119 | } 120 | 121 | div.footer { 122 | background-color: #E3EFF1; 123 | color: #86989B; 124 | padding: 3px 8px 3px 0; 125 | clear: both; 126 | font-size: 0.8em; 127 | text-align: right; 128 | } 129 | 130 | div.footer a { 131 | color: #86989B; 132 | text-decoration: underline; 133 | } 134 | 135 | /* -- body styles ----------------------------------------------------------- */ 136 | 137 | p { 138 | margin: 0.8em 0 0.5em 0; 139 | } 140 | 141 | a { 142 | color: #CA7900; 143 | text-decoration: none; 144 | } 145 | 146 | a:hover { 147 | color: #2491CF; 148 | } 149 | 150 | div.body a { 151 | text-decoration: underline; 152 | } 153 | 154 | h1 { 155 | margin: 0; 156 | padding: 0.7em 0 0.3em 0; 157 | font-size: 1.5em; 158 | color: #11557C; 159 | } 160 | 161 | h2 { 162 | margin: 1.3em 0 0.2em 0; 163 | font-size: 1.35em; 164 | padding: 0; 165 | } 166 | 167 | h3 { 168 | margin: 1em 0 -0.3em 0; 169 | font-size: 1.2em; 170 | } 171 | 172 | div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a { 173 | color: black!important; 174 | } 175 | 176 | h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor { 177 | display: none; 178 | margin: 0 0 0 0.3em; 179 | padding: 0 0.2em 0 0.2em; 180 | color: #aaa!important; 181 | } 182 | 183 | h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, 184 | h5:hover a.anchor, h6:hover a.anchor { 185 | display: inline; 186 | } 187 | 188 | h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover, 189 | h5 a.anchor:hover, h6 a.anchor:hover { 190 | color: #777; 191 | background-color: #eee; 192 | } 193 | 194 | a.headerlink { 195 | color: #c60f0f!important; 196 | font-size: 1em; 197 | margin-left: 6px; 198 | padding: 0 4px 0 4px; 199 | text-decoration: none!important; 200 | } 201 | 202 | a.headerlink:hover { 203 | background-color: #ccc; 204 | color: white!important; 205 | } 206 | 207 | cite, code, code { 208 | font-family: 'Consolas', 'Deja Vu Sans Mono', 209 | 'Bitstream Vera Sans Mono', monospace; 210 | font-size: 0.95em; 211 | letter-spacing: 0.01em; 212 | } 213 | 214 | code { 215 | background-color: #f2f2f2; 216 | border-bottom: 1px solid #ddd; 217 | color: #333; 218 | } 219 | 220 | code.descname, code.descclassname, code.xref { 221 | border: 0; 222 | } 223 | 224 | hr { 225 | border: 1px solid #abc; 226 | margin: 2em; 227 | } 228 | 229 | a code { 230 | border: 0; 231 | color: #CA7900; 232 | } 233 | 234 | a code:hover { 235 | color: #2491CF; 236 | } 237 | 238 | pre { 239 | font-family: 'Consolas', 'Deja Vu Sans Mono', 240 | 'Bitstream Vera Sans Mono', monospace; 241 | font-size: 0.95em; 242 | letter-spacing: 0.015em; 243 | line-height: 120%; 244 | padding: 0.5em; 245 | border: 1px solid #ccc; 246 | background-color: #f8f8f8; 247 | } 248 | 249 | pre a { 250 | color: inherit; 251 | text-decoration: underline; 252 | } 253 | 254 | td.linenos pre { 255 | padding: 0.5em 0; 256 | } 257 | 258 | div.quotebar { 259 | background-color: #f8f8f8; 260 | max-width: 250px; 261 | float: right; 262 | padding: 2px 7px; 263 | border: 1px solid #ccc; 264 | } 265 | 266 | div.topic { 267 | background-color: #f8f8f8; 268 | } 269 | 270 | table { 271 | border-collapse: collapse; 272 | margin: 0 -0.5em 0 -0.5em; 273 | } 274 | 275 | table td, table th { 276 | padding: 0.2em 0.5em 0.2em 0.5em; 277 | } 278 | 279 | div.admonition, div.warning { 280 | font-size: 0.9em; 281 | margin: 1em 0 1em 0; 282 | border: 1px solid #86989B; 283 | background-color: #f7f7f7; 284 | padding: 0; 285 | } 286 | 287 | div.admonition p, div.warning p { 288 | margin: 0.5em 1em 0.5em 1em; 289 | padding: 0; 290 | } 291 | 292 | div.admonition pre, div.warning pre { 293 | margin: 0.4em 1em 0.4em 1em; 294 | } 295 | 296 | div.admonition p.admonition-title, 297 | div.warning p.admonition-title { 298 | margin: 0; 299 | padding: 0.1em 0 0.1em 0.5em; 300 | color: white; 301 | border-bottom: 1px solid #86989B; 302 | font-weight: bold; 303 | background-color: #AFC1C4; 304 | } 305 | 306 | div.warning { 307 | border: 1px solid #940000; 308 | } 309 | 310 | div.warning p.admonition-title { 311 | background-color: #CF0000; 312 | border-bottom-color: #940000; 313 | } 314 | 315 | div.admonition ul, div.admonition ol, 316 | div.warning ul, div.warning ol { 317 | margin: 0.1em 0.5em 0.5em 3em; 318 | padding: 0; 319 | } 320 | 321 | div.versioninfo { 322 | margin: 1em 0 0 0; 323 | border: 1px solid #ccc; 324 | background-color: #DDEAF0; 325 | padding: 8px; 326 | line-height: 1.3em; 327 | font-size: 0.9em; 328 | } 329 | 330 | .viewcode-back { 331 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 332 | 'Verdana', sans-serif; 333 | } 334 | 335 | div.viewcode-block:target { 336 | background-color: #f4debf; 337 | border-top: 1px solid #ac9; 338 | border-bottom: 1px solid #ac9; 339 | } 340 | 341 | div.code-block-caption { 342 | background-color: #ddd; 343 | color: #222; 344 | border: 1px solid #ccc; 345 | } -------------------------------------------------------------------------------- /documentation/_build/html/_static/underscore.js: -------------------------------------------------------------------------------- 1 | // Underscore.js 1.3.1 2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. 3 | // Underscore is freely distributable under the MIT license. 4 | // Portions of Underscore are inspired or borrowed from Prototype, 5 | // Oliver Steele's Functional, and John Resig's Micro-Templating. 6 | // For all details and documentation: 7 | // http://documentcloud.github.com/underscore 8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== 9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c, 10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each= 11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a== 12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect= 13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e= 14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= 15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a, 17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}}; 24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments, 25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)}; 26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"}; 27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a), 28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+ 29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]= 30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain= 31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); 32 | -------------------------------------------------------------------------------- /documentation/_build/html/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/up-pressed.png -------------------------------------------------------------------------------- /documentation/_build/html/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/_static/up.png -------------------------------------------------------------------------------- /documentation/_build/html/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Welcome to Active Learning’s documentation! — Active Learning 0.1 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 45 | 78 | 79 |
80 |
81 |
82 |
83 | 84 |
85 |

Welcome to Active Learning’s documentation!

86 |

Contents:

87 |
88 | 97 |
98 |
99 |
100 |

Indices and tables

101 | 106 |
107 | 108 | 109 |
110 |
111 |
112 |
113 |
114 | 129 | 133 | 134 | -------------------------------------------------------------------------------- /documentation/_build/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_build/html/objects.inv -------------------------------------------------------------------------------- /documentation/_build/html/py-modindex.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Python Module Index — Active Learning 0.1 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 44 | 61 | 62 |
63 |
64 |
65 |
66 | 67 | 68 |

Python Module Index

69 | 70 |
71 | a | 72 | f | 73 | u 74 |
75 | 76 | 77 | 78 | 80 | 81 | 83 | 86 | 87 | 88 | 91 | 92 | 93 | 96 | 97 | 99 | 100 | 102 | 105 | 106 | 107 | 110 | 111 | 112 | 115 | 116 | 118 | 119 | 121 | 124 | 125 | 126 | 129 |
 
79 | a
84 | al 85 |
    89 | al.instance_strategies 90 |
    94 | al.learning_curve 95 |
 
98 | f
103 | front_end 104 |
    108 | front_end.cl.run_al_cl 109 |
    113 | front_end.gui.run_al_gui 114 |
 
117 | u
122 | utils 123 |
    127 | utils.utils 128 |
130 | 131 | 132 |
133 |
134 |
135 |
136 |
137 | 149 | 153 | 154 | -------------------------------------------------------------------------------- /documentation/_build/html/search.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Search — Active Learning 0.1 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 49 | 53 | 54 |
55 |
56 |
57 |
58 | 59 |

Search

60 |
61 | 62 |

63 | Please activate JavaScript to enable the search 64 | functionality. 65 |

66 |
67 |

68 | From here you can search these documents. Enter your search 69 | words into the box below and click "search". Note that the search 70 | function will automatically search for all of the words. Pages 71 | containing fewer words won't appear in the result list. 72 |

73 |
74 | 75 | 76 | 77 |
78 | 79 |
80 | 81 |
82 | 83 |
84 |
85 |
86 |
87 |
88 | 100 | 104 | 105 | -------------------------------------------------------------------------------- /documentation/_build/html/searchindex.js: -------------------------------------------------------------------------------- 1 | Search.setIndex({envversion:46,terms:{all:1,code:1,entropi:1,randombootstrap:1,show:1,boot:1,filetyp:1,random:1,exit_mast:1,run_al_cl:1,checkbox:1,choosenext:1,avg_accu:1,follow:1,training_s:1,label:1,width:1,paramet:1,y_pool:1,x_test:1,auc:1,gray_out:1,binari:1,chosen:1,menu:1,configur:1,activ:1,param:1,loggain:1,add:1,maincanva:1,dict:1,run_al_gui:1,main:1,step_siz:1,match:1,clas_strat:1,loggainstrategi:1,"return":1,variou:1,format:1,python:1,mindf5:1,x_pool:1,geet:1,candid:1,strap:1,menuwindow:1,add_run_classifier_fram:1,check_int:1,paramswindow:1,bar:1,enabl:1,specif:1,toarrai:1,edit:1,button:1,overid:1,list:1,integ:1,method:1,separ:1,"default":1,integr:1,each:1,output:1,page:0,mean:1,user:1,clear_plot:1,learningcurv:1,set:1,dataset2:1,add_classifier_frame_2:1,frame:1,run_al:1,accu_i:1,budget:1,second:1,cmd_pars:1,sampl:1,vote_entropi:1,pass:1,close:1,out:1,index:0,statu:1,height:1,erreduct:1,al_strategi:1,avg_auc:1,content:0,data_to_fil:1,run:1,current_train_i:1,classifier_arg:1,add_button:1,menubar:1,prob:1,show_plot:1,hash:1,str:1,show_editmenu:1,dataset1:1,train_indic:1,given:1,len:1,interfac:1,step:1,base:1,ng11:1,depend:1,alert:1,valu:1,gray_run:1,box:1,search:0,tkinter:1,current_train_indic:1,current:1,svmlight:1,trial:1,length:1,unc:1,place:1,retrieve_arg:1,within:1,sub_pool:1,add_run_strategy_fram:1,plot_acc:1,num_committe:1,assign:1,first:1,load:1,rand:1,rang:1,acc_sav:1,list_pool:1,uncstrategi:1,arrai:1,save_auc:1,"20_newsgroups_train":1,add_strategy_frame_2:1,dataset:1,randomstrategi:1,filenam:1,permut:1,done:1,empti:1,show_plt:1,path:1,vote:1,respect:1,txt:1,assum:1,research:1,select:1,size:1,plot:1,load_svmlight_fil:1,from:1,helper:1,pictur:1,qbcstrategi:1,window:1,width_org:1,next:1,exit_pref:1,log_gain:1,call:1,y_test:1,helperfunct:1,master:1,locat:1,errorreductionstrategi:1,num_trial:1,open_data:1,includ:1,"function":1,basestrategi:1,tupl:1,imag:1,assign_arg:1,params_dict:1,acc_i:1,train:1,togeth:1,termin:1,number:1,line:1,"true":1,run_trial:1,pool:1,acc_x:1,reset:1,none:1,save:1,retriev:1,look:1,possibl:1,provid:1,bilgic:1,work:1,displai:1,defin:1,bootstrapfromeach:1,display_pref:1,learn:1,classifier_argu:1,modul:[0,1],strategi:1,assign_plot_param:1,display_param:1,show_filemenu:1,classifier_nam:1,plot_auc:1,counter:1,comput:1,file:1,creat:1,"int":1,auc_x:1,parser:1,argument:1,indic:1,repres:1,savefil:1,need:1,load_data:1,seed:1,imdb:1,have:1,home:1,auc_i:1,been:1,multinomialnb:1,check:1,multipl:1,equival:1,etc:1,perform:1,make:1,when:1,classifi:1,accuraci:1,fals:1,valid:1,split:1,which:1,save_acc:1,test:1,command:1,accu_x:1,singl:1,draw_plot:1,draw:1,sure:1,thi:1,avg_result:1,"class":1,object:1,libsvm:1,took:1,log_loss:1,rand_indic:1,bootstrap_s:1,specifi:1,all_combo:1,canva:1,dropbox:1,data:1,implement:1,averag:1,your:1,show_menubar:1,subpool:1,choos:1,directori:1,entri:1,clear:1,bootstrap:1,auc_sav:1,inherit:1,disabl:1,data_to_pi:1,depth:1,qbc:1,combin:1,rotatestrategi:1,clean:1,time:1,model:1,height_org:1,self:1,add_alert:1},objtypes:{"0":"py:module","1":"py:method","2":"py:class","3":"py:function"},objnames:{"0":["py","module","Python module"],"1":["py","method","Python method"],"2":["py","class","Python class"],"3":["py","function","Python function"]},filenames:["index","code"],titles:["Welcome to Active Learning’s documentation!","Documentation"],objects:{"front_end.gui.run_al_gui.HelperFunctions":{load_data:[1,1,1,""],all_combos:[1,1,1,""],gray_out:[1,1,1,""],open_data:[1,1,1,""],gray_run:[1,1,1,""]},utils:{utils:[1,0,0,"-"]},"front_end.cl.run_al_cl.cmd_parse":{assign_args:[1,1,1,""],main:[1,1,1,""],retrieve_args:[1,1,1,""],run_al:[1,1,1,""]},al:{instance_strategies:[1,0,0,"-"],learning_curve:[1,0,0,"-"]},"al.learning_curve.LearningCurve":{run_trials:[1,1,1,""]},"al.instance_strategies":{RandomStrategy:[1,2,1,""],RandomBootstrap:[1,2,1,""],UncStrategy:[1,2,1,""],ErrorReductionStrategy:[1,2,1,""],BaseStrategy:[1,2,1,""],LogGainStrategy:[1,2,1,""],BootstrapFromEach:[1,2,1,""],RotateStrategy:[1,2,1,""],QBCStrategy:[1,2,1,""]},"front_end.gui.run_al_gui.ParamsWindow":{exit_pref:[1,1,1,""],check_int:[1,1,1,""],display_params:[1,1,1,""],display_pref:[1,1,1,""]},"front_end.cl.run_al_cl":{load_data:[1,3,1,""],cmd_parse:[1,2,1,""]},"al.instance_strategies.RandomStrategy":{chooseNext:[1,1,1,""]},"front_end.gui.run_al_gui.MenuWindow":{show_filemenu:[1,1,1,""],show_editmenu:[1,1,1,""]},"al.instance_strategies.ErrorReductionStrategy":{log_loss:[1,1,1,""],chooseNext:[1,1,1,""]},"al.instance_strategies.LogGainStrategy":{log_gain:[1,1,1,""],chooseNext:[1,1,1,""]},"al.instance_strategies.BootstrapFromEach":{bootstrap:[1,1,1,""]},"front_end.gui.run_al_gui.MainCanvas":{reset:[1,1,1,""],add_strategy_frame_2:[1,1,1,""],add_run_classifier_frame:[1,1,1,""],run:[1,1,1,""],add_buttons:[1,1,1,""],save_acc:[1,1,1,""],save_auc:[1,1,1,""],add_run_strategy_frame:[1,1,1,""],add_classifier_frame_2:[1,1,1,""],clean:[1,1,1,""],clear_plots:[1,1,1,""],add_alerts:[1,1,1,""],plot_auc:[1,1,1,""],plot_acc:[1,1,1,""],show_plots:[1,1,1,""]},"front_end.gui.run_al_gui.Main":{exit_master:[1,1,1,""],run:[1,1,1,""],show_menubar:[1,1,1,""]},"front_end.gui.run_al_gui":{MainCanvas:[1,2,1,""],ParamsWindow:[1,2,1,""],Main:[1,2,1,""],HelperFunctions:[1,2,1,""],MenuWindow:[1,2,1,""]},"front_end.gui":{run_al_gui:[1,0,0,"-"]},"al.instance_strategies.QBCStrategy":{chooseNext:[1,1,1,""],vote_entropy:[1,1,1,""]},"al.learning_curve":{LearningCurve:[1,2,1,""]},"al.instance_strategies.UncStrategy":{chooseNext:[1,1,1,""]},"al.instance_strategies.RandomBootstrap":{bootstrap:[1,1,1,""]},"al.instance_strategies.RotateStrategy":{chooseNext:[1,1,1,""]},"utils.utils":{data_to_py:[1,3,1,""],data_to_file:[1,3,1,""],show_plt:[1,3,1,""],assign_plot_params:[1,3,1,""],draw_plots:[1,3,1,""]},"front_end.cl":{run_al_cl:[1,0,0,"-"]}},titleterms:{welcom:0,front_end:1,gui:1,learn:0,activ:0,indic:0,util:1,exampl:1,tabl:0,learning_curv:1,instance_strategi:1,document:[0,1]}}) -------------------------------------------------------------------------------- /documentation/_images/choose_clas_strat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_images/choose_clas_strat.png -------------------------------------------------------------------------------- /documentation/_images/choose_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_images/choose_data.png -------------------------------------------------------------------------------- /documentation/_images/edit_parameters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_images/edit_parameters.png -------------------------------------------------------------------------------- /documentation/_images/gui_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_images/gui_main.png -------------------------------------------------------------------------------- /documentation/_images/loaded_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_images/loaded_gui.png -------------------------------------------------------------------------------- /documentation/_images/run1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_images/run1.png -------------------------------------------------------------------------------- /documentation/_images/show_plots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_images/show_plots.png -------------------------------------------------------------------------------- /documentation/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/ajax-loader.gif -------------------------------------------------------------------------------- /documentation/_static/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * basic.css 3 | * ~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- basic theme. 6 | * 7 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /* -- main layout ----------------------------------------------------------- */ 13 | 14 | div.clearer { 15 | clear: both; 16 | } 17 | 18 | /* -- relbar ---------------------------------------------------------------- */ 19 | 20 | div.related { 21 | width: 100%; 22 | font-size: 90%; 23 | } 24 | 25 | div.related h3 { 26 | display: none; 27 | } 28 | 29 | div.related ul { 30 | margin: 0; 31 | padding: 0 0 0 10px; 32 | list-style: none; 33 | } 34 | 35 | div.related li { 36 | display: inline; 37 | } 38 | 39 | div.related li.right { 40 | float: right; 41 | margin-right: 5px; 42 | } 43 | 44 | /* -- sidebar --------------------------------------------------------------- */ 45 | 46 | div.sphinxsidebarwrapper { 47 | padding: 10px 5px 0 10px; 48 | } 49 | 50 | div.sphinxsidebar { 51 | float: left; 52 | width: 230px; 53 | margin-left: -100%; 54 | font-size: 90%; 55 | } 56 | 57 | div.sphinxsidebar ul { 58 | list-style: none; 59 | } 60 | 61 | div.sphinxsidebar ul ul, 62 | div.sphinxsidebar ul.want-points { 63 | margin-left: 20px; 64 | list-style: square; 65 | } 66 | 67 | div.sphinxsidebar ul ul { 68 | margin-top: 0; 69 | margin-bottom: 0; 70 | } 71 | 72 | div.sphinxsidebar form { 73 | margin-top: 10px; 74 | } 75 | 76 | div.sphinxsidebar input { 77 | border: 1px solid #98dbcc; 78 | font-family: sans-serif; 79 | font-size: 1em; 80 | } 81 | 82 | div.sphinxsidebar #searchbox input[type="text"] { 83 | width: 170px; 84 | } 85 | 86 | div.sphinxsidebar #searchbox input[type="submit"] { 87 | width: 30px; 88 | } 89 | 90 | img { 91 | border: 0; 92 | max-width: 100%; 93 | } 94 | 95 | /* -- search page ----------------------------------------------------------- */ 96 | 97 | ul.search { 98 | margin: 10px 0 0 20px; 99 | padding: 0; 100 | } 101 | 102 | ul.search li { 103 | padding: 5px 0 5px 20px; 104 | background-image: url(file.png); 105 | background-repeat: no-repeat; 106 | background-position: 0 7px; 107 | } 108 | 109 | ul.search li a { 110 | font-weight: bold; 111 | } 112 | 113 | ul.search li div.context { 114 | color: #888; 115 | margin: 2px 0 0 30px; 116 | text-align: left; 117 | } 118 | 119 | ul.keywordmatches li.goodmatch a { 120 | font-weight: bold; 121 | } 122 | 123 | /* -- index page ------------------------------------------------------------ */ 124 | 125 | table.contentstable { 126 | width: 90%; 127 | } 128 | 129 | table.contentstable p.biglink { 130 | line-height: 150%; 131 | } 132 | 133 | a.biglink { 134 | font-size: 1.3em; 135 | } 136 | 137 | span.linkdescr { 138 | font-style: italic; 139 | padding-top: 5px; 140 | font-size: 90%; 141 | } 142 | 143 | /* -- general index --------------------------------------------------------- */ 144 | 145 | table.indextable { 146 | width: 100%; 147 | } 148 | 149 | table.indextable td { 150 | text-align: left; 151 | vertical-align: top; 152 | } 153 | 154 | table.indextable dl, table.indextable dd { 155 | margin-top: 0; 156 | margin-bottom: 0; 157 | } 158 | 159 | table.indextable tr.pcap { 160 | height: 10px; 161 | } 162 | 163 | table.indextable tr.cap { 164 | margin-top: 10px; 165 | background-color: #f2f2f2; 166 | } 167 | 168 | img.toggler { 169 | margin-right: 3px; 170 | margin-top: 3px; 171 | cursor: pointer; 172 | } 173 | 174 | div.modindex-jumpbox { 175 | border-top: 1px solid #ddd; 176 | border-bottom: 1px solid #ddd; 177 | margin: 1em 0 1em 0; 178 | padding: 0.4em; 179 | } 180 | 181 | div.genindex-jumpbox { 182 | border-top: 1px solid #ddd; 183 | border-bottom: 1px solid #ddd; 184 | margin: 1em 0 1em 0; 185 | padding: 0.4em; 186 | } 187 | 188 | /* -- general body styles --------------------------------------------------- */ 189 | 190 | a.headerlink { 191 | visibility: hidden; 192 | } 193 | 194 | h1:hover > a.headerlink, 195 | h2:hover > a.headerlink, 196 | h3:hover > a.headerlink, 197 | h4:hover > a.headerlink, 198 | h5:hover > a.headerlink, 199 | h6:hover > a.headerlink, 200 | dt:hover > a.headerlink, 201 | caption:hover > a.headerlink, 202 | p.caption:hover > a.headerlink, 203 | div.code-block-caption:hover > a.headerlink { 204 | visibility: visible; 205 | } 206 | 207 | div.body p.caption { 208 | text-align: inherit; 209 | } 210 | 211 | div.body td { 212 | text-align: left; 213 | } 214 | 215 | .field-list ul { 216 | padding-left: 1em; 217 | } 218 | 219 | .first { 220 | margin-top: 0 !important; 221 | } 222 | 223 | p.rubric { 224 | margin-top: 30px; 225 | font-weight: bold; 226 | } 227 | 228 | img.align-left, .figure.align-left, object.align-left { 229 | clear: left; 230 | float: left; 231 | margin-right: 1em; 232 | } 233 | 234 | img.align-right, .figure.align-right, object.align-right { 235 | clear: right; 236 | float: right; 237 | margin-left: 1em; 238 | } 239 | 240 | img.align-center, .figure.align-center, object.align-center { 241 | display: block; 242 | margin-left: auto; 243 | margin-right: auto; 244 | } 245 | 246 | .align-left { 247 | text-align: left; 248 | } 249 | 250 | .align-center { 251 | text-align: center; 252 | } 253 | 254 | .align-right { 255 | text-align: right; 256 | } 257 | 258 | /* -- sidebars -------------------------------------------------------------- */ 259 | 260 | div.sidebar { 261 | margin: 0 0 0.5em 1em; 262 | border: 1px solid #ddb; 263 | padding: 7px 7px 0 7px; 264 | background-color: #ffe; 265 | width: 40%; 266 | float: right; 267 | } 268 | 269 | p.sidebar-title { 270 | font-weight: bold; 271 | } 272 | 273 | /* -- topics ---------------------------------------------------------------- */ 274 | 275 | div.topic { 276 | border: 1px solid #ccc; 277 | padding: 7px 7px 0 7px; 278 | margin: 10px 0 10px 0; 279 | } 280 | 281 | p.topic-title { 282 | font-size: 1.1em; 283 | font-weight: bold; 284 | margin-top: 10px; 285 | } 286 | 287 | /* -- admonitions ----------------------------------------------------------- */ 288 | 289 | div.admonition { 290 | margin-top: 10px; 291 | margin-bottom: 10px; 292 | padding: 7px; 293 | } 294 | 295 | div.admonition dt { 296 | font-weight: bold; 297 | } 298 | 299 | div.admonition dl { 300 | margin-bottom: 0; 301 | } 302 | 303 | p.admonition-title { 304 | margin: 0px 10px 5px 0px; 305 | font-weight: bold; 306 | } 307 | 308 | div.body p.centered { 309 | text-align: center; 310 | margin-top: 25px; 311 | } 312 | 313 | /* -- tables ---------------------------------------------------------------- */ 314 | 315 | table.docutils { 316 | border: 0; 317 | border-collapse: collapse; 318 | } 319 | 320 | table caption span.caption-number { 321 | font-style: italic; 322 | } 323 | 324 | table caption span.caption-text { 325 | } 326 | 327 | table.docutils td, table.docutils th { 328 | padding: 1px 8px 1px 5px; 329 | border-top: 0; 330 | border-left: 0; 331 | border-right: 0; 332 | border-bottom: 1px solid #aaa; 333 | } 334 | 335 | table.field-list td, table.field-list th { 336 | border: 0 !important; 337 | } 338 | 339 | table.footnote td, table.footnote th { 340 | border: 0 !important; 341 | } 342 | 343 | th { 344 | text-align: left; 345 | padding-right: 5px; 346 | } 347 | 348 | table.citation { 349 | border-left: solid 1px gray; 350 | margin-left: 1px; 351 | } 352 | 353 | table.citation td { 354 | border-bottom: none; 355 | } 356 | 357 | /* -- figures --------------------------------------------------------------- */ 358 | 359 | div.figure { 360 | margin: 0.5em; 361 | padding: 0.5em; 362 | } 363 | 364 | div.figure p.caption { 365 | padding: 0.3em; 366 | } 367 | 368 | div.figure p.caption span.caption-number { 369 | font-style: italic; 370 | } 371 | 372 | div.figure p.caption span.caption-text { 373 | } 374 | 375 | 376 | /* -- other body styles ----------------------------------------------------- */ 377 | 378 | ol.arabic { 379 | list-style: decimal; 380 | } 381 | 382 | ol.loweralpha { 383 | list-style: lower-alpha; 384 | } 385 | 386 | ol.upperalpha { 387 | list-style: upper-alpha; 388 | } 389 | 390 | ol.lowerroman { 391 | list-style: lower-roman; 392 | } 393 | 394 | ol.upperroman { 395 | list-style: upper-roman; 396 | } 397 | 398 | dl { 399 | margin-bottom: 15px; 400 | } 401 | 402 | dd p { 403 | margin-top: 0px; 404 | } 405 | 406 | dd ul, dd table { 407 | margin-bottom: 10px; 408 | } 409 | 410 | dd { 411 | margin-top: 3px; 412 | margin-bottom: 10px; 413 | margin-left: 30px; 414 | } 415 | 416 | dt:target, .highlighted { 417 | background-color: #fbe54e; 418 | } 419 | 420 | dl.glossary dt { 421 | font-weight: bold; 422 | font-size: 1.1em; 423 | } 424 | 425 | .field-list ul { 426 | margin: 0; 427 | padding-left: 1em; 428 | } 429 | 430 | .field-list p { 431 | margin: 0; 432 | } 433 | 434 | .optional { 435 | font-size: 1.3em; 436 | } 437 | 438 | .sig-paren { 439 | font-size: larger; 440 | } 441 | 442 | .versionmodified { 443 | font-style: italic; 444 | } 445 | 446 | .system-message { 447 | background-color: #fda; 448 | padding: 5px; 449 | border: 3px solid red; 450 | } 451 | 452 | .footnote:target { 453 | background-color: #ffa; 454 | } 455 | 456 | .line-block { 457 | display: block; 458 | margin-top: 1em; 459 | margin-bottom: 1em; 460 | } 461 | 462 | .line-block .line-block { 463 | margin-top: 0; 464 | margin-bottom: 0; 465 | margin-left: 1.5em; 466 | } 467 | 468 | .guilabel, .menuselection { 469 | font-family: sans-serif; 470 | } 471 | 472 | .accelerator { 473 | text-decoration: underline; 474 | } 475 | 476 | .classifier { 477 | font-style: oblique; 478 | } 479 | 480 | abbr, acronym { 481 | border-bottom: dotted 1px; 482 | cursor: help; 483 | } 484 | 485 | /* -- code displays --------------------------------------------------------- */ 486 | 487 | pre { 488 | overflow: auto; 489 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ 490 | } 491 | 492 | td.linenos pre { 493 | padding: 5px 0px; 494 | border: 0; 495 | background-color: transparent; 496 | color: #aaa; 497 | } 498 | 499 | table.highlighttable { 500 | margin-left: 0.5em; 501 | } 502 | 503 | table.highlighttable td { 504 | padding: 0 0.5em 0 0.5em; 505 | } 506 | 507 | div.code-block-caption { 508 | padding: 2px 5px; 509 | font-size: small; 510 | } 511 | 512 | div.code-block-caption code { 513 | background-color: transparent; 514 | } 515 | 516 | div.code-block-caption + div > div.highlight > pre { 517 | margin-top: 0; 518 | } 519 | 520 | div.code-block-caption span.caption-number { 521 | padding: 0.1em 0.3em; 522 | font-style: italic; 523 | } 524 | 525 | div.code-block-caption span.caption-text { 526 | } 527 | 528 | div.container { 529 | padding: 1em 1em 0; 530 | } 531 | 532 | div.container div.highlight { 533 | margin: 0; 534 | } 535 | 536 | code.descname { 537 | background-color: transparent; 538 | font-weight: bold; 539 | font-size: 1.2em; 540 | } 541 | 542 | code.descclassname { 543 | background-color: transparent; 544 | } 545 | 546 | code.xref, a code { 547 | background-color: transparent; 548 | font-weight: bold; 549 | } 550 | 551 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { 552 | background-color: transparent; 553 | } 554 | 555 | .viewcode-link { 556 | float: right; 557 | } 558 | 559 | .viewcode-back { 560 | float: right; 561 | font-family: sans-serif; 562 | } 563 | 564 | div.viewcode-block:target { 565 | margin: -1px -10px; 566 | padding: 0 10px; 567 | } 568 | 569 | /* -- math display ---------------------------------------------------------- */ 570 | 571 | img.math { 572 | vertical-align: middle; 573 | } 574 | 575 | div.body div.math p { 576 | text-align: center; 577 | } 578 | 579 | span.eqno { 580 | float: right; 581 | } 582 | 583 | /* -- printout stylesheet --------------------------------------------------- */ 584 | 585 | @media print { 586 | div.document, 587 | div.documentwrapper, 588 | div.bodywrapper { 589 | margin: 0 !important; 590 | width: 100%; 591 | } 592 | 593 | div.sphinxsidebar, 594 | div.related, 595 | div.footer, 596 | #top-link { 597 | display: none; 598 | } 599 | } -------------------------------------------------------------------------------- /documentation/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/comment-bright.png -------------------------------------------------------------------------------- /documentation/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/comment-close.png -------------------------------------------------------------------------------- /documentation/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/comment.png -------------------------------------------------------------------------------- /documentation/_static/contents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/contents.png -------------------------------------------------------------------------------- /documentation/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for all documentation. 6 | * 7 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * select a different prefix for underscore 14 | */ 15 | $u = _.noConflict(); 16 | 17 | /** 18 | * make the code below compatible with browsers without 19 | * an installed firebug like debugger 20 | if (!window.console || !console.firebug) { 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 23 | "profile", "profileEnd"]; 24 | window.console = {}; 25 | for (var i = 0; i < names.length; ++i) 26 | window.console[names[i]] = function() {}; 27 | } 28 | */ 29 | 30 | /** 31 | * small helper function to urldecode strings 32 | */ 33 | jQuery.urldecode = function(x) { 34 | return decodeURIComponent(x).replace(/\+/g, ' '); 35 | }; 36 | 37 | /** 38 | * small helper function to urlencode strings 39 | */ 40 | jQuery.urlencode = encodeURIComponent; 41 | 42 | /** 43 | * This function returns the parsed url parameters of the 44 | * current request. Multiple values per key are supported, 45 | * it will always return arrays of strings for the value parts. 46 | */ 47 | jQuery.getQueryParameters = function(s) { 48 | if (typeof s == 'undefined') 49 | s = document.location.search; 50 | var parts = s.substr(s.indexOf('?') + 1).split('&'); 51 | var result = {}; 52 | for (var i = 0; i < parts.length; i++) { 53 | var tmp = parts[i].split('=', 2); 54 | var key = jQuery.urldecode(tmp[0]); 55 | var value = jQuery.urldecode(tmp[1]); 56 | if (key in result) 57 | result[key].push(value); 58 | else 59 | result[key] = [value]; 60 | } 61 | return result; 62 | }; 63 | 64 | /** 65 | * highlight a given string on a jquery object by wrapping it in 66 | * span elements with the given class name. 67 | */ 68 | jQuery.fn.highlightText = function(text, className) { 69 | function highlight(node) { 70 | if (node.nodeType == 3) { 71 | var val = node.nodeValue; 72 | var pos = val.toLowerCase().indexOf(text); 73 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { 74 | var span = document.createElement("span"); 75 | span.className = className; 76 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 77 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 78 | document.createTextNode(val.substr(pos + text.length)), 79 | node.nextSibling)); 80 | node.nodeValue = val.substr(0, pos); 81 | } 82 | } 83 | else if (!jQuery(node).is("button, select, textarea")) { 84 | jQuery.each(node.childNodes, function() { 85 | highlight(this); 86 | }); 87 | } 88 | } 89 | return this.each(function() { 90 | highlight(this); 91 | }); 92 | }; 93 | 94 | /* 95 | * backward compatibility for jQuery.browser 96 | * This will be supported until firefox bug is fixed. 97 | */ 98 | if (!jQuery.browser) { 99 | jQuery.uaMatch = function(ua) { 100 | ua = ua.toLowerCase(); 101 | 102 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 103 | /(webkit)[ \/]([\w.]+)/.exec(ua) || 104 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 105 | /(msie) ([\w.]+)/.exec(ua) || 106 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 107 | []; 108 | 109 | return { 110 | browser: match[ 1 ] || "", 111 | version: match[ 2 ] || "0" 112 | }; 113 | }; 114 | jQuery.browser = {}; 115 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; 116 | } 117 | 118 | /** 119 | * Small JavaScript module for the documentation. 120 | */ 121 | var Documentation = { 122 | 123 | init : function() { 124 | this.fixFirefoxAnchorBug(); 125 | this.highlightSearchWords(); 126 | this.initIndexTable(); 127 | }, 128 | 129 | /** 130 | * i18n support 131 | */ 132 | TRANSLATIONS : {}, 133 | PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, 134 | LOCALE : 'unknown', 135 | 136 | // gettext and ngettext don't access this so that the functions 137 | // can safely bound to a different name (_ = Documentation.gettext) 138 | gettext : function(string) { 139 | var translated = Documentation.TRANSLATIONS[string]; 140 | if (typeof translated == 'undefined') 141 | return string; 142 | return (typeof translated == 'string') ? translated : translated[0]; 143 | }, 144 | 145 | ngettext : function(singular, plural, n) { 146 | var translated = Documentation.TRANSLATIONS[singular]; 147 | if (typeof translated == 'undefined') 148 | return (n == 1) ? singular : plural; 149 | return translated[Documentation.PLURALEXPR(n)]; 150 | }, 151 | 152 | addTranslations : function(catalog) { 153 | for (var key in catalog.messages) 154 | this.TRANSLATIONS[key] = catalog.messages[key]; 155 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 156 | this.LOCALE = catalog.locale; 157 | }, 158 | 159 | /** 160 | * add context elements like header anchor links 161 | */ 162 | addContextElements : function() { 163 | $('div[id] > :header:first').each(function() { 164 | $('\u00B6'). 165 | attr('href', '#' + this.id). 166 | attr('title', _('Permalink to this headline')). 167 | appendTo(this); 168 | }); 169 | $('dt[id]').each(function() { 170 | $('\u00B6'). 171 | attr('href', '#' + this.id). 172 | attr('title', _('Permalink to this definition')). 173 | appendTo(this); 174 | }); 175 | }, 176 | 177 | /** 178 | * workaround a firefox stupidity 179 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 180 | */ 181 | fixFirefoxAnchorBug : function() { 182 | if (document.location.hash && $.browser.mozilla) 183 | window.setTimeout(function() { 184 | document.location.href += ''; 185 | }, 10); 186 | }, 187 | 188 | /** 189 | * highlight the search words provided in the url in the text 190 | */ 191 | highlightSearchWords : function() { 192 | var params = $.getQueryParameters(); 193 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 194 | if (terms.length) { 195 | var body = $('div.body'); 196 | if (!body.length) { 197 | body = $('body'); 198 | } 199 | window.setTimeout(function() { 200 | $.each(terms, function() { 201 | body.highlightText(this.toLowerCase(), 'highlighted'); 202 | }); 203 | }, 10); 204 | $('') 206 | .appendTo($('#searchbox')); 207 | } 208 | }, 209 | 210 | /** 211 | * init the domain index toggle buttons 212 | */ 213 | initIndexTable : function() { 214 | var togglers = $('img.toggler').click(function() { 215 | var src = $(this).attr('src'); 216 | var idnum = $(this).attr('id').substr(7); 217 | $('tr.cg-' + idnum).toggle(); 218 | if (src.substr(-9) == 'minus.png') 219 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 220 | else 221 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 222 | }).css('display', ''); 223 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 224 | togglers.click(); 225 | } 226 | }, 227 | 228 | /** 229 | * helper function to hide the search marks again 230 | */ 231 | hideSearchWords : function() { 232 | $('#searchbox .highlight-link').fadeOut(300); 233 | $('span.highlighted').removeClass('highlighted'); 234 | }, 235 | 236 | /** 237 | * make the url absolute 238 | */ 239 | makeURL : function(relativeURL) { 240 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 241 | }, 242 | 243 | /** 244 | * get the current relative url 245 | */ 246 | getCurrentURL : function() { 247 | var path = document.location.pathname; 248 | var parts = path.split(/\//); 249 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 250 | if (this == '..') 251 | parts.pop(); 252 | }); 253 | var url = parts.join('/'); 254 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 255 | } 256 | }; 257 | 258 | // quick alias for translations 259 | _ = Documentation.gettext; 260 | 261 | $(document).ready(function() { 262 | Documentation.init(); 263 | }); 264 | -------------------------------------------------------------------------------- /documentation/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/down-pressed.png -------------------------------------------------------------------------------- /documentation/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/down.png -------------------------------------------------------------------------------- /documentation/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/file.png -------------------------------------------------------------------------------- /documentation/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/minus.png -------------------------------------------------------------------------------- /documentation/_static/navigation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/navigation.png -------------------------------------------------------------------------------- /documentation/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/plus.png -------------------------------------------------------------------------------- /documentation/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 8 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 9 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 10 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 11 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 14 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 15 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 16 | .highlight .go { color: #333333 } /* Generic.Output */ 17 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 19 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 20 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 21 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 22 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 23 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 24 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 25 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 26 | .highlight .kt { color: #902000 } /* Keyword.Type */ 27 | .highlight .m { color: #208050 } /* Literal.Number */ 28 | .highlight .s { color: #4070a0 } /* Literal.String */ 29 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 30 | .highlight .nb { color: #007020 } /* Name.Builtin */ 31 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 32 | .highlight .no { color: #60add5 } /* Name.Constant */ 33 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 34 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 35 | .highlight .ne { color: #007020 } /* Name.Exception */ 36 | .highlight .nf { color: #06287e } /* Name.Function */ 37 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 38 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 39 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 40 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 41 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 42 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 44 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 45 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 46 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 47 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 48 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 49 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 50 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 51 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 52 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 53 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 54 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 55 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 56 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 57 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 58 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 59 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 60 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 61 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 62 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 63 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /documentation/_static/sphinxdoc.css: -------------------------------------------------------------------------------- 1 | /* 2 | * sphinxdoc.css_t 3 | * ~~~~~~~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- sphinxdoc theme. Originally created by 6 | * Armin Ronacher for Werkzeug. 7 | * 8 | * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. 9 | * :license: BSD, see LICENSE for details. 10 | * 11 | */ 12 | 13 | @import url("basic.css"); 14 | 15 | /* -- page layout ----------------------------------------------------------- */ 16 | 17 | body { 18 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 19 | 'Verdana', sans-serif; 20 | font-size: 14px; 21 | letter-spacing: -0.01em; 22 | line-height: 150%; 23 | text-align: center; 24 | background-color: #BFD1D4; 25 | color: black; 26 | padding: 0; 27 | border: 1px solid #aaa; 28 | 29 | margin: 0px 80px 0px 80px; 30 | min-width: 740px; 31 | } 32 | 33 | div.document { 34 | background-color: white; 35 | text-align: left; 36 | background-image: url(contents.png); 37 | background-repeat: repeat-x; 38 | } 39 | 40 | div.bodywrapper { 41 | margin: 0 240px 0 0; 42 | border-right: 1px solid #ccc; 43 | } 44 | 45 | div.body { 46 | margin: 0; 47 | padding: 0.5em 20px 20px 20px; 48 | } 49 | 50 | div.related { 51 | font-size: 1em; 52 | } 53 | 54 | div.related ul { 55 | background-image: url(navigation.png); 56 | height: 2em; 57 | border-top: 1px solid #ddd; 58 | border-bottom: 1px solid #ddd; 59 | } 60 | 61 | div.related ul li { 62 | margin: 0; 63 | padding: 0; 64 | height: 2em; 65 | float: left; 66 | } 67 | 68 | div.related ul li.right { 69 | float: right; 70 | margin-right: 5px; 71 | } 72 | 73 | div.related ul li a { 74 | margin: 0; 75 | padding: 0 5px 0 5px; 76 | line-height: 1.75em; 77 | color: #EE9816; 78 | } 79 | 80 | div.related ul li a:hover { 81 | color: #3CA8E7; 82 | } 83 | 84 | div.sphinxsidebarwrapper { 85 | padding: 0; 86 | } 87 | 88 | div.sphinxsidebar { 89 | margin: 0; 90 | padding: 0.5em 15px 15px 0; 91 | width: 210px; 92 | float: right; 93 | font-size: 1em; 94 | text-align: left; 95 | } 96 | 97 | div.sphinxsidebar h3, div.sphinxsidebar h4 { 98 | margin: 1em 0 0.5em 0; 99 | font-size: 1em; 100 | padding: 0.1em 0 0.1em 0.5em; 101 | color: white; 102 | border: 1px solid #86989B; 103 | background-color: #AFC1C4; 104 | } 105 | 106 | div.sphinxsidebar h3 a { 107 | color: white; 108 | } 109 | 110 | div.sphinxsidebar ul { 111 | padding-left: 1.5em; 112 | margin-top: 7px; 113 | padding: 0; 114 | line-height: 130%; 115 | } 116 | 117 | div.sphinxsidebar ul ul { 118 | margin-left: 20px; 119 | } 120 | 121 | div.footer { 122 | background-color: #E3EFF1; 123 | color: #86989B; 124 | padding: 3px 8px 3px 0; 125 | clear: both; 126 | font-size: 0.8em; 127 | text-align: right; 128 | } 129 | 130 | div.footer a { 131 | color: #86989B; 132 | text-decoration: underline; 133 | } 134 | 135 | /* -- body styles ----------------------------------------------------------- */ 136 | 137 | p { 138 | margin: 0.8em 0 0.5em 0; 139 | } 140 | 141 | a { 142 | color: #CA7900; 143 | text-decoration: none; 144 | } 145 | 146 | a:hover { 147 | color: #2491CF; 148 | } 149 | 150 | div.body a { 151 | text-decoration: underline; 152 | } 153 | 154 | h1 { 155 | margin: 0; 156 | padding: 0.7em 0 0.3em 0; 157 | font-size: 1.5em; 158 | color: #11557C; 159 | } 160 | 161 | h2 { 162 | margin: 1.3em 0 0.2em 0; 163 | font-size: 1.35em; 164 | padding: 0; 165 | } 166 | 167 | h3 { 168 | margin: 1em 0 -0.3em 0; 169 | font-size: 1.2em; 170 | } 171 | 172 | div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a { 173 | color: black!important; 174 | } 175 | 176 | h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor { 177 | display: none; 178 | margin: 0 0 0 0.3em; 179 | padding: 0 0.2em 0 0.2em; 180 | color: #aaa!important; 181 | } 182 | 183 | h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, 184 | h5:hover a.anchor, h6:hover a.anchor { 185 | display: inline; 186 | } 187 | 188 | h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover, 189 | h5 a.anchor:hover, h6 a.anchor:hover { 190 | color: #777; 191 | background-color: #eee; 192 | } 193 | 194 | a.headerlink { 195 | color: #c60f0f!important; 196 | font-size: 1em; 197 | margin-left: 6px; 198 | padding: 0 4px 0 4px; 199 | text-decoration: none!important; 200 | } 201 | 202 | a.headerlink:hover { 203 | background-color: #ccc; 204 | color: white!important; 205 | } 206 | 207 | cite, code, code { 208 | font-family: 'Consolas', 'Deja Vu Sans Mono', 209 | 'Bitstream Vera Sans Mono', monospace; 210 | font-size: 0.95em; 211 | letter-spacing: 0.01em; 212 | } 213 | 214 | code { 215 | background-color: #f2f2f2; 216 | border-bottom: 1px solid #ddd; 217 | color: #333; 218 | } 219 | 220 | code.descname, code.descclassname, code.xref { 221 | border: 0; 222 | } 223 | 224 | hr { 225 | border: 1px solid #abc; 226 | margin: 2em; 227 | } 228 | 229 | a code { 230 | border: 0; 231 | color: #CA7900; 232 | } 233 | 234 | a code:hover { 235 | color: #2491CF; 236 | } 237 | 238 | pre { 239 | font-family: 'Consolas', 'Deja Vu Sans Mono', 240 | 'Bitstream Vera Sans Mono', monospace; 241 | font-size: 0.95em; 242 | letter-spacing: 0.015em; 243 | line-height: 120%; 244 | padding: 0.5em; 245 | border: 1px solid #ccc; 246 | background-color: #f8f8f8; 247 | } 248 | 249 | pre a { 250 | color: inherit; 251 | text-decoration: underline; 252 | } 253 | 254 | td.linenos pre { 255 | padding: 0.5em 0; 256 | } 257 | 258 | div.quotebar { 259 | background-color: #f8f8f8; 260 | max-width: 250px; 261 | float: right; 262 | padding: 2px 7px; 263 | border: 1px solid #ccc; 264 | } 265 | 266 | div.topic { 267 | background-color: #f8f8f8; 268 | } 269 | 270 | table { 271 | border-collapse: collapse; 272 | margin: 0 -0.5em 0 -0.5em; 273 | } 274 | 275 | table td, table th { 276 | padding: 0.2em 0.5em 0.2em 0.5em; 277 | } 278 | 279 | div.admonition, div.warning { 280 | font-size: 0.9em; 281 | margin: 1em 0 1em 0; 282 | border: 1px solid #86989B; 283 | background-color: #f7f7f7; 284 | padding: 0; 285 | } 286 | 287 | div.admonition p, div.warning p { 288 | margin: 0.5em 1em 0.5em 1em; 289 | padding: 0; 290 | } 291 | 292 | div.admonition pre, div.warning pre { 293 | margin: 0.4em 1em 0.4em 1em; 294 | } 295 | 296 | div.admonition p.admonition-title, 297 | div.warning p.admonition-title { 298 | margin: 0; 299 | padding: 0.1em 0 0.1em 0.5em; 300 | color: white; 301 | border-bottom: 1px solid #86989B; 302 | font-weight: bold; 303 | background-color: #AFC1C4; 304 | } 305 | 306 | div.warning { 307 | border: 1px solid #940000; 308 | } 309 | 310 | div.warning p.admonition-title { 311 | background-color: #CF0000; 312 | border-bottom-color: #940000; 313 | } 314 | 315 | div.admonition ul, div.admonition ol, 316 | div.warning ul, div.warning ol { 317 | margin: 0.1em 0.5em 0.5em 3em; 318 | padding: 0; 319 | } 320 | 321 | div.versioninfo { 322 | margin: 1em 0 0 0; 323 | border: 1px solid #ccc; 324 | background-color: #DDEAF0; 325 | padding: 8px; 326 | line-height: 1.3em; 327 | font-size: 0.9em; 328 | } 329 | 330 | .viewcode-back { 331 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 332 | 'Verdana', sans-serif; 333 | } 334 | 335 | div.viewcode-block:target { 336 | background-color: #f4debf; 337 | border-top: 1px solid #ac9; 338 | border-bottom: 1px solid #ac9; 339 | } 340 | 341 | div.code-block-caption { 342 | background-color: #ddd; 343 | color: #222; 344 | border: 1px solid #ccc; 345 | } -------------------------------------------------------------------------------- /documentation/_static/underscore.js: -------------------------------------------------------------------------------- 1 | // Underscore.js 1.3.1 2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. 3 | // Underscore is freely distributable under the MIT license. 4 | // Portions of Underscore are inspired or borrowed from Prototype, 5 | // Oliver Steele's Functional, and John Resig's Micro-Templating. 6 | // For all details and documentation: 7 | // http://documentcloud.github.com/underscore 8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== 9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c, 10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each= 11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a== 12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect= 13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e= 14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= 15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a, 17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}}; 24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments, 25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)}; 26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"}; 27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a), 28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+ 29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]= 30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain= 31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); 32 | -------------------------------------------------------------------------------- /documentation/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/up-pressed.png -------------------------------------------------------------------------------- /documentation/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/documentation/_static/up.png -------------------------------------------------------------------------------- /documentation/code.rst: -------------------------------------------------------------------------------- 1 | Documentation 2 | ==================== 3 | 4 | al 5 | ---- 6 | 7 | al.instance_strategies 8 | ^^^^^^^^^^^^^^^^^^^^^^ 9 | 10 | .. automodule:: al.instance_strategies 11 | :members: 12 | 13 | al.learning_curve 14 | ^^^^^^^^^^^^^^^^^ 15 | 16 | .. automodule:: al.learning_curve 17 | :members: 18 | 19 | front_end.cl 20 | ------------ 21 | 22 | .. automodule:: front_end.cl.run_al_cl 23 | :members: 24 | 25 | Examples 26 | ^^^^^^^^ 27 | The following code runs :mod:`front_end.cl.run_al_cl` with the following parameters: 28 | 29 | * number of trials - 5 30 | * strategy - rand 31 | * bootstrap - 10 32 | * budget - 500 33 | * step size - 10 34 | * subpool - 250 35 | * data paths - ../../../data/imdb-binary-pool-mindf5-ng11 ../../../data/imdb-binary-test-mindf5-ng11 36 | 37 | .. code-block:: python 38 | 39 | python run_al_cl.py -c MultinomialNB -nt 5 -st rand -bs 10 -b 500 -sz 10 -sp 250 -d ../../../data/imdb-binary-pool-mindf5-ng11 ../../../data/imdb-binary-test-mindf5-ng11 40 | 41 | *The output of this code is:* 42 | 43 | *Status:* 44 | 45 | .. code-block:: python 46 | 47 | Loading took 17.88s. 48 | 49 | trial 0 50 | trial 1 51 | trial 2 52 | trial 3 53 | trial 4 54 | 55 | *Data output is placed in a file in your current working directory. The 56 | default filename is avg_results.txt.* 57 | 58 | *Sample Data Output:* 59 | 60 | .. code-block:: python 61 | 62 | rand 63 | accuracy 64 | train size,mean 65 | 10,0.557016 66 | 20,0.538432 67 | 30,0.534664 68 | 40,0.575320 69 | 50,0.651672 70 | 60,0.621416 71 | 70,0.670400 72 | 80,0.645680 73 | 90,0.659520 74 | 100,0.610160 75 | 110,0.658024 76 | 77 | *Plot Image:* 78 | 79 | .. image:: _images/run1.png 80 | :width: 50% 81 | 82 | front_end.gui 83 | ------------- 84 | 85 | .. automodule:: front_end.gui.run_al_gui 86 | :members: 87 | 88 | Examples 89 | ^^^^^^^^ 90 | 91 | The following provides an in-depth look at a sample run of :mod:`front_end.gui.run_al_gui` 92 | 93 | .. code-block:: python 94 | 95 | python run_al_gui.py 96 | 97 | *GUI Main Window (with all values reset)* 98 | 99 | .. image:: _images/gui_main.png 100 | :width: 80% 101 | 102 | *Setting up the gui to run the following equivalent run of the command line interface:* 103 | 104 | .. code-block:: python 105 | 106 | python run_al_cl.py -c MultinomialNB -d /home/geet/Dropbox/Research/Bilgic/data/20_newsgroups_train /home/geet/Dropbox/Research/Bilgic/data/20_newsgroups_train hash -nt 5 -st rand -bs 10 -b 500 -sz 10 -sp 250 107 | 108 | *Choose train and test data files:* 109 | 110 | .. image:: _images/choose_data.png 111 | :width: 50% 112 | :align: left 113 | 114 | .. image:: _images/loaded_gui.png 115 | :width: 80% 116 | 117 | *Edit parameters to match specified run:* 118 | 119 | .. image:: _images/edit_parameters.png 120 | :width: 20% 121 | 122 | *Choose MultinomialNB and rand as the classifier-strategy combination:* 123 | 124 | .. image:: _images/choose_clas_strat.png 125 | :width: 30% 126 | 127 | *Run terminal output:* 128 | 129 | .. code-block:: python 130 | 131 | python run_al_cl.py -pf MultinomialNB-rand -c MultinomialNB -d /home/geet/Dropbox/Research/Bilgic/data/20_newsgroups_train /home/geet/Dropbox/Research/Bilgic/data/20_newsgroups_train hash -nt 5 -st rand -bs 10 -b 500 -sz 10 -sp 250 132 | trial 0 133 | trial 1 134 | trial 2 135 | trial 3 136 | trial 4 137 | 138 | *Show plots when done:* 139 | 140 | .. image:: _images/show_plots.png 141 | :width: 50% 142 | 143 | utils.utils 144 | ----------- 145 | 146 | .. automodule:: utils.utils 147 | :members: 148 | -------------------------------------------------------------------------------- /documentation/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Active Learning documentation build configuration file, created by 4 | # sphinx-quickstart on Wed Jan 7 00:37:28 2015. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | import sys 16 | import os 17 | 18 | # If extensions (or modules to document with autodoc) are in another directory, 19 | # add these directories to sys.path here. If the directory is relative to the 20 | # documentation root, use os.path.abspath to make it absolute, like shown here. 21 | sys.path.insert(0, os.path.abspath('../')) 22 | 23 | # -- General configuration ------------------------------------------------ 24 | 25 | # If your documentation needs a minimal Sphinx version, state it here. 26 | #needs_sphinx = '1.0' 27 | 28 | # Add any Sphinx extension module names here, as strings. They can be 29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 30 | # ones. 31 | extensions = [ 32 | 'sphinx.ext.autodoc', 33 | ] 34 | 35 | # Add any paths that contain templates here, relative to this directory. 36 | templates_path = ['_templates'] 37 | 38 | # The suffix of source filenames. 39 | source_suffix = '.rst' 40 | 41 | # The encoding of source files. 42 | #source_encoding = 'utf-8-sig' 43 | 44 | # The master toctree document. 45 | master_doc = 'index' 46 | 47 | # General information about the project. 48 | project = u'Active Learning' 49 | copyright = u'2015, Geet Kumar' 50 | 51 | # The version info for the project you're documenting, acts as replacement for 52 | # |version| and |release|, also used in various other places throughout the 53 | # built documents. 54 | # 55 | # The short X.Y version. 56 | version = '0.1' 57 | # The full version, including alpha/beta/rc tags. 58 | release = '0.1' 59 | 60 | # The language for content autogenerated by Sphinx. Refer to documentation 61 | # for a list of supported languages. 62 | # 63 | # This is also used if you do content translation via gettext catalogs. 64 | # Usually you set "language" from the command line for these cases. 65 | language = None 66 | 67 | # There are two options for replacing |today|: either, you set today to some 68 | # non-false value, then it is used: 69 | #today = '' 70 | # Else, today_fmt is used as the format for a strftime call. 71 | #today_fmt = '%B %d, %Y' 72 | 73 | # List of patterns, relative to source directory, that match files and 74 | # directories to ignore when looking for source files. 75 | exclude_patterns = ['_build'] 76 | 77 | # The reST default role (used for this markup: `text`) to use for all 78 | # documents. 79 | #default_role = None 80 | 81 | # If true, '()' will be appended to :func: etc. cross-reference text. 82 | #add_function_parentheses = True 83 | 84 | # If true, the current module name will be prepended to all description 85 | # unit titles (such as .. function::). 86 | #add_module_names = True 87 | 88 | # If true, sectionauthor and moduleauthor directives will be shown in the 89 | # output. They are ignored by default. 90 | #show_authors = False 91 | 92 | # The name of the Pygments (syntax highlighting) style to use. 93 | pygments_style = 'sphinx' 94 | 95 | # A list of ignored prefixes for module index sorting. 96 | #modindex_common_prefix = [] 97 | 98 | # If true, keep warnings as "system message" paragraphs in the built documents. 99 | #keep_warnings = False 100 | 101 | 102 | # -- Options for HTML output ---------------------------------------------- 103 | 104 | # The theme to use for HTML and HTML Help pages. See the documentation for 105 | # a list of builtin themes. 106 | html_theme = 'sphinxdoc' 107 | 108 | # Theme options are theme-specific and customize the look and feel of a theme 109 | # further. For a list of options available for each theme, see the 110 | # documentation. 111 | #html_theme_options = {} 112 | 113 | # Add any paths that contain custom themes here, relative to this directory. 114 | #html_theme_path = [] 115 | 116 | # The name for this set of Sphinx documents. If None, it defaults to 117 | # " v documentation". 118 | #html_title = None 119 | 120 | # A shorter title for the navigation bar. Default is the same as html_title. 121 | #html_short_title = None 122 | 123 | # The name of an image file (relative to this directory) to place at the top 124 | # of the sidebar. 125 | #html_logo = None 126 | 127 | # The name of an image file (within the static path) to use as favicon of the 128 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 129 | # pixels large. 130 | #html_favicon = None 131 | 132 | # Add any paths that contain custom static files (such as style sheets) here, 133 | # relative to this directory. They are copied after the builtin static files, 134 | # so a file named "default.css" will overwrite the builtin "default.css". 135 | html_static_path = ['_static'] 136 | 137 | # Add any extra paths that contain custom files (such as robots.txt or 138 | # .htaccess) here, relative to this directory. These files are copied 139 | # directly to the root of the documentation. 140 | #html_extra_path = [] 141 | 142 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 143 | # using the given strftime format. 144 | #html_last_updated_fmt = '%b %d, %Y' 145 | 146 | # If true, SmartyPants will be used to convert quotes and dashes to 147 | # typographically correct entities. 148 | #html_use_smartypants = True 149 | 150 | # Custom sidebar templates, maps document names to template names. 151 | #html_sidebars = {} 152 | 153 | # Additional templates that should be rendered to pages, maps page names to 154 | # template names. 155 | #html_additional_pages = {} 156 | 157 | # If false, no module index is generated. 158 | #html_domain_indices = True 159 | 160 | # If false, no index is generated. 161 | #html_use_index = True 162 | 163 | # If true, the index is split into individual pages for each letter. 164 | #html_split_index = False 165 | 166 | # If true, links to the reST sources are added to the pages. 167 | #html_show_sourcelink = True 168 | 169 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 170 | #html_show_sphinx = True 171 | 172 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 173 | #html_show_copyright = True 174 | 175 | # If true, an OpenSearch description file will be output, and all pages will 176 | # contain a tag referring to it. The value of this option must be the 177 | # base URL from which the finished HTML is served. 178 | #html_use_opensearch = '' 179 | 180 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 181 | #html_file_suffix = None 182 | 183 | # Language to be used for generating the HTML full-text search index. 184 | # Sphinx supports the following languages: 185 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 186 | # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' 187 | #html_search_language = 'en' 188 | 189 | # A dictionary with options for the search language support, empty by default. 190 | # Now only 'ja' uses this config value 191 | #html_search_options = {'type': 'default'} 192 | 193 | # The name of a javascript file (relative to the configuration directory) that 194 | # implements a search results scorer. If empty, the default will be used. 195 | #html_search_scorer = 'scorer.js' 196 | 197 | # Output file base name for HTML help builder. 198 | htmlhelp_basename = 'ActiveLearningdoc' 199 | 200 | # -- Options for LaTeX output --------------------------------------------- 201 | 202 | latex_elements = { 203 | # The paper size ('letterpaper' or 'a4paper'). 204 | #'papersize': 'letterpaper', 205 | 206 | # The font size ('10pt', '11pt' or '12pt'). 207 | #'pointsize': '10pt', 208 | 209 | # Additional stuff for the LaTeX preamble. 210 | #'preamble': '', 211 | 212 | # Latex figure (float) alignment 213 | #'figure_align': 'htbp', 214 | } 215 | 216 | # Grouping the document tree into LaTeX files. List of tuples 217 | # (source start file, target name, title, 218 | # author, documentclass [howto, manual, or own class]). 219 | latex_documents = [ 220 | ('index', 'ActiveLearning.tex', u'Active Learning Documentation', 221 | u'Geet Kumar', 'manual'), 222 | ] 223 | 224 | # The name of an image file (relative to this directory) to place at the top of 225 | # the title page. 226 | #latex_logo = None 227 | 228 | # For "manual" documents, if this is true, then toplevel headings are parts, 229 | # not chapters. 230 | #latex_use_parts = False 231 | 232 | # If true, show page references after internal links. 233 | #latex_show_pagerefs = False 234 | 235 | # If true, show URL addresses after external links. 236 | #latex_show_urls = False 237 | 238 | # Documents to append as an appendix to all manuals. 239 | #latex_appendices = [] 240 | 241 | # If false, no module index is generated. 242 | #latex_domain_indices = True 243 | 244 | 245 | # -- Options for manual page output --------------------------------------- 246 | 247 | # One entry per manual page. List of tuples 248 | # (source start file, name, description, authors, manual section). 249 | man_pages = [ 250 | ('index', 'activelearning', u'Active Learning Documentation', 251 | [u'Geet Kumar'], 1) 252 | ] 253 | 254 | # If true, show URL addresses after external links. 255 | #man_show_urls = False 256 | 257 | 258 | # -- Options for Texinfo output ------------------------------------------- 259 | 260 | # Grouping the document tree into Texinfo files. List of tuples 261 | # (source start file, target name, title, author, 262 | # dir menu entry, description, category) 263 | texinfo_documents = [ 264 | ('index', 'ActiveLearning', u'Active Learning Documentation', 265 | u'Geet Kumar', 'ActiveLearning', 'One line description of project.', 266 | 'Miscellaneous'), 267 | ] 268 | 269 | # Documents to append as an appendix to all manuals. 270 | #texinfo_appendices = [] 271 | 272 | # If false, no module index is generated. 273 | #texinfo_domain_indices = True 274 | 275 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 276 | #texinfo_show_urls = 'footnote' 277 | 278 | # If true, do not generate a @detailmenu in the "Top" node's menu. 279 | #texinfo_no_detailmenu = False 280 | -------------------------------------------------------------------------------- /documentation/index.rst: -------------------------------------------------------------------------------- 1 | .. Active Learning documentation master file, created by 2 | sphinx-quickstart on Wed Jan 7 00:37:28 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Active Learning's documentation! 7 | =========================================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | code 15 | 16 | 17 | Indices and tables 18 | ================== 19 | 20 | * :ref:`genindex` 21 | * :ref:`modindex` 22 | * :ref:`search` 23 | 24 | -------------------------------------------------------------------------------- /empirical_study_datasets/real/calhousing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/calhousing.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/hiva.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/hiva.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/ibn_sina.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/ibn_sina.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/kdd99_10perc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/kdd99_10perc.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/letterAM.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/letterAM.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/letterO.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/letterO.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/nova.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/nova.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/orange.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/orange.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/sylva.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/sylva.zip -------------------------------------------------------------------------------- /empirical_study_datasets/real/zebra.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/real/zebra.zip -------------------------------------------------------------------------------- /empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_01_0_99dist_test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_01_0_99dist_test.zip -------------------------------------------------------------------------------- /empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_01_0_99dist_train.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_01_0_99dist_train.zip -------------------------------------------------------------------------------- /empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_1_0_9dist_test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_1_0_9dist_test.zip -------------------------------------------------------------------------------- /empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_1_0_9dist_train.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_1_0_9dist_train.zip -------------------------------------------------------------------------------- /empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_25_0_75dist_test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_25_0_75dist_test.zip -------------------------------------------------------------------------------- /empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_25_0_75dist_train.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_25_0_75dist_train.zip -------------------------------------------------------------------------------- /empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_5_0_5dist_test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_5_0_5dist_test.zip -------------------------------------------------------------------------------- /empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_5_0_5dist_train.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/empirical_study_datasets/synthetic/nb_1001att_0_0025mi_10sd_0_5_0_5dist_train.zip -------------------------------------------------------------------------------- /front_end/__init__.py: -------------------------------------------------------------------------------- 1 | """Dependencies for both cl and gui""" 2 | 3 | import argparse 4 | import math 5 | import numpy as np 6 | import matplotlib.pyplot as plt 7 | 8 | from collections import defaultdict 9 | from time import time 10 | 11 | from sklearn import metrics 12 | 13 | from sklearn.naive_bayes import MultinomialNB, GaussianNB, BernoulliNB 14 | from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier 15 | from sklearn.linear_model import LogisticRegression 16 | from sklearn.neighbors import KNeighborsClassifier 17 | from sklearn.svm import SVC 18 | from sklearn.tree import DecisionTreeClassifier 19 | 20 | 21 | from sklearn.datasets import load_svmlight_file 22 | 23 | from sklearn.cross_validation import train_test_split 24 | 25 | #from instance_strategies import LogGainStrategy, RandomStrategy, UncStrategy, RotateStrategy, BootstrapFromEach, QBCStrategy, ErrorReductionStrategy 26 | -------------------------------------------------------------------------------- /front_end/cl/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/front_end/cl/__init__.py -------------------------------------------------------------------------------- /front_end/cl/avg_results.txt: -------------------------------------------------------------------------------- 1 | rand 2 | accuracy 3 | train size,mean 4 | 10,0.557016 5 | 20,0.538432 6 | 30,0.534664 7 | 40,0.575320 8 | 50,0.651672 9 | 60,0.621416 10 | 70,0.670400 11 | 80,0.645680 12 | 90,0.659520 13 | 100,0.610160 14 | 110,0.658024 15 | 120,0.666504 16 | 130,0.648168 17 | 140,0.660448 18 | 150,0.672216 19 | 160,0.662504 20 | 170,0.680288 21 | 180,0.677424 22 | 190,0.673544 23 | 200,0.660704 24 | 210,0.656920 25 | 220,0.682016 26 | 230,0.689288 27 | 240,0.696672 28 | 250,0.704984 29 | 260,0.703920 30 | 270,0.715280 31 | 280,0.729272 32 | 290,0.734640 33 | 300,0.731408 34 | 310,0.741512 35 | 320,0.731480 36 | 330,0.741056 37 | 340,0.749240 38 | 350,0.754632 39 | 360,0.750512 40 | 370,0.747776 41 | 380,0.745128 42 | 390,0.753856 43 | 400,0.764320 44 | 410,0.770968 45 | 420,0.774744 46 | 430,0.778800 47 | 440,0.776288 48 | 450,0.776336 49 | 460,0.775976 50 | 470,0.773128 51 | 480,0.773240 52 | 490,0.777920 53 | 500,0.779704 54 | 55 | AUC 56 | train size,mean 57 | 10,0.646581 58 | 20,0.651566 59 | 30,0.683910 60 | 40,0.722917 61 | 50,0.755969 62 | 60,0.750699 63 | 70,0.775512 64 | 80,0.773326 65 | 90,0.778746 66 | 100,0.766049 67 | 110,0.791257 68 | 120,0.799226 69 | 130,0.794745 70 | 140,0.799752 71 | 150,0.807838 72 | 160,0.806022 73 | 170,0.812816 74 | 180,0.815575 75 | 190,0.814503 76 | 200,0.816326 77 | 210,0.816066 78 | 220,0.826632 79 | 230,0.829642 80 | 240,0.832193 81 | 250,0.837229 82 | 260,0.839621 83 | 270,0.844288 84 | 280,0.848479 85 | 290,0.851111 86 | 300,0.852129 87 | 310,0.855093 88 | 320,0.853929 89 | 330,0.855726 90 | 340,0.857735 91 | 350,0.858534 92 | 360,0.859417 93 | 370,0.860289 94 | 380,0.860301 95 | 390,0.863127 96 | 400,0.865784 97 | 410,0.867474 98 | 420,0.867173 99 | 430,0.868216 100 | 440,0.868852 101 | 450,0.869235 102 | 460,0.870769 103 | 470,0.870835 104 | 480,0.871966 105 | 490,0.872769 106 | 500,0.873877 107 | 108 | 109 | 110 | rand 111 | accuracy 112 | train size,mean 113 | 10,0.557016 114 | 20,0.538432 115 | 30,0.534664 116 | 40,0.575320 117 | 50,0.651672 118 | 60,0.621416 119 | 70,0.670400 120 | 80,0.645680 121 | 90,0.659520 122 | 100,0.610160 123 | 110,0.658024 124 | 120,0.666504 125 | 130,0.648168 126 | 140,0.660448 127 | 150,0.672216 128 | 160,0.662504 129 | 170,0.680288 130 | 180,0.677424 131 | 190,0.673544 132 | 200,0.660704 133 | 210,0.656920 134 | 220,0.682016 135 | 230,0.689288 136 | 240,0.696672 137 | 250,0.704984 138 | 260,0.703920 139 | 270,0.715280 140 | 280,0.729272 141 | 290,0.734640 142 | 300,0.731408 143 | 310,0.741512 144 | 320,0.731480 145 | 330,0.741056 146 | 340,0.749240 147 | 350,0.754632 148 | 360,0.750512 149 | 370,0.747776 150 | 380,0.745128 151 | 390,0.753856 152 | 400,0.764320 153 | 410,0.770968 154 | 420,0.774744 155 | 430,0.778800 156 | 440,0.776288 157 | 450,0.776336 158 | 460,0.775976 159 | 470,0.773128 160 | 480,0.773240 161 | 490,0.777920 162 | 500,0.779704 163 | 164 | AUC 165 | train size,mean 166 | 10,0.646581 167 | 20,0.651566 168 | 30,0.683910 169 | 40,0.722917 170 | 50,0.755969 171 | 60,0.750699 172 | 70,0.775512 173 | 80,0.773326 174 | 90,0.778746 175 | 100,0.766049 176 | 110,0.791257 177 | 120,0.799226 178 | 130,0.794745 179 | 140,0.799752 180 | 150,0.807838 181 | 160,0.806022 182 | 170,0.812816 183 | 180,0.815575 184 | 190,0.814503 185 | 200,0.816326 186 | 210,0.816066 187 | 220,0.826632 188 | 230,0.829642 189 | 240,0.832193 190 | 250,0.837229 191 | 260,0.839621 192 | 270,0.844288 193 | 280,0.848479 194 | 290,0.851111 195 | 300,0.852129 196 | 310,0.855093 197 | 320,0.853929 198 | 330,0.855726 199 | 340,0.857735 200 | 350,0.858534 201 | 360,0.859417 202 | 370,0.860289 203 | 380,0.860301 204 | 390,0.863127 205 | 400,0.865784 206 | 410,0.867474 207 | 420,0.867173 208 | 430,0.868216 209 | 440,0.868852 210 | 450,0.869235 211 | 460,0.870769 212 | 470,0.870835 213 | 480,0.871966 214 | 490,0.872769 215 | 500,0.873877 216 | 217 | 218 | 219 | rand 220 | accuracy 221 | train size,mean 222 | 10,0.518772 223 | 20,0.567895 224 | 30,0.580175 225 | 40,0.591754 226 | 50,0.591754 227 | 60,0.609298 228 | 70,0.614035 229 | 80,0.613684 230 | 90,0.614737 231 | 100,0.623509 232 | 110,0.624912 233 | 120,0.633333 234 | 130,0.638070 235 | 140,0.645439 236 | 150,0.641754 237 | 160,0.659474 238 | 170,0.660877 239 | 180,0.658421 240 | 190,0.663509 241 | 200,0.671053 242 | 210,0.674386 243 | 220,0.684035 244 | 230,0.681404 245 | 240,0.674912 246 | 250,0.688596 247 | 260,0.699298 248 | 270,0.696491 249 | 280,0.698246 250 | 290,0.700351 251 | 300,0.691404 252 | 310,0.692982 253 | 320,0.704561 254 | 330,0.711754 255 | 340,0.704737 256 | 350,0.709298 257 | 360,0.713158 258 | 370,0.723333 259 | 380,0.739825 260 | 390,0.731404 261 | 400,0.735439 262 | 410,0.735088 263 | 420,0.731053 264 | 430,0.735088 265 | 440,0.739474 266 | 450,0.730526 267 | 460,0.729298 268 | 470,0.727368 269 | 480,0.736842 270 | 490,0.743860 271 | 500,0.750000 272 | 273 | AUC 274 | train size,mean 275 | 10,0.552931 276 | 20,0.585776 277 | 30,0.618400 278 | 40,0.643036 279 | 50,0.662861 280 | 60,0.684359 281 | 70,0.696552 282 | 80,0.708243 283 | 90,0.721051 284 | 100,0.730587 285 | 110,0.744337 286 | 120,0.757025 287 | 130,0.766132 288 | 140,0.779956 289 | 150,0.784346 290 | 160,0.795093 291 | 170,0.804477 292 | 180,0.810563 293 | 190,0.818217 294 | 200,0.826535 295 | 210,0.834369 296 | 220,0.845497 297 | 230,0.849099 298 | 240,0.850014 299 | 250,0.860335 300 | 260,0.871403 301 | 270,0.872316 302 | 280,0.876435 303 | 290,0.879397 304 | 300,0.881458 305 | 310,0.882942 306 | 320,0.892312 307 | 330,0.898249 308 | 340,0.898055 309 | 350,0.901862 310 | 360,0.906859 311 | 370,0.914774 312 | 380,0.923192 313 | 390,0.923543 314 | 400,0.927356 315 | 410,0.930546 316 | 420,0.932378 317 | 430,0.936457 318 | 440,0.940285 319 | 450,0.940691 320 | 460,0.943010 321 | 470,0.945233 322 | 480,0.948897 323 | 490,0.953312 324 | 500,0.957925 325 | 326 | 327 | 328 | rand 329 | accuracy 330 | train size,mean 331 | 10,0.557016 332 | 20,0.538432 333 | 30,0.534664 334 | 40,0.575320 335 | 50,0.651672 336 | 60,0.621416 337 | 70,0.670400 338 | 80,0.645680 339 | 90,0.659520 340 | 100,0.610160 341 | 110,0.658024 342 | 120,0.666504 343 | 130,0.648168 344 | 140,0.660448 345 | 150,0.672216 346 | 160,0.662504 347 | 170,0.680288 348 | 180,0.677424 349 | 190,0.673544 350 | 200,0.660704 351 | 210,0.656920 352 | 220,0.682016 353 | 230,0.689288 354 | 240,0.696672 355 | 250,0.704984 356 | 260,0.703920 357 | 270,0.715280 358 | 280,0.729272 359 | 290,0.734640 360 | 300,0.731408 361 | 310,0.741512 362 | 320,0.731480 363 | 330,0.741056 364 | 340,0.749240 365 | 350,0.754632 366 | 360,0.750512 367 | 370,0.747776 368 | 380,0.745128 369 | 390,0.753856 370 | 400,0.764320 371 | 410,0.770968 372 | 420,0.774744 373 | 430,0.778800 374 | 440,0.776288 375 | 450,0.776336 376 | 460,0.775976 377 | 470,0.773128 378 | 480,0.773240 379 | 490,0.777920 380 | 500,0.779704 381 | 382 | AUC 383 | train size,mean 384 | 10,0.646581 385 | 20,0.651566 386 | 30,0.683910 387 | 40,0.722917 388 | 50,0.755969 389 | 60,0.750699 390 | 70,0.775512 391 | 80,0.773326 392 | 90,0.778746 393 | 100,0.766049 394 | 110,0.791257 395 | 120,0.799226 396 | 130,0.794745 397 | 140,0.799752 398 | 150,0.807838 399 | 160,0.806022 400 | 170,0.812816 401 | 180,0.815575 402 | 190,0.814503 403 | 200,0.816326 404 | 210,0.816066 405 | 220,0.826632 406 | 230,0.829642 407 | 240,0.832193 408 | 250,0.837229 409 | 260,0.839621 410 | 270,0.844288 411 | 280,0.848479 412 | 290,0.851111 413 | 300,0.852129 414 | 310,0.855093 415 | 320,0.853929 416 | 330,0.855726 417 | 340,0.857735 418 | 350,0.858534 419 | 360,0.859417 420 | 370,0.860289 421 | 380,0.860301 422 | 390,0.863127 423 | 400,0.865784 424 | 410,0.867474 425 | 420,0.867173 426 | 430,0.868216 427 | 440,0.868852 428 | 450,0.869235 429 | 460,0.870769 430 | 470,0.870835 431 | 480,0.871966 432 | 490,0.872769 433 | 500,0.873877 434 | 435 | 436 | 437 | rand 438 | accuracy 439 | train size,mean 440 | 10,0.557016 441 | 20,0.538432 442 | 30,0.534664 443 | 40,0.575320 444 | 50,0.651672 445 | 60,0.621416 446 | 70,0.670400 447 | 80,0.645680 448 | 90,0.659520 449 | 100,0.610160 450 | 110,0.658024 451 | 120,0.666504 452 | 130,0.648168 453 | 140,0.660448 454 | 150,0.672216 455 | 160,0.662504 456 | 170,0.680288 457 | 180,0.677424 458 | 190,0.673544 459 | 200,0.660704 460 | 210,0.656920 461 | 220,0.682016 462 | 230,0.689288 463 | 240,0.696672 464 | 250,0.704984 465 | 260,0.703920 466 | 270,0.715280 467 | 280,0.729272 468 | 290,0.734640 469 | 300,0.731408 470 | 310,0.741512 471 | 320,0.731480 472 | 330,0.741056 473 | 340,0.749240 474 | 350,0.754632 475 | 360,0.750512 476 | 370,0.747776 477 | 380,0.745128 478 | 390,0.753856 479 | 400,0.764320 480 | 410,0.770968 481 | 420,0.774744 482 | 430,0.778800 483 | 440,0.776288 484 | 450,0.776336 485 | 460,0.775976 486 | 470,0.773128 487 | 480,0.773240 488 | 490,0.777920 489 | 500,0.779704 490 | 491 | AUC 492 | train size,mean 493 | 10,0.646581 494 | 20,0.651566 495 | 30,0.683910 496 | 40,0.722917 497 | 50,0.755969 498 | 60,0.750699 499 | 70,0.775512 500 | 80,0.773326 501 | 90,0.778746 502 | 100,0.766049 503 | 110,0.791257 504 | 120,0.799226 505 | 130,0.794745 506 | 140,0.799752 507 | 150,0.807838 508 | 160,0.806022 509 | 170,0.812816 510 | 180,0.815575 511 | 190,0.814503 512 | 200,0.816326 513 | 210,0.816066 514 | 220,0.826632 515 | 230,0.829642 516 | 240,0.832193 517 | 250,0.837229 518 | 260,0.839621 519 | 270,0.844288 520 | 280,0.848479 521 | 290,0.851111 522 | 300,0.852129 523 | 310,0.855093 524 | 320,0.853929 525 | 330,0.855726 526 | 340,0.857735 527 | 350,0.858534 528 | 360,0.859417 529 | 370,0.860289 530 | 380,0.860301 531 | 390,0.863127 532 | 400,0.865784 533 | 410,0.867474 534 | 420,0.867173 535 | 430,0.868216 536 | 440,0.868852 537 | 450,0.869235 538 | 460,0.870769 539 | 470,0.870835 540 | 480,0.871966 541 | 490,0.872769 542 | 500,0.873877 543 | 544 | 545 | 546 | -------------------------------------------------------------------------------- /front_end/cl/run_al_cl.py: -------------------------------------------------------------------------------- 1 | """ 2 | The :mod:`front_end.cl.run_al_cl` implements the methods needed to 3 | run the command-line interface. 4 | """ 5 | import os, sys 6 | path = os.path.join(os.path.dirname("__file__"), '../..') 7 | sys.path.insert(0, path) 8 | 9 | 10 | 11 | import argparse 12 | 13 | from collections import defaultdict 14 | from time import time 15 | 16 | from zipfile import ZipFile 17 | import csv 18 | 19 | import numpy as np 20 | import matplotlib.pyplot as plt 21 | 22 | 23 | from sklearn.naive_bayes import MultinomialNB, GaussianNB, BernoulliNB 24 | from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier 25 | from sklearn.linear_model import LogisticRegression 26 | from sklearn.neighbors import KNeighborsClassifier 27 | from sklearn.svm import SVC 28 | from sklearn.tree import DecisionTreeClassifier 29 | from sklearn.datasets import load_svmlight_file 30 | from sklearn.cross_validation import StratifiedKFold 31 | from sklearn.preprocessing import LabelEncoder 32 | 33 | from al.learning_curve import LearningCurve 34 | 35 | 36 | 37 | def load_data(dataset1, dataset2=None, make_dense=False): 38 | """Loads the dataset(s). 39 | Can handle zip files. 40 | If the data file extension is csv, it reads a csv file. 41 | Then, the last column is treated as the target variable. 42 | Otherwise, the data files are assumed to be in svmlight/libsvm format. 43 | 44 | **Parameters** 45 | 46 | * dataset1 (*str*) - Path to the file of the first dataset. 47 | * dataset2 (*str or None*) - If not None, path to the file of second dataset 48 | * make_dense (*boolean*) - Whether to return dense matrices instead of sparse ones (Note: data from csv files will always be treated as dense) 49 | 50 | **Returns** 51 | 52 | * (X_pool, X_test, y_pool, y_test) - Pool and test files if two files are provided 53 | * (X, y) - The single dataset 54 | 55 | """ 56 | 57 | def _get_extensions(dataset1, dataset2): 58 | first_extension = dataset1[dataset1.rfind('.')+1:] 59 | second_extension = None 60 | if dataset2 is not None: 61 | second_extension = dataset2[dataset2.rfind('.')+1:] 62 | 63 | return first_extension, second_extension 64 | 65 | # Test if these are zipped files 66 | 67 | fe, se = _get_extensions(dataset1, dataset2) 68 | 69 | if se and fe != se: 70 | raise ValueError("Cannot mix and match different file formats") 71 | 72 | iz_zip = fe == 'zip' 73 | 74 | # Open the files and test if these are csv 75 | dataset1_file = None 76 | dataset2_file = None 77 | is_csv = False 78 | 79 | if iz_zip: 80 | my_zip_dataset1 = ZipFile(dataset1) 81 | inside_zip_dataset1 = my_zip_dataset1.namelist()[0] # Assuming each zip contains a single file 82 | inside_zip_dataset2 = None 83 | dataset1_file = my_zip_dataset1.open(inside_zip_dataset1) 84 | if dataset2 is not None: 85 | my_zip_dataset2 = ZipFile(dataset2) 86 | inside_zip_dataset2 = my_zip_dataset2.namelist()[0] # Assuming each zip contains a single file 87 | dataset2_file = my_zip_dataset2.open(inside_zip_dataset2) 88 | inside_fe, inside_se = _get_extensions(inside_zip_dataset1, inside_zip_dataset2) 89 | if inside_se and inside_fe != inside_se: 90 | raise ValueError("Cannot mix and match different file formats") 91 | 92 | is_csv = inside_fe == 'csv' 93 | else: 94 | 95 | dataset1_file = open(dataset1, 'r') 96 | if dataset2 is not None: 97 | dataset2_file = open(dataset2, 'r') 98 | 99 | is_csv = fe == 'csv' 100 | 101 | if dataset2 is not None: 102 | if is_csv: 103 | X_pool, y_pool = load_csv(dataset1_file) 104 | X_test, y_test = load_csv(dataset2_file) 105 | else: 106 | X_pool, y_pool = load_svmlight_file(dataset1_file) 107 | _, num_feat = X_pool.shape 108 | X_test, y_test = load_svmlight_file(dataset2_file, n_features=num_feat) 109 | if make_dense: 110 | X_pool = X_pool.todense() 111 | X_test = X_test.todense() 112 | 113 | le = LabelEncoder() 114 | y_pool = le.fit_transform(y_pool) 115 | y_test = le.transform(y_test) 116 | 117 | dataset1_file.close() 118 | dataset2_file.close() 119 | 120 | return (X_pool, X_test, y_pool, y_test) 121 | 122 | else: 123 | 124 | if is_csv: 125 | X, y = load_csv(dataset1_file) 126 | else: 127 | X, y = load_svmlight_file(dataset1_file) 128 | if make_dense: 129 | X = X.todense() 130 | 131 | le = LabelEncoder() 132 | y = le.fit_transform(y) 133 | 134 | dataset1_file.close() 135 | 136 | return X, y 137 | 138 | 139 | 140 | def load_csv(dataset_file): 141 | X=[] 142 | y=[] 143 | csvreader = csv.reader(dataset_file, delimiter=',') 144 | next(csvreader, None)#skip names 145 | for row in csvreader: 146 | X.append(row[:-1]) 147 | y.append(row[-1]) 148 | X=np.array(X, dtype=float) 149 | y=np.array(y) 150 | return X, y 151 | 152 | def save_all_results(file_name, results): 153 | with open(file_name, 'w') as f: 154 | bs = sorted(results.keys()) 155 | num_trials = len(results[bs[0]]) 156 | # Header 157 | f.write("Budget") 158 | for t in range(num_trials): 159 | f.write(",Trial"+str(t)) 160 | f.write("\n") 161 | # Body 162 | for b in bs: 163 | f.write(str(b)) 164 | res=results[b] 165 | for r in res: 166 | f.write(","+str(r)) 167 | f.write("\n") 168 | 169 | 170 | def plot_and_save_average_results(results, file_name): 171 | 172 | strategies = results.keys() 173 | 174 | measures = sorted(results[strategies[0]].keys()) 175 | 176 | bs = sorted(results[strategies[0]][measures[0]].keys()) 177 | 178 | for measure in measures: 179 | plt.figure(1) 180 | for strategy in strategies: 181 | ave = [results[strategy][measure][b] for b in bs] 182 | plt.plot(bs, ave, '-', label=strategy) 183 | plt.legend(loc='lower right') 184 | plt.xlabel('Budget') 185 | plt.ylabel(measure) 186 | plt.title(measure) 187 | fig_file_name=file_name +"-" + measure + ".png" 188 | plt.savefig(fig_file_name, format='png', bbox_inches='tight') 189 | plt.close(1) 190 | csv_file_name = file_name + "-" + measure + ".csv" 191 | with open(csv_file_name, "w") as f: 192 | f.write("Budget") 193 | for strategy in strategies: 194 | f.write(","+strategy) 195 | f.write("\n") 196 | for b in bs: 197 | f.write(str(b)) 198 | for strategy in strategies: 199 | f.write(","+str(results[strategy][measure][b])) 200 | f.write("\n") 201 | 202 | def plot_average_results(results): 203 | 204 | strategies = results.keys() 205 | 206 | measures = sorted(results[strategies[0]].keys()) 207 | 208 | bs = sorted(results[strategies[0]][measures[0]].keys()) 209 | 210 | # numrows, numcols, fignum 211 | 212 | num_cols = 2 213 | num_rows = int(np.ceil(len(measures)/2.0)) 214 | 215 | measure_index=0 216 | 217 | plt.figure(1) 218 | for _ in range(num_rows): 219 | for _ in range(num_cols): 220 | plt.subplot(num_rows, num_cols, measure_index+1) 221 | for strategy in strategies: 222 | ave = [results[strategy][measures[measure_index]][b] for b in bs] 223 | plt.plot(bs, ave, '-', label=strategy) 224 | plt.legend(loc='lower right') 225 | plt.title(measures[measure_index]) 226 | measure_index += 1 227 | 228 | plt.show() 229 | plt.close(1) 230 | 231 | class cmd_parse(object): 232 | """Class - command line parser""" 233 | def __init__(self): 234 | self.parser = argparse.ArgumentParser() 235 | 236 | def retrieve_args(self): 237 | """Adds arguments to the parser for each respective setting of the command line interface""" 238 | # Classifier 239 | self.parser.add_argument("-c","--classifier", choices=['KNeighborsClassifier', 'LogisticRegression', 'SVC', 'BernoulliNB', 240 | 'DecisionTreeClassifier', 'RandomForestClassifier', 'AdaBoostClassifier', 'GaussianNB', 'MultinomialNB'], 241 | default='MultinomialNB', help="Represents the classifier that will be used (default: MultinomialNB) .") 242 | 243 | # Classifier's arguments 244 | self.parser.add_argument("-a","--arguments", default='', 245 | help="Represents the arguments that will be passed to the classifier (default: '').") 246 | 247 | # Data: Testing and training already split 248 | self.parser.add_argument("-d", '--data', nargs=2, metavar=('pool', 'test'), 249 | default=["data/imdb-binary-pool-mindf5-ng11", "data/imdb-binary-test-mindf5-ng11"], 250 | help='Files that contain the data, pool and test, and number of features (default: data/imdb-binary-pool-mindf5-ng11 data/imdb-binary-test-mindf5-ng11 27272).') 251 | 252 | # Data: Single File 253 | self.parser.add_argument("-sd", '--sdata', type=str, default='', 254 | help='Single file that contains the data. Cross validation will be performed (default: None).') 255 | 256 | # Whether to make the data dense 257 | self.parser.add_argument('-make_dense', default=False, action='store_true', help='Whether to make the sparse data dense. Some classifiers require this.') 258 | 259 | # Number of Folds 260 | self.parser.add_argument("-cv", type=int, default=10, help="Number of folds for cross validation. Works only if a single dataset is loaded (default: 10).") 261 | 262 | # File: Name of file that will be written the results 263 | self.parser.add_argument("-f", '--file', type=str, default=None, 264 | help='This feature represents the name that will be written with the result. If it is left blank, the file will not be written (default: None ).') 265 | 266 | # Number of Trials 267 | self.parser.add_argument("-nt", "--num_trials", type=int, default=10, help="Number of trials (default: 10).") 268 | 269 | # Strategies 270 | self.parser.add_argument("-st", "--strategies", choices=['erreduct', 'loggain', 'qbc', 'rand','unc'], nargs='*',default=['rand'], 271 | help="Represent a list of strategies for choosing next samples (default: rand).") 272 | 273 | # Boot Strap 274 | self.parser.add_argument("-bs", '--bootstrap', default=10, type=int, 275 | help='Sets the Boot strap (default: 10).') 276 | 277 | # Budget 278 | self.parser.add_argument("-b", '--budget', default=500, type=int, 279 | help='Sets the budget (default: 500).') 280 | 281 | # Step size 282 | self.parser.add_argument("-sz", '--stepsize', default=10, type=int, 283 | help='Sets the step size (default: 10).') 284 | 285 | # Sub pool size 286 | self.parser.add_argument("-sp", '--subpool', default=None, type=int, 287 | help='Sets the sub pool size (default: None).') 288 | 289 | 290 | def assign_args(self): 291 | """Assigns values to each of the specified command line arguments for use by :mod:`al.learning_curve`""" 292 | 293 | t0 = time() 294 | 295 | self.args = self.parser.parse_args() 296 | self.classifier = eval((self.args.classifier)) 297 | model_arguments = self.args.arguments.split(',') 298 | self.alpha = {} 299 | 300 | for argument in model_arguments: 301 | if argument.find('=') >= 0: 302 | index, value = argument.split('=') 303 | self.alpha[index] = eval(value) 304 | 305 | self.num_trials = self.args.num_trials 306 | self.strategies = self.args.strategies 307 | self.boot_strap_size = self.args.bootstrap 308 | self.budget = self.args.budget 309 | self.step_size = self.args.stepsize 310 | self.sub_pool = self.args.subpool 311 | 312 | self.make_dense = self.args.make_dense 313 | self.cv = self.args.cv 314 | 315 | self.filename = self.args.file 316 | self.duration = defaultdict(lambda: 0.0) 317 | self.accuracies = defaultdict(lambda: []) 318 | self.aucs = defaultdict(lambda: []) 319 | 320 | if self.args.sdata: 321 | self.X, self.y = load_data(self.args.sdata, None, self.make_dense) 322 | else: 323 | self.X_pool, self.X_test, self.y_pool, self.y_test = load_data(self.args.data[0], self.args.data[1], self.make_dense) 324 | 325 | duration = time() - t0 326 | 327 | print 328 | print "Loading took %0.2fs." % duration 329 | print 330 | 331 | def run_al(self): 332 | """Calls :mod:`al.learning_curve.LearningCurve` and draws plots using :mod:`utils.utils`""" 333 | learning_api = LearningCurve() 334 | # if self.filename: 335 | # f = open(self.filename, 'a') 336 | # else: 337 | # f = open('avg_results.txt', 'a') 338 | 339 | average_performances = {} 340 | 341 | for strategy in self.strategies: 342 | 343 | print "Strategy: %s" %strategy 344 | 345 | if self.args.sdata: 346 | performances = None 347 | skf = StratifiedKFold(self.y, n_folds=self.cv, shuffle=True, random_state=42) 348 | for pool, test in skf: 349 | perfs = learning_api.run_trials(self.X[pool], self.y[pool], self.X[test], self.y[test], strategy, self.classifier, self.alpha, self.boot_strap_size, self.step_size, self.budget, self.num_trials) 350 | if performances is None: 351 | performances = perfs 352 | else: # Merge 353 | measures = perfs.keys() 354 | bs = perfs[measures[0]].keys() 355 | for measure in measures: 356 | for b in bs: 357 | performances[measure][b] += perfs[measure][b] 358 | else: 359 | performances = learning_api.run_trials(self.X_pool, self.y_pool, self.X_test, self.y_test, strategy, self.classifier, self.alpha, self.boot_strap_size, self.step_size, self.budget, self.num_trials) 360 | 361 | measures = performances.keys() 362 | 363 | bs = sorted(performances[measures[0]].keys()) 364 | 365 | average_performances[strategy] = {} 366 | 367 | for measure in measures: 368 | 369 | average_performances[strategy][measure] = {} 370 | for b in bs: 371 | average_performances[strategy][measure][b] = np.mean(performances[measure][b]) 372 | 373 | if self.filename is not None: 374 | file_name = self.filename + "_" + strategy + "_" + measure +"_all.csv" 375 | save_all_results(file_name, performances[measure]) 376 | 377 | 378 | 379 | plot_and_save_average_results(average_performances, self.filename) 380 | #plot_average_results(average_performances) 381 | 382 | def main(self): 383 | """Calls :mod:`retrieve_args`, :mod:`assign_args`, :mod:`run_al`""" 384 | self.retrieve_args() 385 | self.assign_args() 386 | self.run_al() 387 | 388 | if __name__ == '__main__': 389 | cli_app = cmd_parse() 390 | cli_app.main() 391 | -------------------------------------------------------------------------------- /front_end/cl/run_t_test.py: -------------------------------------------------------------------------------- 1 | """ 2 | The :mod:`front_end.cl.run_t_test` implements the methods needed to 3 | read results and run t-tests on them. 4 | """ 5 | 6 | import sys 7 | import csv 8 | import numpy as np 9 | from scipy import stats 10 | 11 | if __name__ == '__main__': 12 | filename1 = sys.argv[1] 13 | filename2 = sys.argv[2] 14 | 15 | X1 = [] 16 | with open(filename1) as csvfile: 17 | csvreader = csv.reader(csvfile, delimiter=',') 18 | next(csvreader, None)#skip names 19 | next(csvreader, None)#skip bootstrap 20 | for row in csvreader: 21 | X1.append(row[1:]) 22 | 23 | X1=np.array(X1, dtype=float) 24 | 25 | X2 = [] 26 | with open(filename2) as csvfile: 27 | csvreader = csv.reader(csvfile, delimiter=',') 28 | next(csvreader, None)#skip names 29 | next(csvreader, None)#skip bootstrap 30 | for row in csvreader: 31 | X2.append(row[1:]) 32 | 33 | X2=np.array(X2, dtype=float) 34 | 35 | # This is an approximation of the area under the curve 36 | means1 = np.mean(X1, axis=0) 37 | means2 = np.mean(X2, axis=0) 38 | 39 | print "Pairing the area under the learning curves" 40 | 41 | print stats.mstats.ttest_ind(means1, means2) 42 | 43 | print "Pairing the mean learning curves" 44 | 45 | means1 = np.mean(X1, axis=1) 46 | means2 = np.mean(X2, axis=1) 47 | 48 | print stats.mstats.ttest_ind(means1, means2) 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /front_end/gui/__init__.py: -------------------------------------------------------------------------------- 1 | """Dependences for gui""" 2 | from Tkinter import * 3 | from PIL import Image, ImageTk 4 | import tkMessageBox, re, os, signal 5 | from time import sleep 6 | import tkFont, tkFileDialog 7 | 8 | import matplotlib.pyplot as pl 9 | 10 | """load_data""" 11 | from sklearn.naive_bayes import MultinomialNB, GaussianNB, BernoulliNB 12 | from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier 13 | from sklearn.linear_model import LogisticRegression 14 | from sklearn.neighbors import KNeighborsClassifier 15 | from sklearn.svm import SVC 16 | from sklearn.tree import DecisionTreeClassifier 17 | 18 | from sklearn.datasets import load_svmlight_file 19 | from sklearn.cross_validation import train_test_split 20 | -------------------------------------------------------------------------------- /front_end/gui/files/run_list.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/front_end/gui/files/run_list.txt -------------------------------------------------------------------------------- /front_end/gui/img/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/front_end/gui/img/background.jpg -------------------------------------------------------------------------------- /front_end/gui/img/blank_acc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/front_end/gui/img/blank_acc.png -------------------------------------------------------------------------------- /front_end/gui/img/blank_auc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/front_end/gui/img/blank_auc.png -------------------------------------------------------------------------------- /front_end/gui/plot_vals.py: -------------------------------------------------------------------------------- 1 | vals = {} 2 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | 3 | setup( 4 | name='AL', 5 | version='0.1', 6 | packages=['al', 'utils', 'front_end', 'front_end.cl', 'front_end.gui'], 7 | url='http://cs.iit.edu/~ml', 8 | license='GNU', 9 | author='Machine Learning Lab @ IIT', 10 | author_email='', 11 | description='Active learning library' 12 | ) 13 | -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iitml/AL/9ccb67a498d6dc930bffc5d035d19b618fe5cc98/utils/__init__.py -------------------------------------------------------------------------------- /utils/utils.py: -------------------------------------------------------------------------------- 1 | """ 2 | The :mod:`utils.utils` implements various helper functions. 3 | """ 4 | import matplotlib.pyplot as plt 5 | 6 | def data_to_file(filename, strategy, accu_y, auc_y, values): 7 | """Places data in file 8 | 9 | **Parameters** 10 | 11 | * filename (*str*) - user-specified path 12 | * strategy 13 | * accu_y (*list*) 14 | * auc_y (*list*) 15 | * values (*list*) 16 | 17 | """ 18 | if filename and filename != "''": 19 | f = open(filename, 'a') 20 | else: 21 | f = open('avg_results.txt', 'a') 22 | 23 | #Write Accuracy Plot Values 24 | f.write(strategy+'\n'+'accuracy'+'\n') 25 | f.write('train size,mean'+'\n') 26 | for i in range(len(accu_y)): 27 | f.write("%d,%f\n" % (values[i], accu_y[i])) 28 | f.write('\n') 29 | 30 | #Write AUC Plot Values 31 | f.write('AUC'+'\n') 32 | f.write('train size,mean'+'\n') 33 | for i in range(len(auc_y)): 34 | f.write("%d,%f\n" % (values[i], auc_y[i])) 35 | f.write('\n\n\n') 36 | 37 | f.close() 38 | 39 | def data_to_py(filename, c, st, acc_x, acc_y, auc_x, auc_y): 40 | 41 | """Places plot data in python file 42 | 43 | **Parameters** 44 | 45 | * filename (*str*) - user-specified path 46 | * c - classifier 47 | * st - strategy 48 | * acc_x (*list*) 49 | * accu_y (*list*) 50 | * auc_x (*list*) 51 | * auc_y (*list*) 52 | 53 | """ 54 | plot_valsf = open(filename, 'a') 55 | plot_valsf.write('vals["%s_%s_accx"]=%s\n' % (c, st, str(acc_x))) 56 | plot_valsf.write('vals["%s_%s_accy"]=%s\n' % (c, st, str(acc_y))) 57 | plot_valsf.close() 58 | 59 | plot_valsf = open(filename, 'a') 60 | plot_valsf.write('vals["%s_%s_aucx"]=%s\n' % (c, st, str(auc_x))) 61 | plot_valsf.write('vals["%s_%s_aucy"]=%s\n' % (c, st, str(auc_y))) 62 | plot_valsf.close() 63 | 64 | def assign_plot_params(avg_accu, avg_auc): 65 | """Assigns plot parameters 66 | 67 | **Parameters** 68 | 69 | * avg_accu - respective average accuracy performance 70 | * avg_auc - respective average auc performance 71 | 72 | **Returns** 73 | 74 | * accu_x (*list*) 75 | * accu_y (*list*) 76 | * auc_x (*list*) 77 | * auc_y (*list*) 78 | 79 | """ 80 | # Accuracy Plot Values 81 | accu_x = sorted(avg_accu.keys()) 82 | accu_y = [avg_accu[xi] for xi in accu_x] 83 | 84 | # AUC Plot Values 85 | auc_x = sorted(avg_auc.keys()) 86 | auc_y = [avg_auc[xi] for xi in auc_x] 87 | 88 | return accu_x, accu_y, auc_x, auc_y 89 | 90 | def draw_plots(strategy, accu_x, accu_y, auc_x, auc_y): 91 | """Draws the plot 92 | 93 | **Parameters** 94 | 95 | * strategy 96 | * accu_x (*list*) 97 | * accu_y (*list*) 98 | * auc_x (*list*) 99 | * auc_y (*list*) 100 | 101 | """ 102 | plt.figure(1) 103 | plt.subplot(211) 104 | plt.plot(accu_x, accu_y, '-', label=strategy) 105 | plt.legend(loc='best') 106 | plt.title('Accuracy') 107 | 108 | plt.subplot(212) 109 | plt.plot(auc_x, auc_y, '-', label=strategy) 110 | plt.legend(loc='best') 111 | plt.title('AUC') 112 | 113 | def show_plt(): 114 | """Shows the plot""" 115 | plt.show() 116 | --------------------------------------------------------------------------------