.2 procent

This commit is contained in:
Tom Selier 2023-10-20 17:22:31 +02:00
parent 76c5f61dda
commit 156e4a9961
1 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,7 @@ import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import csv
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import MinMaxScaler, StandardScaler, RobustScaler, MaxAbsScaler
from enum import Enum
import random
from sklearn.metrics import confusion_matrix, accuracy_score, precision_score, recall_score, matthews_corrcoef
@ -19,7 +19,7 @@ class Tree(Enum):
PLATAAN = 7
# Open file
file = open('./out/result-2023-10-10T15.08.36.csv', "r")
file = open('dataset\\csv\\result-2023-10-14T16.13.30.csv', "r")
data = list(csv.reader(file, delimiter=","))
file.close()
@ -32,6 +32,7 @@ tags_int = []
for row in data:
tree = row.pop(0)
row.pop(1) # TODO: Doe dit niet
id = Tree[tree.upper()]
# print("Tree name =", tree, " id =", id.value)
@ -52,14 +53,16 @@ for idx, col in enumerate(data[0]):
column = np.array(column).reshape(-1, 1)
# Perform Min - Max scaling
scaler = MinMaxScaler()
# scaler = MinMaxScaler()
scaler = MaxAbsScaler()
column = scaler.fit_transform(column)
# Reshape it back cus scaler is dumb af
column = np.array(column).reshape(len(column))
# DEBUG Print resulting column
# print("NORM", header[idx + 1], "\n", column)
print("NORM", header[idx + 1], "\n", column)
# Replace original data array
data[:, idx] = column