
from pathlib import Path
import os
from subprocess import run
import FK2018
import sys

learning_rates = [0.01, 0.001, 0.0001]
learning_momentums = [0.5, 0.7, 0.9]
steps_per_epochs = [10,25]
batch_sizes = [1]


base_dir = Path('/home/jenny/Documents/FK2018/tunasand/05_dive')
data_path = '/home/jenny/Documents/FK2018/tunasand/05_dive/altitude_corrected/no_distortion/not_rescaled/'

for rate_i, learning_rate in enumerate(learning_rates):
	for momentum_i, learning_momentum in enumerate(learning_momentums):
		for steps_per_epoch in steps_per_epochs:
			for batch_size in batch_sizes:
				log_dir = '-'.join([str(rate_i), str(momentum_i), str(steps_per_epoch), str(batch_size)])
				print(log_dir)
				if not os.path.exists(f"./logs/{log_dir}"):
					os.makedirs(f"./logs/{log_dir}/")
					sys.stdout = open(f"./logs/{log_dir}/out.txt", 'w')
					FK2018.train_nnet(
						dataset=data_path,
						log_file=log_dir,
						learning_rate=learning_rate,
						learning_momentum=learning_momentum,
						steps_per_epoch=steps_per_epoch,
						batch_size=batch_size
					)


from pathlib import Path
import os
from subprocess import run
import FK2018
import sys

learning_rates = [0.01, 0.001, 0.0001]
learning_momentums = [0.5, 0.7, 0.9]
steps_per_epochs = [10,25]
batch_sizes = [1]


base_dir = Path('/home/jenny/Documents/FK2018/tunasand/05_dive')
data_path = '/home/jenny/Documents/FK2018/tunasand/05_dive/altitude_corrected/no_distortion/not_rescaled/'

for rate_i, learning_rate in enumerate(learning_rates):
	for momentum_i, learning_momentum in enumerate(learning_momentums):
		for steps_per_epoch in steps_per_epochs:
			for batch_size in batch_sizes:
				log_dir = '-'.join([str(rate_i), str(momentum_i), str(steps_per_epoch), str(batch_size)])
				print(log_dir)
				if not os.path.exists(f"./logs/{log_dir}"):
					os.makedirs(f"./logs/{log_dir}/")
					sys.stdout = open(f"./logs/{log_dir}/out.txt", 'w')
					FK2018.train_nnet(
						dataset=data_path,
						log_file=log_dir,
						learning_rate=learning_rate,
						learning_momentum=learning_momentum,
						steps_per_epoch=steps_per_epoch,
						batch_size=batch_size
					)
