Gabriel Aguiar
04/18/2024, 12:21 PMus_6_gas_by_date_tracking_metrics.json
and the file looks like this:
```json
{
"rmse": 2681.4785,
"mae": 2211.2415,
"r2": -3568893.6356
}
• My catalog.yml
entry for the tracking dataset is as follows:
"{name_us}_{base}_{split_type}_tracking_metrics":
type: kedro.extras.datasets.tracking.MetricsDataSet
filepath: data/09_tracking/{name_us}_{base}_{split_type}_tracking_metrics.json
• The relevant node in my Kedro pipeline is defined like this:
node(
func=tracking_metrics,
inputs=[f"{name_us}_{base}_{split_type}_test_predicted"],
outputs=f'{name_us}_{base}_{split_type}_tracking_metrics',
name=f"tracking_{name_us}_{base}_{split_type}_node"
)
• The tracking_metrics
function used in the node is implemented as follows:
from math import sqrt
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
import numpy as np
def tracking_metrics(test_data: pd.DataFrame) -> dict[str, float]:
target_cols = [col for col in test_data.columns if col.endswith('_target')]
if not target_cols:
raise ValueError("No target column found in the test data.")
target_col = target_cols[0]
test_data = test_data.dropna(subset=[target_col, 'Prediction'])
rmse = np.round(sqrt(mean_squared_error(test_data[target_col], test_data['Prediction'])), 4)
mae = np.round(mean_absolute_error(test_data[target_col], test_data['Prediction']), 4)
r2 = np.round(r2_score(test_data[target_col], test_data['Prediction']), 4)
return {'rmse': rmse, 'mae': mae, 'r2': r2}
The file is stored at C:\Dev\kedro_pelopt\sentinela-palletizing\peloptmize\data\09_tracking\
, and I've confirmed that the metrics are being correctly saved. However, when I go to Kedro Viz's experiment tracking section, it shows "No data to display."
I'm currently using Kedro version 0.19.3
, Kedro datasets 2.1.0
and Kedro Viz version 8.0.1
. Here's what I've tried so far:
• Made sure the Kedro Viz server is pointing to the correct Kedro project.
• Restarted the Kedro Viz server after changes.
• Cleared the browser cache and tried accessing in an incognito window.
• Checked the catalog.yml
for correct file paths.
• Looked for any necessary configurations in kedro_viz.yaml
.
• Opened the developer console in the browser for any errors but didn't find any clues.
Does anyone have suggestions on what else I can check or try to resolve this? Thank you in advance for your help!Rashida Kanchwala
04/18/2024, 12:43 PMGabriel Aguiar
04/18/2024, 1:29 PM(peloptimize) C:\Dev\kedro_pelopt\sentinela-palletizing\peloptmize>kedro viz run
Starting Kedro Viz ...
Process Process-1:
Traceback (most recent call last):
File "C:\Users\gabriel.gomes\AppData\Local\anaconda3\envs\peloptimize\lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\Users\gabriel.gomes\AppData\Local\anaconda3\envs\peloptimize\lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\gabriel.gomes\AppData\Local\anaconda3\envs\peloptimize\lib\site-packages\kedro_viz\server.py", line 112, in run_server
load_and_populate_data(path, env, include_hooks, extra_params, pipeline_name)
File "C:\Users\gabriel.gomes\AppData\Local\anaconda3\envs\peloptimize\lib\site-packages\kedro_viz\server.py", line 62, in load_and_populate_data
catalog, pipelines, session_store, stats_dict = kedro_data_loader.load_data(
File "C:\Users\gabriel.gomes\AppData\Local\anaconda3\envs\peloptimize\lib\site-packages\kedro_viz\integrations\kedro\data_loader.py", line 110, in load_data
pipelines_dict = dict(pipelines)
File "C:\Users\gabriel.gomes\AppData\Local\anaconda3\envs\peloptimize\lib\site-packages\kedro\framework\project\__init__.py", line 142, in inner
self._load_data()
File "C:\Users\gabriel.gomes\AppData\Local\anaconda3\envs\peloptimize\lib\site-packages\kedro\framework\project\__init__.py", line 187, in _load_data
project_pipelines = register_pipelines()
File "C:\Dev\kedro_pelopt\sentinela-palletizing\peloptmize\src\peloptmize\pipeline_registry.py", line 19, in register_pipelines
raise NotImplementedError("""
NotImplementedError:
register_pipelines() is expected to be overwritten by ProjectHooks.
Make sure the hooks is found in peloptimize/hooks and enabled in settings.py
My settings file:
"""Project settings. There is no need to edit this file unless you want to change values
from the Kedro defaults. For further information, including these default values, see
<https://kedro.readthedocs.io/en/stable/kedro_project_setup/settings.html>."""
from peloptmize.hooks import proj_hooks
HOOKS = (proj_hooks.ProjectHooks(),)
from kedro.config import OmegaConfigLoader # noqa: import-outside-toplevel
CONFIG_LOADER_CLASS = OmegaConfigLoader
from kedro_viz.integrations.kedro.sqlite_store import SQLiteStore
from pathlib import Path
SESSION_STORE_CLASS = SQLiteStore
SESSION_STORE_ARGS = {"path": str(Path(__file__).parents[2] / "data")}
Rashida Kanchwala
04/18/2024, 1:37 PMkedro viz run --include-hooks
Gabriel Aguiar
04/18/2024, 1:54 PMRashida Kanchwala
04/18/2024, 2:01 PMkedro viz run --include-hooks