def plot_crosscat_chain_diagnostics(self, argin): """plot crosscat diagnostic for all models of generator <diagnostic> <generator> [output_filename] Valid (crosscat) diagnostics are: - logscore: log score of the model - num_views: the number of views in the model - column_crp_alpha: CRP alpha over columns Example: bayeslite> .chainplot logscore dha_cc scoreplot.png """ parser = ArgumentParser(prog='.chainplot') parser.add_argument('diagnostic', type=str, help='Diagnostic name') parser.add_argument('generator', type=str, help='Generator name.') parser.add_argument('-f', '--filename', type=str, default=None, help='output filename') try: args = parser.parse_args(shlex.split(argin)) except ArgparseError as e: self.stdout.write('%s' % (e.message, )) return figure = bdbcontrib.plot_crosscat_chain_diagnostics( self._bdb, args.diagnostic, args.generator) if args.filename is None: plt.show() else: figure.savefig(args.filename) plt.close('all')
def plot_crosscat_chain_diagnostics(self, argin): """plot crosscat diagnostic for all models of generator <diagnostic> <generator> [output_filename] Valid (crosscat) diagnostics are: - logscore: log score of the model - num_views: the number of views in the model - column_crp_alpha: CRP alpha over columns Example: bayeslite> .chainplot logscore dha_cc scoreplot.png """ parser = ArgumentParser(prog='.chainplot') parser.add_argument('diagnostic', type=str, help='Diagnostic name') parser.add_argument('generator', type=str, help='Generator name.') parser.add_argument('-f', '--filename', type=str, default=None, help='output filename') try: args = parser.parse_args(shlex.split(argin)) except ArgparseError as e: self.stdout.write('%s' % (e.message,)) return figure = bdbcontrib.plot_crosscat_chain_diagnostics(self._bdb, args.diagnostic, args.generator) if args.filename is None: plt.show() else: figure.savefig(args.filename) plt.close('all')
def final_report(): # create a diagnostics plot plot_file_name = out_file_name('satellites', '-logscores.pdf') log('writing diagnostic plot to %s' % plot_file_name) _fig = bdbcontrib.plot_crosscat_chain_diagnostics(bdb, 'logscore', 'satellites_cc') plt.savefig(plot_file_name) final_metadata_file = out_file_name('satellites', '-meta.txt') report(bdb_file, final_metadata_file, echo=True, plot_file_name=plot_file_name)