def train_classifier(classifier, dataset_dir, output_file, n_jobs=1, **kwargs):
    """
    Train a model using the passed classifier from the given dataset and save it to a file.
    
    :param classifier: Classifier used to create a model
    :param dataset_dir: Path of the dataset directory containing the samples
    :param output_file: Output file of the model 
    """
    print('Loading the data...', end='')
    classifier.load()
    print('LOADED!')
    print('Training the model...')
    score = classifier.train_model()
    print('FINAL SCORE:', score)
    print('Saving the model to the output file:', output_file)
    classifier.save_model(output_file)
    print('DONE')
    classifier.plot_confusion_matrix()
