def Trainig(): if (os.path.exists("PreProcessing Data/TrainingDataSet.csv")): data = pd.read_csv("PreProcessing Data/TrainingDataSet.csv") print("Training DataSet Already Existing") Y = data['Rate'] # Label X = data.drop(columns=["Rate"], inplace=False) else: print("Starting Training Data PreProcessing") pre_processing = Data_Preprocessing.Pre_Processing() X, Y = pre_processing.PreProcessing_Trainig() highX = X[Y == 2] highY = Y[Y == 2] intermediateX = X[Y == 1] intermediateY = Y[Y == 1] lowX = X[Y == 0] lowY = Y[Y == 0] HX_train, HX_test, HY_train, HY_test = train_test_split(highX, highY, test_size=0.2, shuffle=True) IX_train, IX_test, IY_train, IY_test = train_test_split(intermediateX, intermediateY, test_size=0.2, shuffle=True) LX_train, LX_test, LY_train, LY_test = train_test_split(lowX, lowY, test_size=0.2, shuffle=True) X_train = np.concatenate((HX_train, IX_train, LX_train)) y_train = np.concatenate((HY_train, IY_train, LY_train)) X_test = np.concatenate((HX_test, IX_test, LX_test)) y_test = np.concatenate((HY_test, IY_test, LY_test)) print("Start Classification Techinques") # X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.2, shuffle=True) np.save('modelsPCA/traindata.npy', X_train) np.save('modelsPCA/trainlabel.npy', y_train) caller(X_train, y_train, X_test, y_test, 0) PCA_algorithm(X_train, y_train, X_test, y_test)
import Classification import Classification_Testing import Data_Preprocessing import numpy as np from sklearn.metrics import confusion_matrix from sklearn.preprocessing import StandardScaler print("Appstore games Classification") input = int(input("Press 1 To Train Models Or 2 To Test Model :: ")) if input == 1: Classification.Trainig() else: pre_processing = Data_Preprocessing.Pre_Processing() X, Y = pre_processing.PreProcessing_Testing() print("Testing Before PCA Algorithm") Testing = Classification_Testing.Classification_Testing(X, Y) Testing.OneVsOnelinear(0) Testing.OneVsOne_LinearSVC(0) Testing.OneVsOne_ploy(0) Testing.OneVsOne_rbf(0) Testing.adaBoost(0) Testing.decisionTree(0) Testing.KNN(0) xtrain = np.load('modelsPCA/traindata.npy', allow_pickle=True) ytrain = np.load('modelsPCA/trainlabel.npy', allow_pickle=True) Testing.PCA_algorithm(xtrain, ytrain)