def _tune_IterativeRegression_SetThreshold(self, e=None, filename=None, n=None, indexes_are_important=None, support_access=None, threshold=None):
        actual_std = threshold

        getPropertiesFile()['BrightnessControlTuner']['tune.mode'] = "IterativeRegression"
        getPropertiesFile()['BrightnessControlTuner']['tune.debug'] = False
        getPropertiesFile()['BrightnessControlTuner']['tune.regression.debug'] = False
        getPropertiesFile()['BrightnessControlTuner']['tune.regression.threshold'] = actual_std
        getPropertiesFile()['BrightnessControlTuner']['tune.regression.max_improvement_attempts_on_best_score'] = 8

        from time_utils.timer import MyTimer
        with MyTimer():
            actual_tuned = self._get_actual(m=3, e=e, filename=filename, n=n,
                                            indexes_are_important=indexes_are_important, support_access=support_access)
        if _Config.DEBUG:
            sys.stderr.write(str(actual_tuned)+" ... "+str(threshold)+" ... ")
        return actual_std, actual_tuned
Example #2
0
 def set_config_data(self):
     d = getPropertiesFile()
     o, a = get_parsed_commandline_options()
     data = {
         self._CONFIG_PROPERTIES:
         json.dumps(d, separators=(',', ':')),
         # Options from optparse returns an Object, so get its dict. @todo this is hack, move to non deprecated argparse, and handle object->json correctly.
         self._CONFIG_OPTIONS:
         json.dumps(o, separators=(',', ':'), default=lambda o: o.__dict__),
         self._CONFIG_ARGUMENTS:
         json.dumps(a, separators=(',', ':')),
     }
     return self.set_series(data)
    def properties(self, output_path_prefix, input_filename, number_of_leds,
                   indexes_are_important_HCD, use_support_access, edge_qty):
        getPropertiesFile(
        )['LightIndexPositions']['results_file.csvfilename'] = input_filename
        getPropertiesFile()['LightIndexPositions'][
            'results_file.results_output_file_path_prefix'] = output_path_prefix
        getPropertiesFile(
        )['LightIndexPositions']['results_file.column_number'] = 3
        getPropertiesFile()['LightIndexPositions'][
            'results_file.number_of_leds'] = number_of_leds

        getPropertiesFile(
        )['FrameModel']['frame.withsupportaccess'] = use_support_access
        getPropertiesFile()['FrameModel'][
            'frame.indexes_are_important'] = indexes_are_important_HCD
        getPropertiesFile(
        )['FrameModel']['frame.number_of_vertices_per_edge'] = edge_qty
        getPropertiesFile(
        )['FrameModel']['frame.support_access_vertices_to_remove'] = 1

        getPropertiesFile()['LightOutput'][
            'light.output_intensity_from_index.enforce_default'] = True
        getPropertiesFile()['LightOutput'][
            'light.output_intensity_from_index.default_value'] = 1.0
    def _tune_SciPyBasinHopping(self, e=None, filename=None, n=None, indexes_are_important=None, support_access=None):
        actual_std = self._get_actual(m=2, e=e, filename=filename, n=n, indexes_are_important=indexes_are_important, support_access=support_access)
        getPropertiesFile()['BrightnessControlTuner']['tune.mode'] = "L-BFGS-B"

        getPropertiesFile()['BrightnessControlTuner']['tune.debug'] = False
        getPropertiesFile()['BrightnessControlTuner']['tune.scipy.basinhopping.niter'] = 0
        getPropertiesFile()['BrightnessControlTuner']['tune.scipy.basinhopping.niter_success'] = 1
        getPropertiesFile()['BrightnessControlTuner']['tune.scipy.basinhopping.lower_bounds'] = 0.5
        getPropertiesFile()['BrightnessControlTuner']['tune.scipy.basinhopping.upper_bounds'] = 1.5
        getPropertiesFile()['BrightnessControlTuner']['tune.scipy.basinhopping.t'] = 0.5
        getPropertiesFile()['BrightnessControlTuner']['tune.scipy.basinhopping.disp'] = False

        from time_utils.timer import MyTimer
        with MyTimer():
            actual_tuned = self._get_actual(m=3, e=e, filename=filename, n=n, indexes_are_important=indexes_are_important, support_access=support_access)

        if _Config.DEBUG:
            sys.stderr.write(str(actual_tuned)+" ... "+str(threshold)+" ... ")
        return actual_std, actual_tuned