Пример #1
0
def compare_IRR():
    print "Loading model..."
    try:
        model = load_from_pickle("pickle/model.pkl")
    except OSError, IOError:
        print "Model not found. Initializing training process, this might take some time..."
        model = initialize_model()
Пример #2
0
def compare_IRR():
    print "Loading model..."
    try:
        model = load_from_pickle('pickle/model.pkl')
    except OSError, IOError:
        print "Model not found. Initializing training process, this might take some time..."
        model = initialize_model()
Пример #3
0
def run_process():
    '''
    Main process for app, invoked when administrator is at /refresh. Collects, 
    processes and stores data, as well as calculates expected IRR and other
    metrics for data table and charts.

    Returns:
    Loan details to populate data table at /index. numpy array.
    '''
    print "Requesting loan details..."
    loan_results, loan_details = request_loan_data()

    print "Inserting results of API request to database..."
    try:
        insert_into_mongodb(loan_results, loan_details)
    except Exception:
        print "MongoDB error, proceeding to next step..."

    print "Loading model..."
    try:
        model = load_from_pickle('pickle/model.pkl')
    except OSError, IOError:
        print "Model not found. Initializing training process, this might take some time..."
        model = initialize_model()