Intro of ML
K Nearest Neighbous and Decision Tree
In this part, we will talk about the KNN and Decision Tree. What’s more, we need some knowledge about Python and numpy, when we use those tools, I will show you how to use them.
notes for it
wait for updating
You can load the datasets from the files “WIFI db/clean dataset.txt” and “WIFI db/noisy dataset.txt”. They contain a 2000x8 array. This array represents a dataset of 2000 samples. Each sample is composed of 7 WIFI signal strength while the last column indicates the room number in which the user is standing (i.e., the label of the sample). All the features in the dataset are continuous except the room number. You can load the text file with the “loadtxt” function from Numpy. Given the nature of the dataset you will have to build decision trees capable of dealing with continuous attributes and multiple labels.
so we use the function
loadtxt like that:
path_clean = "code/wifi_db/clean_dataset.txt" path_noisy = "code/wifi_db/noisy_dataset.txt" clean_dataset = np.loadtxt(path_clean) noisy_dataset = np.loadtxt(path_noisy)