diff --git a/hawk/analysis/checks.ipynb b/hawk/analysis/checks.ipynb deleted file mode 100644 index 796c4f0..0000000 --- a/hawk/analysis/checks.ipynb +++ /dev/null @@ -1,755 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "57588eeb-9985-4622-aa24-1b41616b343d", - "metadata": {}, - "outputs": [], - "source": [ - "from birdy import WPSClient\n", - "wps = WPSClient(\"http://localhost:5002/wps\", verify=False)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ede8e3cb-8a45-4a88-b4c9-e6e1661993be", - "metadata": {}, - "outputs": [], - "source": [ - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "### check different tefs_max_lag_target\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"3\",\n", - ")\n", - "\n", - "### check different tefs_max_lag_features\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"no_lag\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"3\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=False,\n", - " tefs_max_lag_features=\"3\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=False,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=False,\n", - " tefs_max_lag_features=\"no_lag\",\n", - " tefs_max_lag_target=\"1\",\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "50f5bcb5-07e7-4a98-bd82-582d399083d6", - "metadata": {}, - "outputs": [], - "source": [ - "### PCMCI\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"2\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"0\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"CMIknn\",\n", - " pcmci_max_lag=\"0\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"CMIknn\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"1\",\n", - ")\n", - "\n", - "# problema con TEFS, CMIknn, lag 0, in cui sceglie HS e rr invece di tg_0" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "id": "eb6b7828-3c92-4883-b3b1-44803dc236ae", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "dict_keys(['graph', 'p_matrix', 'val_matrix', 'sepsets', 'ambiguous_triples', 'conf_matrix'])" - ] - }, - "execution_count": 27, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import pandas as pd\n", - "results = pd.read_pickle(\"/work/bk1318/b382633/pcmci_results.pkl\")\n", - "results[0] # dictionary of 4 elements, keys: ['results', 'params', 'dataset_name', 'execution_time']\n", - "results[0][\"dataset_name\"] # is just \"normal\"\n", - "results[0][\"execution_time\"] # is just the execution time in seconds\n", - "results[0][\"params\"] # reports the lag, the independence test and the algorithm\n", - "results[0][\"results\"] # dictionary of 6 elements, keys: ['graph', 'p_matrix', 'val_matrix', 'sepsets', 'ambiguous_triples', 'conf_matrix']\n", - "results[0][\"results\"].keys() " - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "id": "01b6c32d-a0ce-46ef-8142-630c82d8f070", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[[''],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " ['o-o'],\n", - " ['']],\n", - "\n", - " [[''],\n", - " [''],\n", - " ['o-o'],\n", - " ['o-o'],\n", - " ['o-o'],\n", - " [''],\n", - " ['o-o']],\n", - "\n", - " [[''],\n", - " ['o-o'],\n", - " [''],\n", - " [''],\n", - " ['o-o'],\n", - " [''],\n", - " ['o-o']],\n", - "\n", - " [[''],\n", - " ['o-o'],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " ['']],\n", - "\n", - " [[''],\n", - " ['o-o'],\n", - " ['o-o'],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " ['']],\n", - "\n", - " [['o-o'],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " ['']],\n", - "\n", - " [[''],\n", - " ['o-o'],\n", - " ['o-o'],\n", - " [''],\n", - " [''],\n", - " [''],\n", - " ['']]], dtype='\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
cyclostationary_mean_tg_0cyclostationary_mean_HS_0cyclostationary_mean_rr_4w_0cyclostat_level_Maggiore_16wcyclostat_level_Luganocyclostationary_mean_tg_2target
0-0.4109982.5237160.6116050.5423940.082042-0.4470710.264043
10.8039302.1341361.6913360.5931480.1623500.6473750.354618
2-0.9112681.9147110.8322710.6747260.085054-0.5409140.427990
30.5388841.9597020.8590410.7494320.0626130.4536770.339495
4-0.6897091.9001560.6472030.8038430.0738880.0129200.324134
........................
6340.7896850.9498042.8351660.5575330.9271791.1677810.459076
6352.1410010.2231552.5751320.5674900.1905252.3302810.413500
6361.106946-0.3021702.8325340.5609460.0802502.3596440.395620
6371.171064-0.5625341.4690150.5202040.0408751.5983150.427921
6381.583469-0.459527-0.6909650.4927730.0408130.9943730.373354
\n", - "

639 rows × 7 columns

\n", - "" - ], - "text/plain": [ - " cyclostationary_mean_tg_0 cyclostationary_mean_HS_0 \\\n", - "0 -0.410998 2.523716 \n", - "1 0.803930 2.134136 \n", - "2 -0.911268 1.914711 \n", - "3 0.538884 1.959702 \n", - "4 -0.689709 1.900156 \n", - ".. ... ... \n", - "634 0.789685 0.949804 \n", - "635 2.141001 0.223155 \n", - "636 1.106946 -0.302170 \n", - "637 1.171064 -0.562534 \n", - "638 1.583469 -0.459527 \n", - "\n", - " cyclostationary_mean_rr_4w_0 cyclostat_level_Maggiore_16w \\\n", - "0 0.611605 0.542394 \n", - "1 1.691336 0.593148 \n", - "2 0.832271 0.674726 \n", - "3 0.859041 0.749432 \n", - "4 0.647203 0.803843 \n", - ".. ... ... \n", - "634 2.835166 0.557533 \n", - "635 2.575132 0.567490 \n", - "636 2.832534 0.560946 \n", - "637 1.469015 0.520204 \n", - "638 -0.690965 0.492773 \n", - "\n", - " cyclostat_level_Lugano cyclostationary_mean_tg_2 target \n", - "0 0.082042 -0.447071 0.264043 \n", - "1 0.162350 0.647375 0.354618 \n", - "2 0.085054 -0.540914 0.427990 \n", - "3 0.062613 0.453677 0.339495 \n", - "4 0.073888 0.012920 0.324134 \n", - ".. ... ... ... \n", - "634 0.927179 1.167781 0.459076 \n", - "635 0.190525 2.330281 0.413500 \n", - "636 0.080250 2.359644 0.395620 \n", - "637 0.040875 1.598315 0.427921 \n", - "638 0.040813 0.994373 0.373354 \n", - "\n", - "[639 rows x 7 columns]" - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "pd.read_csv(\"/work/bk1318/b382633/hawk/hawk/demo/Ticino_train.csv\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5a15adee-268a-45ad-bf05-924740cc977d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bf430535-0114-4c31-8864-0b68ae2caee6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7807fbff-aaf6-4280-abc6-ef582e10b1c1", - "metadata": {}, - "outputs": [], - "source": [ - "def run_postprocessing_pcmci(\n", - " results_pcmci,\n", - " target_column_name,\n", - " datasets,\n", - " destination_path,\n", - " image_formats=[\"pdf\", \"png\"],\n", - "):\n", - " all_basin_variables = set()\n", - " results_table_pcmci = []\n", - " for simulation in results_pcmci:\n", - " dataframe = datasets[simulation[\"dataset_name\"]]\n", - " var_names = dataframe[\"var_names\"]\n", - " all_basin_variables.update(var_names)\n", - "\n", - " results = simulation[\"results\"]\n", - "\n", - " # Plot only the connections to any of the target variables\n", - " temp_graph = results[\"graph\"].copy()\n", - "\n", - " # Show only the connections to the target variables\n", - " # Identify the indexes of the target variables\n", - " # target_vars = np.where([\"target\" in var for var in var_names.values])[0]\n", - " # for i in range(temp_graph.shape[0]):\n", - " # for j in range(temp_graph.shape[1]):\n", - " # # if the edge is not connected to the target variables\n", - " # if i not in target_vars and j not in target_vars:\n", - " # # remove the edge\n", - " # temp_graph[i, j, :] = ''\n", - " # temp_graph[j, i, :] = ''\n", - "\n", - " # Base arguments for tp.plot_graph\n", - " plot_args = {\n", - " \"val_matrix\": results[\"val_matrix\"],\n", - " \"graph\": temp_graph,\n", - " \"var_names\": var_names,\n", - " \"link_colorbar_label\": \"cross-MCI\",\n", - " \"node_colorbar_label\": \"auto-MCI\",\n", - " \"show_autodependency_lags\": False,\n", - " }\n", - "\n", - " # Additional arguments to include if the independence_test is CMIknn\n", - " if simulation[\"params\"][\"independencetest\"] == \"cmiknn\":\n", - " plot_args.update(\n", - " {\n", - " \"vmin_edges\": 0.0,\n", - " \"vmax_edges\": 0.1,\n", - " \"edge_ticks\": 0.05,\n", - " \"cmap_edges\": \"OrRd\",\n", - " \"vmin_nodes\": 0,\n", - " \"vmax_nodes\": 0.1,\n", - " \"node_ticks\": 0.1,\n", - " \"cmap_nodes\": \"OrRd\",\n", - " }\n", - " )\n", - "\n", - " # Plot causal graph\n", - " # target_file = os.path.join(constants.path_figures, \"algorithm_results\", basin_name, \"pcmci\", key + \".pdf\")\n", - " # if not os.path.exists(target_file):\n", - " # fig, ax = plt.subplots()\n", - " # tp.plot_graph(**plot_args, fig_ax=(fig, ax))\n", - " # os.makedirs(os.path.dirname(target_file), exist_ok=True)\n", - " # plt.savefig(target_file, bbox_inches=\"tight\")\n", - " # plt.close(fig)\n", - "\n", - " # # Plot time series graph if lag > 0\n", - " # if simulation[\"params\"][\"lag\"] > 0:\n", - " # target_file = os.path.join(\n", - " # constants.path_figures, \"algorithm_results\", basin_name, \"pcmci\", key + \"_timeseries.pdf\"\n", - " # )\n", - " # if not os.path.exists(target_file):\n", - " # fig, ax = plt.subplots()\n", - " # tp.plot_time_series_graph(\n", - " # figsize=(6, 4),\n", - " # fig_ax=(fig, ax),\n", - " # val_matrix=results[\"val_matrix\"],\n", - " # graph=results[\"graph\"],\n", - " # var_names=var_names,\n", - " # link_colorbar_label=\"MCI\",\n", - " # )\n", - " # os.makedirs(os.path.dirname(target_file), exist_ok=True)\n", - " # plt.savefig(target_file, bbox_inches=\"tight\")\n", - " # plt.close(fig)\n", - "\n", - " # Extract the selected features\n", - " selected_features = get_connected_variables(results[\"graph\"], var_names)\n", - "\n", - " # Compute the R2 scores\n", - " inputs_names_lags = {feature: [0] for feature in selected_features}\n", - " score_r2 = (\n", - " regression_analysis(\n", - " inputs_names_lags=inputs_names_lags,\n", - " target_name=target_column_name,\n", - " df_train=dataframe[\"train\"],\n", - " df_test=dataframe[\"test\"],\n", - " )\n", - " if len(selected_features) > 0\n", - " else np.nan\n", - " )\n", - "\n", - " inputs_names_lags = {feature: list(range(0, simulation[\"params\"][\"lag\"] + 1)) for feature in selected_features}\n", - " score_r2_lag = (\n", - " regression_analysis(\n", - " inputs_names_lags=inputs_names_lags,\n", - " target_name=target_column_name,\n", - " df_train=dataframe[\"train\"],\n", - " df_test=dataframe[\"test\"],\n", - " )\n", - " if len(selected_features) > 0\n", - " else np.nan\n", - " )\n", - "\n", - " inputs_names_lags = {feature: list(range(0, simulation[\"params\"][\"lag\"] + 1)) for feature in selected_features}\n", - " inputs_names_lags[target_column_name] = list(range(1, simulation[\"params\"][\"lag\"] + 1))\n", - " score_r2_lag_ar = regression_analysis(\n", - " inputs_names_lags=inputs_names_lags,\n", - " target_name=target_column_name,\n", - " df_train=dataframe[\"train\"],\n", - " df_test=dataframe[\"test\"],\n", - " )\n", - "\n", - " # Table of results\n", - " results_table_pcmci.append(\n", - " {\n", - " \"selected_features\": \" \".join(selected_features),\n", - " \"score_r2\": score_r2,\n", - " \"score_r2_lag\": score_r2_lag,\n", - " \"score_r2_lag_ar\": score_r2_lag_ar,\n", - " \"dataset_name\": simulation[\"dataset_name\"],\n", - " \"algorithm\": simulation[\"params\"][\"algorithm\"],\n", - " \"independencetest\": simulation[\"params\"][\"independencetest\"],\n", - " \"lag\": simulation[\"params\"][\"lag\"],\n", - " \"execution_time\": simulation[\"execution_time\"],\n", - " }\n", - " )\n", - "\n", - " # Export the file to pkl\n", - " target_file_results_details = os.path.join(destination_path, \"results_details_pcmci.pkl\")\n", - " save_to_pkl_file(target_file_results_details, results_table_pcmci)\n", - "\n", - " # Feature presences heatmap\n", - " if target_column_name in all_basin_variables:\n", - " all_basin_variables.remove(target_column_name)\n", - " all_basin_variables = sorted(list(all_basin_variables))\n", - " df_presence = pd.DataFrame(index=all_basin_variables, columns=range(len(results_pcmci)))\n", - " scores = []\n", - " scores_lag = []\n", - " scores_lag_ar = []\n", - "\n", - " for index, result in enumerate(results_table_pcmci):\n", - " scores.append(result[\"score_r2\"])\n", - " scores_lag.append(result[\"score_r2_lag\"])\n", - " scores_lag_ar.append(result[\"score_r2_lag_ar\"])\n", - "\n", - " # loop through the rows of the df, if the feature is in the list of selected features, put a 1\n", - " for feature in df_presence.index:\n", - " if feature in result[\"selected_features\"]:\n", - " df_presence.loc[feature, index] = 1\n", - " else:\n", - " df_presence.loc[feature, index] = 0\n", - " if feature not in datasets[result[\"dataset_name\"]][\"var_names\"]:\n", - " df_presence.loc[feature, index] = 2\n", - "\n", - " df_presence = df_presence.astype(float)\n", - " scores = np.array(scores)\n", - " scores_lag = np.array(scores_lag)\n", - " scores_lag_ar = np.array(scores_lag_ar)\n", - "\n", - " fig, ax = plot_feature_presence_and_r2(\n", - " df_presence=df_presence,\n", - " scores_values=[scores, scores_lag, scores_lag_ar],\n", - " scores_labels=[r\"$R^2$\", r\"$R^2$ (lag)\", r\"$R^2$ (lag + AR)\"],\n", - " )\n", - "\n", - " target_file_plots = {}\n", - " for image_format in image_formats:\n", - " target_file_plot = os.path.join(\n", - " destination_path, \"algorithm_results\", \"pcmci\", f\"feature_presence_pcmci.{image_format}\"\n", - " )\n", - " os.makedirs(os.path.dirname(target_file_plot), exist_ok=True)\n", - " plt.savefig(target_file_plot, bbox_inches=\"tight\")\n", - " target_file_plots[image_format] = target_file_plot\n", - " plt.close(fig)\n", - " \n", - " print(f\"PCMCI results details: {results_table_pcmci}\")\n", - "\n", - " return target_file_plots, target_file_results_details" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e717aa75-bfcb-4f34-8440-a1896e6c6573", - "metadata": {}, - "outputs": [], - "source": [ - "### TEFS\n", - "\n", - "resp = wps.causal(\n", - " dataset_train=open(\"../hawk/hawk/demo/Ticino_train.csv\"),\n", - " dataset_test=open(\"../hawk/hawk/demo/Ticino_test.csv\"),\n", - " target_column_name=\"target\",\n", - " pcmci_test_choice=\"ParCorr\",\n", - " pcmci_max_lag=\"1\",\n", - " tefs_direction=\"forward\",\n", - " tefs_use_contemporary_features=True,\n", - " tefs_max_lag_features=\"1\",\n", - " tefs_max_lag_target=\"1\",\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "400aabea-f8b3-4a07-ad9c-e5a5f339d560", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python (tensorflow_env)", - "language": "python", - "name": "tensorflow_env" - }, - "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.12" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}