def main(outSourcedLogger=None):
    if outSourcedLogger is None:
        logger = Log()
    else:
        logger = outSourcedLogger

    logger.printAndLog(const.MessageType.Summarize,
                       "Starting machine learning algorithms...")

    # Train the model

    classificationAnalyzer = ClassificationResultAnalyzer(logger)
    classification_model = ModelTrainer(
        logger, 3, lambda x: classifiers.classify_3classes(x, Threshold),
        "3_Classes_Training_with_threshold_5", MAX_LEN, epochs, batch_size,
        classificationAnalyzer, lambda d: dataFilters.default_dataFilter(d))
    classification_model.Train(f'{const.finalDatabaseFolder}{const.trainFile}')
    classification_model.Test(f'{const.finalDatabaseFolder}{const.testFile}')

    linearResultAnalyzer = LinearResultAnalyzer(logger)
    linear_model_date = ModelTrainer(
        logger, 1, lambda x: classifiers.default_classifier(x),
        f"Linear_Classification", MAX_LEN, epochs, batch_size,
        linearResultAnalyzer, lambda d: dataFilters.default_dataFilter(d))
    linear_model_date.Train(f'{const.finalDatabaseFolder}{const.trainFile}')
    linear_model_date.Test(f'{const.finalDatabaseFolder}{const.testFile}')

    logger.printAndLog(const.MessageType.Summarize,
                       "Learning stage finished...")
def main(outsourcedLogger=None):

    if outsourcedLogger is None:
        logger = Logger()
    else:
        logger = outsourcedLogger

    # Load configurations and initialize the program
    logger.printAndLog(const.MessageType.Summarize,
                       "Starting pre data processing...")
    preProcessor = Manager.PreProcessor(logger)

    # Get Database
    logger.printAndLog(const.MessageType.Header, "Loading Databases files...")
    preProcessor.openAndPrepareRawDatabase()

    # Build local database
    logger.printAndLog(const.MessageType.Header, "Building local Databases...")
    preProcessor.prepareLocalDatabase()

    # Importing Stocks Databases
    logger.printAndLog(const.MessageType.Header,
                       "Importing Stocks Databases and analyzing Stocks...")
    preProcessor.importStocksDatabasesForPosts()

    # Setting final train sets
    logger.printAndLog(const.MessageType.Header,
                       "Building final Databases for learning algorithms...")
    preProcessor.buildFinalDatabase()

    # Print and export failed stock imports
    logger.printAndLog(const.MessageType.Header, "Listing failed imports...")
    preProcessor.printAndExportFailedImports()

    # Done
    logger.printAndLog(const.MessageType.Summarize,
                       "Pre data processing finished...")