def graph(): dp = DataPreProcessing(training_planets=1000) dp.create_data() X, Y = dp.get_graphing_data() x = [planet[0] for planet in X] y = [planet[1] for planet in X] z = [planet[2] for planet in X] #fig = plt.figure() #ax = Axes3D(fig) for i in range(len(Y)): if Y[i] == 1: plt.scatter(x[i], y[i], color='red') else: plt.scatter(x[i], y[i], color='blue') plt.show()
def load_data(self): # 570 is the sweet spot for number of training planets gives best results dp = DataPreProcessing(training_planets=570) dp.create_data() self.X_train, self.Y_train = dp.get_normalized_training_data() self.X_test, self.Y_test = dp.get_normalized_testing_data()
def load_data(self): dp = DataPreProcessing(training_planets=150) dp.create_data() self.X_train, self.Y_train = dp.get_normalized_training_data() self.X_test, self.Y_test = dp.get_normalized_testing_data()
def load_data(self): dp = DataPreProcessing(training_planets=5087) dp.create_data() self.X_train, self.Y_train = dp.get_scaled_standardized_training_data() self.X_test, self.Y_test = dp.get_scaled_standardized_testing_data()
def load_data(self): # 2500 is the sweet spot for number of training planets gives best results dp = DataPreProcessing(training_planets=5087) dp.create_data() self.X_train, self.Y_train, self.X_test, self.Y_test = dp.get_data()
from exoplanet_knn import NearestNeighbor from exoplanet_nn import NeuralNetwork from exoplanet_tree import DecisionTree from exoplanet_self_knn import KNearestNeighbor from data_preprocessing import DataPreProcessing import matplotlib.pyplot as plt if __name__ == "__main__": dp = DataPreProcessing(training_planets=5087) print("creating models...") dp.create_data() data = dp.X_test nn = NeuralNetwork() knn = NearestNeighbor() tree = DecisionTree() self_knn = KNearestNeighbor(k=7) nn.load_data() nn.load_nn() knn.load_data() knn.load_knn() tree.load_data() tree.load_tree() self_knn.load_data() knn.predict()
axs[0].legend(['train', 'val'], loc='best') # summarize history for loss axs[1].plot(range(1, len(model_info.history['loss']) + 1), model_info.history['loss']) axs[1].plot(range(1, len(model_info.history['val_loss']) + 1), model_info.history['val_loss']) axs[1].set_title('model_info Loss') axs[1].set_ylabel('Loss') axs[1].set_xlabel('Epoch') axs[1].set_xticks(np.arange(1, len(model_info.history['loss']) + 1), len(model_info.history['loss']) / 10) axs[1].legend(['train', 'val'], loc='best') plt.show() if __name__ == '__main__': dpp = DataPreProcessing() (x_train, x_test), (y_train, y_test) = dpp.load_data(img_data_path='./data/img_data.npy', label_data_path='./data/label_data.npy') (x_train, x_test), (y_train, y_test) = dpp.pre_processing(x_train, x_test, y_train, y_test) label_list, age_list, gender_list = dpp.get_labels() print(x_train.shape) print(x_test.shape) print(y_train.shape) print(y_test.shape) faceNet = FaceNet(input_shape=x_train.shape[1:], num_classes=len(label_list), gpu=True) model = faceNet.build() model_info = model.fit(x_train, y_train, batch_size=batch_size,