Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ipd_extended/util.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45 lines (37 sloc)
1.47 KB
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
import constants as cst | |
import re | |
import datetime | |
def get_file_name(file): | |
return re.match(cst.FILE_NAME_PATTERN, file).group(1) | |
def now(): | |
return datetime.datetime.now().strftime("%Y%m%d_%H%M%S") | |
def get_escaped_name(problem): | |
return problem.replace("-", "_").replace(".", "") | |
def parse_relevant_features(data_file_name): | |
search = re.search('\D+_(\d+)_', data_file_name) | |
if not search: | |
raise ValueError("wrong file format!") | |
dims_count = int(search.group(1)) | |
return dims_count | |
def collect_params(f): | |
params = [] | |
# relevant features 2 - 30 | |
# for rf in range(cst.RELEVANT_FEATURES_LOWER_BOUND, cst.RELEVANT_FEATURES_UPPER_BOUND): | |
for rf in cst.RELEVANT_FEATURES_RANGE_LIST: | |
# cubes 1 - 10 | |
# for c in range(cst.CUBES_LOWER_BOUND, cst.CUBES_UPPER_BOUND): | |
for c in cst.INTERACTION_NUMBER_RANGE_LIST: | |
# cube types complete, incomplete, incomplete overlapping | |
for t in cst.INTERACTION_TYPES_RANGE_LIST: | |
if (c == 1 or rf / c < 2) and t != 'c': | |
continue | |
dataset_name = 'cubes_' + '{0:02d}'.format(rf) + '_' \ | |
+ '{0:02d}'.format(c) + '_' \ | |
+ t | |
param = f(dataset_name, rf, c, t) | |
print('collected param:', param) | |
if type(param) == list: | |
params.extend(param) | |
else: | |
params.append(param) | |
return params |