from sklearn.model_selection import RandomizedSearchCV, KFold
from sklearn.neighbors import NearestCentroid
from sklearn.metrics import accuracy_score, make_scorer
from pathlib import Path

def write_hpValues(model_Name, HP_Values,dataset):
    Path("results/%s" % dataset).mkdir(parents=True, exist_ok=True)
    Path("results/%s/%s" % (dataset,model_Name)).mkdir(parents=True, exist_ok=True)
    file_name = r'results/%s/%s/BestParam.txt' % (dataset,model_Name)
    with open(file_name, 'a+') as x_file:
        x_file.write(str(HP_Values))
        x_file.write("\n----------------------------------------------------------")
    return 0



def NearestCentroid_training_tuning(X_train,Y_train, dataset):
    HP_Values = 0
    write_hpValues('NearestCentroid', HP_Values, dataset)
    Trained_model = NearestCentroid()
    Trained_model.fit(X_train,Y_train)
    return Trained_model
