Output¶
-
class
lascar.output.output_method.
MultipleOutputMethod
(*output_methods)[source]¶ Bases:
lascar.output.output_method.OutputMethod
MultipleOutputMethod is the OutputMethod used when the user want to register multiple OutputMethods.
-
class
lascar.output.output_method.
OutputMethod
(*engines)[source]¶ Bases:
object
OutputMethod is an virtual class. Its role is to set up the strategy for outputing results computed by engines.
The Session registers an OutputMethod. The OuputMethod tracks engines, and, at each output_step, it request results to them.
The children inherating from OutputManager implements how to process these results, and how to deliver them to the user.
-
class
lascar.output.console_output_method.
ConsoleOutputMethod
(*engines, filename=None, max_guesses=3)[source]¶ Bases:
lascar.output.output_method.OutputMethod
ConsoleOuptputMethod is an OutputMethod that will display on the terminal the parsed results from its tracked engines (for each output_step).
For more info about parsing results, see lascar/ouput/parse_results
If a filename is specified, the finalize() method will output all its parsed results inside a txt file.
-
class
lascar.output.hdf5_output_method.
Hdf5OutputMethod
(filename, *engines, prefix='')[source]¶ Bases:
lascar.output.output_method.OutputMethod
Hdf5OutputMethod is an OutputMethod that will store inside a hdf5 file the results from its tracked engines (for each output_step).
For each engine tracked, a hdf5 group is added to the file For each output_step, a hdf5 dataset is added inside the group corresponding to each engine.
A prefix can be specified if you want to store several Hdf5OutputMethod inside the same hdf5 file.
in the end:
hdf5_output_method[prefix + engine_name/output_step] contains engine.results after output_step traces processed.
-
class
lascar.output.pickle_output_method.
DictOutputMethod
(*engines, filename=None)[source]¶ Bases:
lascar.output.output_method.OutputMethod
DictOutputMethod is an OutputMethod that will store inside a dict the results from its tracked engines (for each output_step).
For each engine tracked, a key is added to the PickleOuputMethod, containing a sub-dict. For each output_step, a key is added inside the sub-dict corresponding to each engine.
in the end:
pickle_output_method[engine_name][output_step] contains engine.results after output_step traces processed.
If a filename is specified, the finalize() method will store the dict inside a file using pickle.
-
class
lascar.output.plot_output_method.
FullRankProgressionOutputMethod
(*engines, number_of_columns=None, number_of_rows=None, single_plot=False, display=True, filename=None, legend=False, bin_width=0.01)[source]¶ Bases:
lascar.output.plot_output_method.ScoreProgressionOutputMethod
FullRankProgressionOutputMethod is an OutputMethod that will plot the progression of the estimated total rank for GroupedEngines containing engines. It will actually plot 3 lines. One for the estimated rank, together with an upper and a lower bound. Right now argmax mode is assumed for all the subengines.
-
class
lascar.output.plot_output_method.
MatPlotLibOutputMethod
(*engines, number_of_columns=None, number_of_rows=None, single_plot=False, display=True, filename=None, legend=False, solution_only=False)[source]¶ Bases:
lascar.output.output_method.OutputMethod
MatPlotLibOutputMethod is an OutputMethod that will plot the results from its tracked engines (at each output_step).
If a filename is specified, the finalize() method will output all its parsed results inside a txt file.
-
class
lascar.output.plot_output_method.
RankProgressionOutputMethod
(*engines, number_of_columns=None, number_of_rows=None, single_plot=False, display=True, filename=None, legend=False, filters=None, solution_only=False)[source]¶ Bases:
lascar.output.plot_output_method.ScoreProgressionOutputMethod
RankProgressionOutputMethod is an OutputMethod that will plot the progression of the ranks for one (or several) GuessEngine, along all output_steps.
Quite close from MatplotlibOutputMethod, for the constructor arguments, RankOuputMethod will display a figure at the finalize() step instead of at all output_steps
For more info about parsing results, see lascar/ouput/parse_results
-
class
lascar.output.plot_output_method.
ScoreProgressionOutputMethod
(*engines, number_of_columns=None, number_of_rows=None, single_plot=False, display=True, filename=None, legend=False, filters=None, solution_only=False)[source]¶ Bases:
lascar.output.plot_output_method.MatPlotLibOutputMethod
ScoreProgressionOutputMethod is an OutputMethod that will plot the progression of the results for one (or several) GuessEngine, along all output_steps.
Quite close from MatplotlibOutputMethod, for the constructor arguments, ProgressionOuputMethod will display a figure at the finalize() step instead of at all output_steps
For more info about parsing results, see lascar/ouput/parse_results
parse_results.py
Implement function used by OutputMethod to interpret engines results.
-
lascar.output.parse_results.
apply_parse
(engine, results)[source]¶ Depending on the engine attribute ‘output_parser_mode’, apply_parse points toward the correct parse_output to apply on the engine results. And returns the parsed results. :param engine: the engine whose results need to be parsed :param results: the results to be parsed :return: the parsed results
-
lascar.output.parse_results.
parse_output_argmax
(results, guesses)[source]¶ parse_output_max is the ouput_parser used on GuessEngines for which you want to maximize the the absolute value of results. (eg in Cpa, you want to extract the guess for which the result is the highest, in absolute value)
For each guess, it outputs: (i,j,k) where: - i is the guess value - j is the max of the absolute value of result for guess i - k is the rank of the guess i among all guesses
Parameters: - results – the engine results to be parsed
- guesses – the engines guesses
Returns: the parsed results
-
lascar.output.parse_results.
parse_output_basic
(results)[source]¶ parse_output_basic is the default output_parser. It takes as an input the results returned by an engine, and returns, for each row, basic statistic: [min, max, mean, var] :param results: the engine results to be parsed :return: the parsed results
-
lascar.output.parse_results.
parse_output_max
(results, guesses)[source]¶ parse_output_max is the ouput_parser used on GuessEngines for which you want to maximize the results. (eg in Dpa, you want to extract the guess for which the result is the highest)
For each guess, it outputs: (i,j,k) where: - i is the guess value - j is the max of the result for guess i - k is the rank of the guess i among all guesses
Parameters: - results – the engine results to be parsed
- guesses – the engines guesses
Returns: the parsed results
-
class
lascar.output.table_output_method.
TableOutputMethod
(*engines, filename=None, max_guesses=10)[source]¶ Bases:
lascar.output.output_method.OutputMethod
TableOutputMethod is an OutputMethod that will display a table of the ranked results