Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ from imputegap.tools import utils
ts_1 = TimeSeries()

# 2. load the timeseries from file or from the code
ts_1.load_timeseries(utils.search_path("eeg-test"))
ts_1.load_timeseries(utils.search_path("eeg-alcohol"))
ts_1.normalize(normalizer="z_score")

# [OPTIONAL] you can plot your raw data / print the information
Expand Down Expand Up @@ -178,7 +178,7 @@ from imputegap.tools import utils
ts_1 = TimeSeries()

# 2. load the timeseries from file or from the code
ts_1.load_timeseries(utils.search_path("eeg-test"))
ts_1.load_timeseries(utils.search_path("eeg-alcohol"))
ts_1.normalize(normalizer="min_max")

# 3. contamination of the data with MCAR scenario
Expand Down Expand Up @@ -213,7 +213,7 @@ from imputegap.tools import utils
ts_1 = TimeSeries()

# 2. load the timeseries from file or from the code
ts_1.load_timeseries(utils.search_path("eeg-test"))
ts_1.load_timeseries(utils.search_path("eeg-alcohol"))
ts_1.normalize(normalizer="min_max")

# 3. contamination of the data
Expand Down Expand Up @@ -262,7 +262,7 @@ from imputegap.tools import utils
ts_1 = TimeSeries()

# 2. load the timeseries from file or from the code
ts_1.load_timeseries(utils.search_path("eeg-test"))
ts_1.load_timeseries(utils.search_path("eeg-alcohol"))
ts_1.normalize(normalizer="min_max")

# 3. contamination of the data
Expand All @@ -280,7 +280,7 @@ cdrec.score(ts_1.data, cdrec.imputed_matrix)
# 6. [OPTIONAL] display the results
ts_1.print_results(cdrec.metrics)
ts_1.plot(raw_data=ts_1.data, infected_data=infected_data, imputed_data=cdrec.imputed_matrix, title="imputation",
max_series=1, save_path="./assets", display=True)
max_series=1, save_path="./imputegap/assets", display=True)

# 7. [OPTIONAL] save hyperparameters
utils.save_optimization(optimal_params=cdrec.parameters, algorithm="cdrec", dataset="eeg", optimizer="b")
Expand Down Expand Up @@ -312,10 +312,10 @@ from imputegap.tools import utils
ts_1 = TimeSeries()

# 2. load the timeseries from file or from the code
ts_1.load_timeseries(utils.search_path("eeg-test"))
ts_1.load_timeseries(utils.search_path("eeg-alcohol"))

# 3. call the explanation of your dataset with a specific algorithm to gain insight on the Imputation results
shap_values, shap_details = Explainer.shap_explainer(raw_data=ts_1.data, file_name="eeg-test", algorithm="cdrec")
shap_values, shap_details = Explainer.shap_explainer(raw_data=ts_1.data, file_name="eeg-alcohol", algorithm="cdrec")

# [OPTIONAL] print the results with the impact of each feature.
Explainer.print(shap_values, shap_details)
Expand Down
Binary file modified imputegap/recovery/__pycache__/manager.cpython-312.pyc
Binary file not shown.
8 changes: 1 addition & 7 deletions imputegap/recovery/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@
print("Running in a headless environment or CI. Using Agg backend.")
else:
try:
# Attempt to use TkAgg if a display is available and we're not in CI
matplotlib.use("TkAgg")
if importlib.util.find_spec("tkinter") is not None:
print("tkinter is available.")
else:
if importlib.util.find_spec("tkinter") is None:
print("tkinter is not available.")
print("Using TkAgg backend with tkinter support.")
except (ImportError, RuntimeError):
# Fallback to Agg if TkAgg is unavailable
matplotlib.use("Agg")
print("TkAgg is unavailable. Using Agg backend.")

from matplotlib import pyplot as plt # type: ignore

Expand Down
Loading