Skip to content
Snippets Groups Projects
Commit b4cbfd5c authored by DesireeWyrzylala's avatar DesireeWyrzylala
Browse files

version 2 with different hyperparameters for knn

parent 1812921e
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ sys.path.append(str(pathlib.Path.absolute)+ '../../')
from src.utils.slidingWindows import find_length_rank
from src.run_model_wrapper import main
#Hyperparameter tested for multivariats
#optimal hyperparameters from autors: {'n_neighbors': 50, 'method': 'mean'},
params = {
'n_neighbors': [10, 20, 30, 40, 50],
......
from KNN import KNN
import sys
import pathlib
sys.path.append(str(pathlib.Path.absolute)+ '../../')
from src.utils.slidingWindows import find_length_rank
from src.run_model_wrapper import main
#hyperparameters tested for univariats
#optimal hyperparameters from autors: {'periodicity': 2, 'n_neighbors': 50},
params = {
'periodicity': [1, 2, 3],
'n_neighbors': [10, 20, 30, 40, 50],
}
def run_Sub_KNNV2(data, n_neighbors=10, method='largest', periodicity=1, n_jobs=1):
slidingWindow = find_length_rank(data, rank=periodicity)
clf = KNN(slidingWindow=slidingWindow, n_neighbors=n_neighbors,method=method, n_jobs=n_jobs)
clf.fit(data)
score = clf.decision_scores_
return score.ravel()
model = 'Sub_KNN_V2'
output_path = '../../../docs/evaluation/'
#writes results in .csv
main(run_Sub_KNNV2,params,model,data_folders = '../../../data/', model_type='unsupervised',output_dir = output_path)
#pip3 install -r requirements.txt
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment