Created
April 13, 2023 09:23
-
-
Save sofianehaddad/0011686ed5eb917f1201383ee5069cbf to your computer and use it in GitHub Desktop.
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
# This function parses the logs of the FCE class | |
def parse_fce_logs(filename): | |
f = open(filename, "r") | |
path_indices = list() | |
relative_cross_validation_error = list() | |
q_squares = list() | |
for line in f: | |
tokens = line.split(" ") | |
if len(tokens) > 0: | |
sub_tokens = tokens[0].split("=") | |
if sub_tokens[0] == "subbasis": | |
validation_error = float(tokens[2].split("=")[1].split(",")[0]) | |
relative_cross_validation_error.append(validation_error) | |
q_squares.append(1.0 - validation_error) | |
# Available only if LARS(True) | |
if len(tokens) > 1: | |
sub_tokens = tokens[2].split("=") | |
if sub_tokens[0] == "predictor": | |
index = int(sub_tokens[1]) | |
path_indices.append(index) | |
f.close() | |
return path_indices, relative_cross_validation_error, q_squares |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment