def _print_models_overview(self): print(f"\nIgel's supported models overview: \n") reg_algs = list(models_dict.get('regression').keys()) clf_algs = list(models_dict.get('classification').keys()) cluster_algs = list(models_dict.get('clustering').keys()) df_algs = pd.DataFrame.from_dict({ "regression": reg_algs, "classification": clf_algs, "clustering": cluster_algs }, orient="index").transpose().fillna('----') df = self._tableize(df_algs) print(df)
def _show_model_infos(self, model_name: str, model_type: str): if not model_name: print(f"Please enter a supported model") self._print_models_overview() else: if not model_type: print( f"Please enter a type argument to get help on the chosen model\n" f"type can be whether regression, classification or clustering \n" ) self._print_models_overview() return if model_type not in ("regression", "classification", "clustering"): raise Exception( f"{model_type} is not supported! \n" f"model_type need to be regression, classification or clustering" ) models = models_dict.get(model_type) model_data = models.get(model_name) model, link, *cv_class = model_data.values() print( f"model type: {model_type} \n" f"model name: {model_name} \n" f"sklearn model class: {model.__name__} \n" f"{'-' * 60}\n" f"You can click the link below to know more about the optional arguments\n" f"that you can use with your chosen model ({model_name}).\n" f"You can provide these optional arguments in the yaml file if you want to use them.\n" f"link:\n{link} \n")
def models(self): """ show an overview of all models supported by igel """ if not self.dict_args or len(self.dict_args.keys()) <= 1: self._print_models_overview() else: model_name = self.dict_args.get('model_name', None) model_type = self.dict_args.get('model_type', None) if not model_name: print(f"Please enter a supported model") self._print_models_overview() else: if not model_type: print( f"Please enter a type argument to get help on the chosen model\n" f"type can be whether regression, classification or clustering \n" ) self._print_models_overview() return if model_type not in ('regression', 'classification', 'clustering'): raise Exception( f"{model_type} is not supported! \n" f"model_type need to be regression, classification or clustering" ) models = models_dict.get(model_type) model_data = models.get(model_name) model, link, *cv_class = model_data.values() print( f"model type: {model_type} \n" f"model name: {model_name} \n" f"sklearn model class: {model.__name__} \n" f"{'-' * 60}\n" f"You can click the link below to know more about the optional arguments\n" f"that you can use with your chosen model ({model_name}).\n" f"You can provide these optional arguments in the yaml file if you want to use them.\n" f"link:\n{Fore.GREEN}{link}{Fore.WHITE} \n")