def fit_tensorflow(strategy_dictionary, data_to_predict, fitting_inputs,
                   fitting_targets):
    toc = tic()

    train_indices, test_indices, validation_indices = train_test_validation_indices(
        fitting_inputs, strategy_dictionary['train_test_validation_ratios'])

    if strategy_dictionary['sequence_flag']:
        fitting_dictionary, error = tensorflow_sequence_fitting(
            '/tmp/test', train_indices, test_indices, validation_indices,
            fitting_inputs, fitting_targets, strategy_dictionary)

    else:
        fitting_dictionary, error = tensorflow_fitting(train_indices,
                                                       test_indices,
                                                       validation_indices,
                                                       fitting_inputs,
                                                       fitting_targets)

    fitting_dictionary['train_indices'] = train_indices
    fitting_dictionary['test_indices'] = test_indices
    fitting_dictionary['validation_indices'] = validation_indices

    fitting_dictionary = post_process_training_results(strategy_dictionary,
                                                       fitting_dictionary,
                                                       data_to_predict)

    profit_factor = output_strategy_results(strategy_dictionary,
                                            fitting_dictionary,
                                            data_to_predict, toc)
    return fitting_dictionary, error, profit_factor
def fit_tensorflow(strategy_dictionary):
    toc = tic()

    data_to_predict, data_2 = import_data(strategy_dictionary)

    fitting_inputs, fitting_targets = input_processing(data_to_predict, data_2,
                                                       strategy_dictionary)
    train_indices, test_indices = train_test_indices(
        fitting_inputs, strategy_dictionary['train_test_ratio'])

    if strategy_dictionary['sequence_flag']:
        fitting_dictionary, error = tensorflow_sequence_fitting(
            '/home/thomas/test', train_indices, test_indices, fitting_inputs,
            fitting_targets, strategy_dictionary)

    else:
        fitting_dictionary, error = tensorflow_fitting(train_indices,
                                                       test_indices,
                                                       fitting_inputs,
                                                       fitting_targets)

    fitting_dictionary['train_indices'] = train_indices
    fitting_dictionary['test_indices'] = test_indices

    fitting_dictionary = post_process_training_results(strategy_dictionary,
                                                       fitting_dictionary,
                                                       data_to_predict)

    profit_factor = output_strategy_results(strategy_dictionary,
                                            fitting_dictionary,
                                            data_to_predict, toc)
    return fitting_dictionary, data_to_predict, error, profit_factor