Exemplo n.º 1
0
 def __init__(self, output_path: str):
     """Initialise the objects and constants.
     :param output_path:
     """
     self.__logger = logging.getLogger(CONSTANTS.app_name)
     self.__logger.debug(__name__)
     self.__output_path = output_path
     self.__readers_writers = ReadersWriters()
Exemplo n.º 2
0
 def __init__(self, variables_settings: PandasDataFrame, output_path: str,
              output_table: str):
     """Initialise the objects and constants.
     :param variables_settings:
     :param output_path: the output path.
     :param output_table: the output table name.
     """
     self.__logger = logging.getLogger(CONSTANTS.app_name)
     self.__logger.debug(__name__)
     self.__variables_settings = variables_settings
     self.__output_path = output_path
     self.__output_table = output_table
     self.__readers_writers = ReadersWriters()
     self.__FeatureParserThread = FeatureParserThread()
Exemplo n.º 3
0
 def __init__(self, model_features_table: str, input_path: str,
              output_path: str, input_features_configs: str,
              output_table: str):
     """Initialise the objects and constants.
     :param model_features_table: the feature table name.
     :param input_path: the input path.
     :param output_path: the output path.
     :param input_features_configs: the input features' configuration file.
     :param output_table: the output table name.
     """
     self.__logger = logging.getLogger(CONSTANTS.app_name)
     self.__logger.debug(__name__)
     self.__model_features_table = model_features_table
     self.__output_path = output_path
     self.__output_table = output_table
     self.__readers_writers = ReadersWriters()
     # initialise settings
     self.__variables_settings = self.__init_settings(
         input_path, input_features_configs)
     self.__features_dic_names = self.__init_features_names()
     self.__features_dic_dtypes = self.__init_features_dtypes()
     self.__init_output(output_path, output_table)
Exemplo n.º 4
0
    def __init__(self, method_name: str, path: str = None, title: str = None):
        """Initialise the objects and constants.
        :param method_name: the training method that will be used
        (options: {'lr': Logistic Regression, 'lr_cv': Logistic Regression with Cross-Validation,
        'mlm': Mixed Linear Model, 'rfc': Random Forest Classifier, 'gbc': Gradient Boosting Classifier,
        'dtc' Decision Tree Classifier, 'knc': K-Nearest Neighbors Classifier, 'nb': Multinomial Naive Bayes,
        'nn': Multi-Layer Perceptron (MLP) Neural Network}).
        :param path: the directory path of the saved trained model file, using this application (if applicable).
        :param title: the file name of the saved trained model file, using this application
        """
        self.__logger = logging.getLogger(CONSTANTS.app_name)
        self.__logger.debug(__name__)

        self.__readers_writers = ReadersWriters()
        self.__method = None
        self.method_name = method_name
        self.model_labels = None
        self.model_train = None
        self.model_predict = dict()
        self.model_cross_validate = None
        if method_name is not None:
            self.__init__method(method_name)
        else:
            self.load(path, title)
Exemplo n.º 5
0
    os.makedirs(io_path, exist_ok=True)

logger = Logger(path=io_path, app_name=app_name, ext="log")
logger = logging.getLogger(app_name)

# Initialise constants and some of classes

# In[ ]:

# Initialise constants
CONSTANTS.set(io_path, app_name)

# In[ ]:

# Initialise other classes
readers_writers = ReadersWriters()
preprocess = PreProcess(io_path)

# In[ ]:

# Set print settings
pd.set_option('display.width', 1600, 'display.max_colwidth', 800)
pp = pprint.PrettyPrinter(indent=4)

# ### 1.2.  Initialise Features Metadata

# Read the input features' confugration file & store the features metadata

# In[ ]:

# variables settings