-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from lincc-frameworks/awo/scaffolding-for-extra…
…ctor-and-classifier Rough scaffolding for feature extractor and classifier.
- Loading branch information
Showing
23 changed files
with
47,223 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3d07c5ba-09e5-4d50-ad87-07dcd0f481f0", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# https://resspect.readthedocs.io/en/latest/" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "dab55b9a-e3dd-4e87-b849-fa5a62b36989", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from resspect import fit_snpcc" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "88c74cf5-bfe5-4685-9335-bdfe8c63f051", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"path_to_data_dir = 'data/SIMGEN_PUBLIC_DES/' # raw data directory \n", | ||
"features_file = 'results/Malanchev.csv' # output file \n", | ||
"feature_extractor = 'malanchev'\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "360ecf08-9c52-4075-8617-4deb1959bb94", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fit_snpcc(path_to_data_dir=path_to_data_dir, features_file=features_file, feature_extractor=feature_extractor)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "9df62bef-2588-4fd4-8039-41cfd9bb91bc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from resspect.learn_loop import learn_loop\n", | ||
"\n", | ||
"nloops = 1000 # number of iterations\n", | ||
"method = 'malanchev' # only option in v1.0\n", | ||
"ml = 'RandomForest' # classifier\n", | ||
"strategy = 'UncSampling' # learning strategy\n", | ||
"input_file = 'results/Malanchev.csv' # input features file\n", | ||
"metric = 'results/metrics.csv' # output metrics file\n", | ||
"queried = 'results/queried.csv' # output query file\n", | ||
"train = 'original' # initial training\n", | ||
"batch = 1 # size of batch\n", | ||
"\n", | ||
"learn_loop(nloops=nloops, features_method=method, classifier=ml,\n", | ||
" strategy=strategy, path_to_features=input_file, output_metrics_file=metric,\n", | ||
" output_queried_file=queried, training=train, batch=batch)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ef3b8d05-d53c-402b-836c-f5b6a2efc0f4", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"nloops = 1000 # number of iterations\n", | ||
"method = 'malanchev' # only option in v1.0\n", | ||
"ml = 'RandomForest' # classifier\n", | ||
"strategy = 'RandomSampling' # learning strategy\n", | ||
"input_file = 'results/Malanchev.csv' # input features file\n", | ||
"metric = 'results/metrics_random.csv' # output metrics file\n", | ||
"queried = 'results/queried_random.csv' # output query file\n", | ||
"train = 'original' # initial training\n", | ||
"batch = 1 # size of batch\n", | ||
"\n", | ||
"learn_loop(nloops=nloops, features_method=method, classifier=ml,\n", | ||
" strategy=strategy, path_to_features=input_file, output_metrics_file=metric,\n", | ||
" output_queried_file=queried, training=train, batch=batch)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3ffa34f1-64f5-46ea-93f7-f8935cba1cc6", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from resspect.plot_results import Canvas\n", | ||
"\n", | ||
"# define parameters\n", | ||
"path_to_files = ['results/metrics.csv','results/metrics_random.csv']\n", | ||
"strategies_list = ['UncSampling', 'RandomSampling']\n", | ||
"output_plot = 'plots/metrics.png'\n", | ||
"\n", | ||
"#Initiate the Canvas object, read and plot the results for\n", | ||
"# each metric and strategy.\n", | ||
"cv = Canvas()\n", | ||
"cv.load_metrics(path_to_files=path_to_files,\n", | ||
" strategies_list=strategies_list)\n", | ||
"cv.set_plot_dimensions()\n", | ||
"cv.plot_metrics(output_plot_file=output_plot,\n", | ||
" strategies_list=strategies_list)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1f88d53b-1591-4aed-8ee1-35904d8b23b2", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.