Commit 940cdc07 authored by Naundorf's avatar Naundorf
Browse files

Update KI-KNN

parent 4b17b010
Pipeline #6557 failed with stage
in 2 minutes and 20 seconds
...@@ -23,30 +23,25 @@ def train_test_data_split(X, y): ...@@ -23,30 +23,25 @@ def train_test_data_split(X, y):
return X_train, X_test, y_train, y_test return X_train, X_test, y_train, y_test
# creating a model # creating a model
def create_and_compile_model(): def create_and_compile_model():
print("Creating a Model") print("Creating a Model")
from keras.models import Sequential from keras.models import Sequential
from keras.layers import Conv2D, Dense, MaxPooling2D, Dropout, Flatten, from keras.layers import Conv2D, Dense, MaxPooling2D, Dropout, Flatten, BatchNormalization
BatchNormalization model = models.Sequential()
model = models.Sequential() model.add(Conv2D(32, kernel_size=(3, 3), activation="relu", input_shape=(constants.N_FEATURE, constants.FEATURE_MAX_LEN, constants.CHANNELS)))
model.add(Conv2D(32, kernel_size=(3, 3), activation="relu", model.add(Conv2D(32, kernel_size=(3, 3), activation="relu"))
input_shape=(constants.N_FEATURE, constants.FEATURE_MAX_LEN, model.add(MaxPooling2D(pool_size=(2,2)))
constants.CHANNELS))) model.add(Conv2D(64, kernel_size=(3, 3), activation="relu"))
model.add(Conv2D(32, kernel_size=(3, 3), activation="relu")) model.add(MaxPooling2D(pool_size=(2,2)))
model.add(MaxPooling2D(pool_size=(2,2))) model.add(Dropout(0.5))
model.add(Conv2D(64, kernel_size=(3, 3), activation="relu")) model.add(Flatten())
model.add(MaxPooling2D(pool_size=(2,2))) model.add(Dense(128, activation="relu"))
model.add(Dropout(0.5)) model.add(Dense(constants.OUTPUT_LAYER_DIMENSIONS, activation='softmax'))
model.add(Flatten()) print("Compiling a Model")
model.add(Dense(128, activation="relu")) optimizer = keras.optimizers.RMSprop()
model.add(Dense(constants.OUTPUT_LAYER_DIMENSIONS, activation='softmax')) model.compile(optimizer=optimizer, loss=constants.LOSS_FUNCTION_SPARSE, metrics=[constants.ACCURACY_METRICS])
print("Compiling a Model") print(model.summary())
optimizer = keras.optimizers.RMSprop() return model
model.compile(optimizer=optimizer, loss=constants.LOSS_FUNCTION_SPARSE,
metrics=[constants.ACCURACY_METRICS])
print(model.summary())
return model
def preprocessing_csv_data(): def preprocessing_csv_data():
print("Reading Features... ") print("Reading Features... ")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment