-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a82190c
Showing
106 changed files
with
21,779 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
*.hdf5 | ||
*.npz | ||
*.npy | ||
*.json | ||
*.xlsx | ||
venv | ||
data | ||
norb_data | ||
/*.png | ||
.ipynb_checkpoints | ||
TF_NN_Logs | ||
output | ||
/*.csv | ||
/*.pkl | ||
/*.tex | ||
cache | ||
LOO_cache | ||
saved_models | ||
octave-workspace | ||
dpp.tgz | ||
train_log | ||
decompose_kernel.m | ||
elem_sympoly.m | ||
genmult.m | ||
sample_dpp.m | ||
sample_k.m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker build -t mkuchnik/iclr19_aug . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker build -t mkuchnik/iclr19_aug:gpu -f Dockerfile.gpu . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
docker run -it --rm -p 8888:8888 \ | ||
-v $(pwd):/code \ | ||
mkuchnik/iclr19_aug \ | ||
"/bin/bash" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
nvidia-docker run --runtime=nvidia -it --rm -p 8888:8888 \ | ||
-v $(pwd):/code \ | ||
mkuchnik/iclr19_aug:gpu \ | ||
"/bin/bash" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM tensorflow/tensorflow:1.12.0-py3 | ||
|
||
LABEL maintainer="Michael Kuchnik <michaelkuchnik@gmail.com>" | ||
|
||
RUN mkdir $HOME/code | ||
WORKDIR $HOME/code | ||
COPY requirements.txt $HOME/code/requirements.txt | ||
RUN pip3 install -r requirements.txt | ||
RUN apt-get update && apt-get install -y \ | ||
libsm6 \ | ||
libxext6 \ | ||
octave \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM tensorflow/tensorflow:1.12.0-gpu-py3 | ||
|
||
LABEL maintainer="Michael Kuchnik <michaelkuchnik@gmail.com>" | ||
|
||
RUN mkdir $HOME/code | ||
WORKDIR $HOME/code | ||
COPY requirements-gpu.txt $HOME/code/requirements-gpu.txt | ||
RUN pip3 install -r requirements-gpu.txt | ||
RUN apt-get update && apt-get install -y \ | ||
libsm6 \ | ||
libxext6 \ | ||
octave \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Michael Kuchnik and Virginia Smith | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import dataset_loaders | ||
import augmentations | ||
import experiments | ||
import experiments_util | ||
|
||
|
||
def main(): | ||
rounds = 5 | ||
n_aug_sample_points = [1, 10, 50, 100, 250, 500, 750, 1000] | ||
n_train = 1000 | ||
n_jobs = 1 | ||
cv = 1 | ||
use_GPU = True | ||
batch_size = 512 | ||
CNN_extractor_max_iter = 40 | ||
use_loss = False | ||
|
||
# Can use multiple valus of C for cross-validation | ||
# logistic_reg__Cs = [[10], [100], [1000], [1e6]] | ||
logistic_reg__Cs = [[10]] | ||
classes_datasets = [ | ||
((3, 8), dataset_loaders.Dataset.MNIST), | ||
# ((0, 1), dataset_loaders.Dataset.CIFAR10), | ||
] | ||
selected_augmentations = [ | ||
(augmentations.Image_Transformation.translate, {"mag_aug": 2}), | ||
(augmentations.Image_Transformation.rotate, {"mag_aug": 30, | ||
"n_rotations": 15}), | ||
(augmentations.Image_Transformation.crop, | ||
{"mag_augs": [1, 2, 3, 4, 5, 6]}), | ||
] | ||
experiment_configs = [ | ||
("baseline", False, False), | ||
("random_proportional", False, False), | ||
("random_proportional", False, True), | ||
("random_proportional", True, False), | ||
("random_proportional", True, True), | ||
("random_inverse_proportional", False, False), | ||
# ("random_inverse_proportional", True, False), | ||
# ("random_softmax_proportional", False, False), | ||
# ("random_softmax_proportional", False, True), | ||
# ("random_softmax_proportional", True, False), | ||
# ("random_softmax_proportional", True, True), | ||
# ("random_inverse_softmax_proportional", False, False), | ||
# ("random_inverse_softmax_proportional", True, False), | ||
("deterministic_proportional", False, False), | ||
("deterministic_proportional", False, True), | ||
("deterministic_proportional", True, False), | ||
("deterministic_proportional", True, True), | ||
("deterministic_inverse_proportional", False, False), | ||
("deterministic_inverse_proportional", True, False), | ||
] | ||
for logistic_reg__C in logistic_reg__Cs: | ||
for classes, dataset in classes_datasets: | ||
for aug_transformation, aug_kw_args in selected_augmentations: | ||
dataset_class_str = experiments_util.classes_to_class_str( | ||
classes | ||
) | ||
print("Class types: {}".format(dataset_class_str)) | ||
reg_str = "-".join(list(map(str, logistic_reg__C))) | ||
results_filename = "aug_results_{}_{}_{}_{}{}".format( | ||
dataset.name, | ||
dataset_class_str, | ||
aug_transformation.name, | ||
reg_str, | ||
"_loss" if use_loss else "", | ||
) | ||
|
||
experiments.run_test( | ||
classes, | ||
rounds, | ||
n_aug_sample_points, | ||
n_train, | ||
n_jobs, | ||
cv, | ||
use_GPU, | ||
batch_size, | ||
dataset, | ||
aug_transformation, | ||
aug_kw_args, | ||
logistic_reg__C, | ||
CNN_extractor_max_iter, | ||
use_loss, | ||
experiment_configs, | ||
results_filename, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import augmentations | ||
import dataset_loaders | ||
import experiments_util | ||
|
||
from pretrained_experiments import run_test | ||
|
||
|
||
def main(): | ||
rounds = 5 | ||
n_aug_sample_points = [1, 10, 50, 100, 250, 500, 750, 1000] | ||
n_train = 1000 | ||
n_jobs = 1 | ||
cv = 1 | ||
use_GPU = True | ||
batch_size = 128 | ||
CNN_extractor_max_iter = 40 | ||
use_loss = False | ||
|
||
# Can use multiple valus of C for cross-validation | ||
logistic_reg__Cs = [[10]] | ||
classes_datasets = [ | ||
((0, 1), dataset_loaders.Dataset.CIFAR10), | ||
] | ||
selected_augmentations = [ | ||
(augmentations.Image_Transformation.translate, {"mag_aug": 3}), | ||
(augmentations.Image_Transformation.rotate, {"mag_aug": 5, | ||
"n_rotations": 4}), | ||
(augmentations.Image_Transformation.crop, {"mag_augs": [2]}), | ||
] | ||
experiment_configs = [ | ||
("baseline", False, False), | ||
("random_proportional", False, False), | ||
("random_proportional", False, True), | ||
("random_proportional", True, False), | ||
("random_proportional", True, True), | ||
("random_inverse_proportional", False, False), | ||
# ("random_inverse_proportional", True, False), | ||
# ("random_softmax_proportional", False, False), | ||
# ("random_softmax_proportional", False, True), | ||
# ("random_softmax_proportional", True, False), | ||
# ("random_softmax_proportional", True, True), | ||
# ("random_inverse_softmax_proportional", False, False), | ||
# ("random_inverse_softmax_proportional", True, False), | ||
("deterministic_proportional", False, False), | ||
("deterministic_proportional", False, True), | ||
("deterministic_proportional", True, False), | ||
("deterministic_proportional", True, True), | ||
("deterministic_inverse_proportional", False, False), | ||
("deterministic_inverse_proportional", True, False), | ||
] | ||
for logistic_reg__C in logistic_reg__Cs: | ||
for classes, dataset in classes_datasets: | ||
for aug_transformation, aug_kw_args in selected_augmentations: | ||
dataset_class_str = experiments_util.classes_to_class_str( | ||
classes | ||
) | ||
print("Class types: {}".format(dataset_class_str)) | ||
reg_str = "-".join(list(map(str, logistic_reg__C))) | ||
results_filename = "aug_results_{}_{}_{}_{}{}".format( | ||
dataset.name, | ||
dataset_class_str, | ||
aug_transformation.name, | ||
reg_str, | ||
"_loss" if use_loss else "", | ||
) | ||
if dataset == dataset_loaders.Dataset.CIFAR10: | ||
model_filename = "models/cifar10_ResNet56v2_model.h5" | ||
elif dataset == dataset_loaders.Dataset.NORB: | ||
if (aug_transformation == | ||
augmentations.Image_Transformation.translate): | ||
model_filename = "models/norb_small_ResNet56v2_model_translate.h5" | ||
else: | ||
model_filename = \ | ||
"models/norb_small_ResNet56v2_model_rotate_crop.h5" | ||
else: | ||
raise RuntimeError("Unknown model for configuration") | ||
|
||
run_test(classes, | ||
rounds, | ||
n_aug_sample_points, | ||
n_train, | ||
n_jobs, | ||
cv, | ||
use_GPU, | ||
batch_size, | ||
dataset, | ||
aug_transformation, | ||
aug_kw_args, | ||
logistic_reg__C, | ||
CNN_extractor_max_iter, | ||
use_loss, | ||
experiment_configs, | ||
results_filename, | ||
model_filename, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.