Commit 4b17b010 authored by Naundorf's avatar Naundorf
Browse files

Update KI-KNN

parent c501e5f9
Pipeline #6556 failed with stage
in 2 minutes and 19 seconds
...@@ -48,6 +48,22 @@ metrics=[constants.ACCURACY_METRICS]) ...@@ -48,6 +48,22 @@ metrics=[constants.ACCURACY_METRICS])
print(model.summary()) print(model.summary())
return model return model
def preprocessing_csv_data():
print("Reading Features... ")
data = pd.read_csv(constants.FEATURES_CSV_NAME)
data.head()
# Dropping unnecessary columns (Column Filename is dropped)
data = data.drop(['filename'], axis=1)
data.head()
return data
# Extracting classes/label column as y from csv and converting string labels to numbers using LabelEncoder
def encode_labels(data):
list = data.iloc[:, -1]
encoder = LabelEncoder()
target_labels = encoder.fit_transform(list)
return target_labels, encoder
def train_and_save_model(model, X_train, y_train, X_test, y_test): def train_and_save_model(model, X_train, y_train, X_test, y_test):
logdir = constants.LOG_DIR_PATH logdir = constants.LOG_DIR_PATH
tensorboard_callback = keras.callbacks.TensorBoard(log_dir=logdir) tensorboard_callback = keras.callbacks.TensorBoard(log_dir=logdir)
......
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