Skip to content
Snippets Groups Projects
Commit bbe3c3d7 authored by Charly Lamothe's avatar Charly Lamothe
Browse files

Few fixes

parent 369a053a
No related branches found
No related tags found
1 merge request!24Resolve "non negative omp"
......@@ -137,6 +137,8 @@ class Trainer(object):
y_pred = model.predict(X, extracted_forest_size)
else:
y_pred = model.predict_no_weights(X, extracted_forest_size)
y_pred = np.sign(y_pred)
y_pred = np.where(y_pred == 0, 1, y_pred)
result = self._classification_score_metric(y_true, y_pred)
elif type(model) in [OmpForestBinaryClassifier, OmpForestMulticlassClassifier, RandomForestClassifier]:
if weights:
......
......@@ -7,10 +7,12 @@ from tqdm import tqdm
if __name__ == "__main__":
models_source_path = 'models'
models_destination_path = 'bolsonaro_models_27-03-20_v2'
models_destination_path = 'bolsonaro_models_29-03-20'
datasets = ['boston', 'diabetes', 'linnerud', 'breast_cancer', 'california_housing', 'diamonds',
'steel-plates', 'kr-vs-kp', 'kin8nm', 'spambase', 'gamma', 'lfw_pairs']
datasets = ['california_housing', 'boston', 'diabetes', 'breast_cancer', 'diamonds', 'steel-plates']
pathlib.Path(models_destination_path).mkdir(parents=True, exist_ok=True)
with tqdm(datasets) as dataset_bar:
......@@ -18,12 +20,16 @@ if __name__ == "__main__":
dataset_bar.set_description(dataset)
found_paths = glob2.glob(os.path.join(models_source_path, dataset, 'stage5_27-03-20',
'**', 'model_raw_results.pickle'), recursive=True)
pathlib.Path(os.path.join(models_destination_path, dataset)).mkdir(parents=True, exist_ok=True)
#pathlib.Path(os.path.join(models_destination_path, dataset)).mkdir(parents=True, exist_ok=True)
with tqdm(found_paths) as found_paths_bar:
for path in found_paths_bar:
found_paths_bar.set_description(path)
new_path = path.replace(f'models/{dataset}/stage5_27-03-20/', '')
(new_path, filename) = os.path.split(new_path)
if int(new_path.split(os.sep)[0]) != 9:
found_paths_bar.update(1)
found_paths_bar.set_description('Skipping...')
continue
new_path = os.path.join(models_destination_path, dataset, new_path)
pathlib.Path(new_path).mkdir(parents=True, exist_ok=True)
shutil.copyfile(src=path, dst=os.path.join(new_path, filename))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment