def check_model(self, X_train, X_val, y_train, y_val, X_test, y_test, raw_seq): """ Funtion used to navigate to the specific model. The is defined when initialising the class. Reads the self.model_type Each statement does the following: - Calls function to format data for the model - Calls funtion to train the model - Calls funtion to plot the MSE graph - Calls funtion to test the model - Returns the accuarcy as R2 score""" if self.model_type == 'CNN': X_train, X_val, y_train, n_input, n_output, ytrain1, ytrain2, ytrain3, ytrain4 = CNN.data_format( X_train, X_val, y_train) history = CNN.CNN_train_model(self, X_train, X_val, y_train, y_val, self.verbose, n_input, n_output, ytrain1, ytrain2, ytrain3, ytrain4) Models.plotting(history) yhat = CNN.CNN_test_model(self, X_test, self.verbose, y_test) Models.accuracy(self, yhat, y_test, X_test, self.model_type) if self.model_type == 'MLP': X_train, X_val, y_train, n_input, n_output, ytrain1, ytrain2, ytrain3, ytrain4 = MLP.data_format( X_train, X_val, y_train) history = MLP.MLP_train_model(self, X_train, X_val, y_train, y_val, self.verbose, n_input, n_output, ytrain1, ytrain2, ytrain3, ytrain4) # Models.plotting(history) yhat, final_cols = MLP.MLP_test_model(X_test, self.verbose, y_test) Models.accuracy(self, yhat, y_test, final_cols, self.model_type) if self.model_type == 'KNN': X_train, X_val, y_train, X_test = KNN.data_format( X_train, X_val, y_train, X_test) yhat, final_cols = KNN.KNN_train_model(self, X_train, X_val, y_train, y_val, X_test, y_test, raw_seq) Models.accuracy(self, yhat, y_test, final_cols, self.model_type) if self.model_type == 'LSTM': history, model = LSTMs.LSTM_train_model(self, X_train, X_val, y_train, y_val, self.verbose) Models.plotting(history) yhat = LSTMs.LSTM_test_model(X_test, model, self.verbose, y_test) Models.accuracy(self, yhat, y_test, X_test, self.model_type) if self.model_type == 'BASELINE': n_input, X_train, n_output = BaseLine.data_format(X_train, y_train) model = BaseLine.baseline_train(self, X_train, y_train, n_input, n_output) yhat, final_cols = BaseLine.baseline_test(X_test, n_input, model) Models.accuracy(self, yhat, y_test, final_cols, self.model_type)