def main(args): args = get_arguments() if args.command == "report": get_report(args) elif args.command == "buy": buy_product(args) elif args.command == "sell": sell_product(args)
_input_fn = lambda: input_fn( data_dir, batch_size, is_training=True, params=params) model.train(input_fn=_input_fn, steps=train_steps) print("Training complete") # evaluate if 'eval' in args.mode: print("\nEvaluating...") _eval_input_fn = lambda: input_fn( data_dir, batch_size, is_training=False, params=params) eval_result = model.evaluate(input_fn=_eval_input_fn) print("global step:%7d" % eval_result['global_step']) print("accuracy: %7.2f" % round(eval_result['accuracy'] * 100.0, 2)) print("loss: %7.2f" % round(eval_result['loss'], 2)) print("Evaluation complete") if 'compile_only' in args.mode or 'validate_only' in args.mode: print("\CS-1 preprocessing...") validate_only = 'validate_only' in args.mode _eval_input_fn = lambda: input_fn( data_dir, batch_size, is_training=False, params=params) model.compile(input_fn=_eval_input_fn) print("\CS-1 preprocessing complete") ##______________________________________________________________________________ if __name__ == '__main__': arguments = get_arguments() main(arguments)
if d_analysis_option == 's': plt.savefig('Images/' + file_path[-5] + str(nr_crt) + '_plot.png') nr_crt += 1 if d_analysis_option == 'd': plt.show() if d_analysis_option == 'sd': plt.savefig('Images/' + file_path[-5] + str(nr_crt) + '_plot.png') nr_crt += 1 plt.show() ####################################################################################################################### # actual code ####################################################################################################################### # define the class objects data_analysis = DataAnalysisModule.DataAnalysisClass() nr_ind_start, nr_generations, genes, environment, \ nat_selection, d_analysis, d_analysis_option, file_path = get_arguments() ####################################################################################################################### # run the natural selection algorithm from the function below if nat_selection: natural_selection_algorithm(nr_ind_start, nr_generations, environment, file_path) ####################################################################################################################### if d_analysis: visual_analysis_df(file_path, d_analysis_option)
data_frame['TotalSF'] = data_frame['GrLivArea'] + data_frame['TotalBsmtSF'] data_frame['TotalPorchSF'] = data_frame['OpenPorchSF'] + data_frame['EnclosedPorch'] + \ data_frame['3SsnPorch'] + data_frame['ScreenPorch'] data_frame['TotalBath'] = data_frame['FullBath'] + data_frame['BsmtFullBath'] + \ 0.5 * (data_frame['BsmtHalfBath'] + data_frame['HalfBath']) return data_frame automatic = True display_plot = False save_plots = False machine_learning = False input_file = '' if __name__ == '__main__': automatic, display_plot, save_plots, machine_learning, input_file = get_arguments( automatic, display_plot, save_plots, machine_learning, input_file) # counter represents the number of the figure in the /Images folder counter = 1 train_df = pd.read_csv(input_file) aux_df = train_df # save the data frame for later use ######################################################################################## ######################################################################################## # General information and data analysis print('#' * 100) print('#' * 100) data_analysis_module = DataAnalysisModule.DataAnalysisClass() plt = data_analysis_module.general_information_plotting(train_df, 'SalePrice')