Ejemplo n.º 1
0
 def read_file(self, file_path):
     try:
         f = open(file_path, 'r')
     except Exception as e:
         logging.debug('Error opening %s: %s' % (file_path, e))
         return
     load_save.load(f)
     f.close()
Ejemplo n.º 2
0
 def read_file(self, file_path):
     try:
         f = open(file_path, 'r')
     except Exception as e:
         logging.error('Could not open %s: %s' % (file_path, e))
         return
     load_save.load(f)
     f.close()
Ejemplo n.º 3
0
 def read_file(self, file_path):
     try:
         f = open(file_path, 'r')
     except Exception as e:
         logging.error("Couldn't open %s: %s" % (file_path, e))
         return
     load_save.load(f)
     f.close()
Ejemplo n.º 4
0
 def read_file(self, file_path):
     try:
         f = open(file_path, 'r')
     except Exception as e:
         logging.debug('Error opening %s: %s' % (file_path, e))
         return
     load_save.load(f)
     f.close()
Ejemplo n.º 5
0
def load():
    dir = ''
    dir = os.environ.get('SUGAR_ACTIVITY_ROOT')
    if dir == None: dir = ''
    fname = os.path.join(dir, 'data', 'sudoku.dat')
    try:
        f = open(fname, 'r')
    except:
        return None  #****
    load_save.load(f)
    f.close
Ejemplo n.º 6
0
def load():
    dir = ''
    dir = os.environ.get('SUGAR_ACTIVITY_ROOT')
    if dir is None:
        dir = ''
    fname = os.path.join(dir, 'data', 'Countries.dat')
    try:
        f = open(fname, 'r')
    except BaseException:
        return None  # ****
    try:
        load_save.load(f)
    except BaseException:
        pass
    f.close
Ejemplo n.º 7
0
def load():
    directory = ''
    directory = os.environ.get('SUGAR_ACTIVITY_ROOT')
    if directory is None:
        directory = ''
    fname = os.path.join(directory, 'data', 'follow.dat')
    try:
        f = open(fname, 'r')
    except Exception as e:
        logging.error('Could not open %s: %s' % (fname, e))
        return None
    try:
        load_save.load(f)
    except Exception as e:
        logging.error('load_save failed: %s' % (e))
    f.close
    def __init__(self, search_space, fixed_space, evaluator, input_file=None, output_file=None):
        """Instantiate the GaussianProcessSearch and create the GaussianProcessRegressor

        Args:
            search_space (list): List of skopt.space.Dimension objects (Integer, Real,
                or Categorical) whose name must match the correspondent variable name in the
                evaluator function
            fixed_space (dict): Dictionary of parameters that will be passed by default to the
                evaluator function. The keys must match the correspondent names in the function.
            evaluator (function): Function of which we want to estimate the maximum. It must take
                the union of search_space and fixed_space as parameters and return a scalar value.
            input_file (str): Path to the file containing points in the search space and
                corresponding values that are already known.
            output_file (str): Path to the file where updated results will be stored.
        """
        self.search_space = search_space
        self.fixed_space = fixed_space
        self.evaluator = evaluator
        self.input_file = input_file
        self.output_file = output_file
        self.x_values = []
        self.y_values = []
        self.solutions = []
        if input_file is not None:
            try:
                data_dict = load_save.load(data_file=input_file)
                self.x_values, self.y_values = self._extract_values(data_dict)
            except OSError as e:
                raise OSError('Cannot read input file. \n' + str(e))
Ejemplo n.º 9
0
def load():
    dir = ''
    dir = os.environ.get('SUGAR_ACTIVITY_ROOT')
    if dir is None:
        dir = ''
    fname = os.path.join(dir, 'data', 'spiro.dat')
    try:
        f = open(fname,  'r')
    except Exception as e:
        logging.error('Could not open %s: %s' % (fname, e))
        return None
    try:
        load_save.load(f)
    except Exception as e:
        logging.error('load_save failed: %s' % (e))
    f.close
Ejemplo n.º 10
0
Archivo: utils.py Proyecto: i5o/letters
def load():
    directory = ''
    directory = os.environ.get('SUGAR_ACTIVITY_ROOT')
    if directory is None:
        directory = ''
    fname = os.path.join(directory, 'data', 'Letters.dat')
    if os.path.exists(fname):
        try:
            f = open(fname, 'r')
        except Exception as e:
            logging.error('Could not open %s: %s' % (fname, e))
            return None
        try:
            load_save.load(f)
        except Exception as e:
            logging.error('load_save failed: %s' % (e))
        f.close
Ejemplo n.º 11
0
def load():
    dir = ''
    dir = os.environ.get('SUGAR_ACTIVITY_ROOT')
    if dir is None:
        dir = ''
    fname = os.path.join(dir, 'data', 'triples.dat')
    if os.path.exists(fname):
        try:
            f = open(fname, 'r')
        except Exception as e:
            logging.error('Could not open %s: %s' % (fname, e))
            return None
        try:
            load_save.load(f)
        except Exception as e:
            logging.error('load_save failed: %s' % (e))
        f.close