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
# Dashboard from Vizro-AI calls and using Vizro-AI generated chart code | |
from vizro import Vizro | |
import vizro.models as vm | |
import vizro.plotly.express as px | |
from vizro.models.types import capture | |
import plotly.graph_objects as go | |
import pandas as pd | |
@capture('graph') | |
def compare_versions_custom_chart(data_frame=None): |
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
# Dashboard using Vizro-AI calls only | |
from vizro import Vizro | |
import vizro.models as vm | |
import vizro.plotly.express as px | |
first_page = vm.Page( | |
title="Documentation traffic dashboard", | |
layout=vm.Layout( | |
grid=[ | |
[0, 2], |
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
from vizro import Vizro | |
import vizro.models as vm | |
import vizro.plotly.express as px | |
first_page = vm.Page( | |
title="Documentation traffic dashboard", | |
layout=vm.Layout( | |
grid=[ | |
[0, 2], |
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
# Total views of the top performing stable pages | |
top_performing_pages_fig = vizro_ai.plot(df, "Collate rows of data for Path where Version==stable. Create a horizontal bar chart describing the total Views for the top 5 pages. Add the numbers to each bar. Decrease font size of marks", explain=True) | |
top_performing_pages_fig.show() | |
# Top 5 performing pages on stable by date | |
top_pages_by_date_fig = vizro_ai.plot(df, "Collate rows of data for Path where Version==stable. Create a line graph for the total Views per Date for the top 5 Paths", explain=True) | |
top_pages_by_date_fig.show() |
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
import vizro_ai | |
from vizro_ai import VizroAI | |
from dotenv import load_dotenv | |
load_dotenv() | |
vizro_ai = VizroAI(model="gpt-4–0613") | |
compare_versions_fig = vizro_ai.plot(df, "Combine rows of Views for each Date for latest and stable Version. Draw a line graph comparing Views per Date for latest and stable", explain=True) | |
compare_versions_fig.show() |
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
from kedro.config import OmegaConfigLoader | |
from kedro.io import DataCatalog | |
conf_loader = OmegaConfigLoader(".", base_env="", default_run_env="") | |
conf_catalog = conf_loader["catalog"] | |
# Create the DataCatalog instance from the configuration | |
catalog = DataCatalog.from_config(conf_catalog) | |
# Load the datasets |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def create_pipeline(**kwargs): | |
return Pipeline( | |
[ | |
node( | |
func=split_data, | |
inputs=["master_table", "parameters"], | |
outputs=["X_train", "X_test", "y_train", "y_test"], | |
name="split_data_node", | |
), | |
node( |
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
def split_data(data: pd.DataFrame, parameters: Dict) -> Tuple: | |
"""Splits data into features and targets training and test sets. | |
Args: | |
data: Data containing features and target. | |
parameters: Parameters defined in parameters.yml. | |
Returns: | |
Split data. | |
""" | |
X = data[parameters["features"]] |
NewerOlder