microsoft / lida

Automatic Generation of Visualizations and Infographics using Large Language Models
https://microsoft.github.io/lida/
MIT License
2.6k stars 266 forks source link

tutorial notebook issue #33

Closed Vieufoux closed 9 months ago

Vieufoux commented 10 months ago

I want to learn how to use lida, so I ran the tutorial jupyter notebook, when I ran the command

i = 0
library = "seaborn"
textgen_config = TextGenerationConfig(n=1, temperature=0.2, use_cache=True)
charts = lida.visualize(summary=summary, goal=goals[i], textgen_config=textgen_config, library=library)
# plot raster image of chart
plot_raster(charts[0].raster) 

I got the below issue:

Use the code template below 

import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
<imports>
# solution plan
# i.  ..
def plot(data: pd.DataFrame):

    # ii. convert Retail_Price and Dealer_Cost to log scale
    data['Retail_Price_log'] = data['Retail_Price'].apply(lambda x: np.log(x))
    data['Dealer_Cost_log'] = data['Dealer_Cost'].apply(lambda x: np.log(x))

    # iii. plot the distribution of Retail_Price and Dealer_Cost
    plt.figure(figsize=(10, 6))
    sns.histplot(data=data, x='Retail_Price_log', color='red', alpha=0.5, label='Retail_Price')
    sns.histplot(data=data, x='Dealer_Cost_log', color='blue', alpha=0.5, label='Dealer_Cost')
    plt.xlabel('Log Scale')
    plt.ylabel('Frequency')
    plt.legend()
    plt.title('What is the distribution of Retail_Price and Dealer_Cost?', wrap=True)
    return plt;

chart = plot(data) # data already contains the data to be plotted. Always include this line. No additional code beyond this line.. DO NOT modify the rest of the code template.
****
 name 'np' is not defined
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/tmp/ipykernel_1490/2717688829.py in <module>
      4 charts = lida.visualize(summary=summary, goal=goals[i], textgen_config=textgen_config, library=library)
      5 # plot raster image of chart
----> 6 plot_raster(charts[0].raster)

IndexError: list index out of range
victordibia commented 10 months ago

Hi, What model are you using? In general, gpt3.5/gpt4 models work best with lida.

okoliechykwuka commented 5 months ago

I had the same error while using gpt 3.5 and it only occur when using `libary="seaborn"