Пример #1
0
def run_train():
    print "Training machine learning"

    try:
        MachineLearning.train(MachineLearningBVA)
        MachineLearning.train(MachineLearningBOW)
    except IOError:
        return PERMISSION_DENIED
    except MachineLearningTrainError:
        return ERROR_INIT_TRAIN

    return SUCCESS
def train_machine_learning():
    try:
        print "Training machine learning"
        MachineLearning.train(MachineLearningBVA)
        MachineLearning.train(MachineLearningBOW)

        os.system("cp {} {}".format(
            MachineLearningData.PKGS_CLASSIFICATIONS, LOG_PATH))
    except xapian.DatabaseOpeningError:
        print "\n\nPlease check if you prepared the AppRecommender data"
        print "Try to run the following commands:"
        print "  $ cd .."
        print "  $ apprec --init\n"
        exit(1)
Пример #3
0
def run():
    load_options = LoadOptions()
    load_options.load()

    if call_initialize(load_options.options):
        print "Initializing AppRecommender"
        initialize = Initialize()
        initialize.prepare_data()
        return SUCCESS
    elif call_training(load_options.options):
        print "Training machine learning"
        MachineLearning.train(MachineLearningBVA)
        MachineLearning.train(MachineLearningBOW)
        return SUCCESS
    else:
        return run_apprecommender(load_options.options)
Пример #4
0
def run():
    load_options = LoadOptions()
    load_options.load()

    if call_initialize(load_options.options):
        print "Initializing AppRecommender"
        initialize = Initialize()
        initialize.prepare_data()
        return SUCCESS
    elif call_training(load_options.options):
        print "Training machine learning"
        MachineLearning.train(MachineLearningBVA)
        MachineLearning.train(MachineLearningBOW)
        return SUCCESS
    else:
        return run_apprecommender(load_options.options)
Пример #5
0
def run():
    load_options = LoadOptions()
    load_options.load()
    options = load_options.options

    if check_for_flag(options, '-i', '--init'):
        print "Initializing AppRecommender"
        initialize = Initialize()
        initialize.prepare_data()
        return SUCCESS
    elif check_for_flag(options, '-t', '--train'):
        print "Training machine learning"
        MachineLearning.train(MachineLearningBVA)
        MachineLearning.train(MachineLearningBOW)
        return SUCCESS
    elif check_for_flag(options, '-c', '--contribute'):
        collect_user_data.main()
    else:
        return run_apprecommender(load_options.options)
Пример #6
0
def main():
    logging.getLogger().disabled = True

    # print "Checking dependencies"
    # unistalled_dependencies = check_dependencies()
    # if len(unistalled_dependencies) > 0:
    #     print 'These packages need to be installed:', unistalled_dependencies
    #     return

    initial_prints()
    if not user_accept_collect_data():
        exit(1)

    create_log_folder()
    MachineLearning.train(MachineLearningBVA)
    MachineLearning.train(MachineLearningBOW)
    os.system("cp {} {}".format(
        MachineLearningData.PKGS_CLASSIFICATIONS, LOG_PATH))

    collect_data = Process(target=collect_user_data)
    cross_validation_mlbva = Process(
        target=ml_cross_validation, args=(LOG_PATH + '/', 'mlbva'))
    cross_validation_mlbow = Process(
        target=ml_cross_validation, args=(LOG_PATH + '/', 'mlbow'))
    collect_data.start()
    cross_validation_mlbva.start()
    cross_validation_mlbow.start()

    os.system('clear')
    print "Preparing recommendations..."
    collect_user_preferences()

    print "\n\nWaiting for data collection complete"
    collect_data.join()
    cross_validation_mlbva.join()
    cross_validation_mlbow.join()

    print "\n\nFinished: All files and recommendations were collected"
    print "Collect data folder: {0}".format(LOG_PATH)