From 01073230ffe9e96a13ab9b889c7fb2a9aff694a9 Mon Sep 17 00:00:00 2001 From: akochari Date: Tue, 18 Jun 2024 10:33:01 +0200 Subject: [PATCH] more examples for data analysis and code generation --- FF2024/data_analysis.html | 32 +++++++++++++++++++++++++++++++- FF2024/data_analysis.qmd | 36 +++++++++++++++++++++++++++++++++++- FF2024/website.html | 10 ++++++++-- FF2024/website.qmd | 10 +++++++++- 4 files changed, 83 insertions(+), 5 deletions(-) diff --git a/FF2024/data_analysis.html b/FF2024/data_analysis.html index 018ae2d..fe166a4 100644 --- a/FF2024/data_analysis.html +++ b/FF2024/data_analysis.html @@ -84,7 +84,7 @@

LLM as a data analysis assistant

LLMs are able to analyse and provide answers based on tabular data. Some tools allow to upload a file (for example, in .txt, .csv, or excel format); in other cases we can insert the dataset as is into the chat window, and this will work reasonably well.

Once the data is uploaded, it is possible to ask general questions about the dataset, ask for numbers that can be found directly in some cell, questions that require manipulation and combination of data, ask for data visualisation, and in case you want something to work with further it is possible to ask for a reformatted dataset that you can copy and save into a file or to generate code to analyse or visualize the dataset.

-

Below are suggestions for some of the interactions that you can have with an LLM using an example dataset. We will use the dataset on population of Sweden between 1749 and 2023 provided by Statistics Sweden (Statistiska centralbyrån).

+

Below are suggestions for some of the interactions that you can have with an LLM using an example dataset. We will use the dataset on population of Sweden between 1749 and 2023 provided by Statistics Sweden (Statistiska centralbyrån).

Loading the dataset

As mentioned, some tools allow upload of files whereas others do not. For example, paid version of Microsoft Copilot and ChatGPT allow to upload file whereas free versions (for example free ChatGPT) often do not allow file upload. In case file upload is not allowed, you can simply select the text of the dataset on the webpage, copy it, and paste the data into the chat window. The spaces or other delimiters should be interpreted correctly by the LLMs in most cases.

@@ -158,6 +158,36 @@

When I select columns containing a space in the column names I see an error message. Correct the code to avoid this error.

+
+

Other examples of using LLMs for data analysis

+
+
Tables and plots
+
+
Generate a table of 5 columns with values in each column drawn from 5 different distributions.
+
+
+
Make a violin plot of the dataset.
+
+
+
Make a canvas with three subplots; a heatmap, a histogram and a scatterplot
+
+
+
+

Multivariate data

+
+
Create an excel spreadsheet with 100 rows and 5 columns, where each column has values drawn from a normal distribution with a random mean.
+
+
+
Include an extra column (Y) with either 1 or 2 as values.
+
+
+
Scale column 3 to unit variance make a violin plot of the data with a black and white color scheme Make a PCA-plot, color by the column Y.
+
+
+
Redo PCA with a red and blue color scheme.
+
+
+
diff --git a/FF2024/data_analysis.qmd b/FF2024/data_analysis.qmd index f5c914f..5c24a1d 100644 --- a/FF2024/data_analysis.qmd +++ b/FF2024/data_analysis.qmd @@ -13,7 +13,7 @@ LLMs are able to analyse and provide answers based on tabular data. Some tools a Once the data is uploaded, it is possible to ask general questions about the dataset, ask for numbers that can be found directly in some cell, questions that require manipulation and combination of data, ask for data visualisation, and in case you want something to work with further it is possible to ask for a reformatted dataset that you can copy and save into a file or to generate code to analyse or visualize the dataset. -Below are suggestions for some of the interactions that you can have with an LLM using an example dataset. We will use the dataset on population of Sweden between 1749 and 2023 provided by Statistics Sweden (Statistiska centralbyrån*)*. +Below are suggestions for some of the interactions that you can have with an LLM using an example dataset. We will use the dataset on population of Sweden between 1749 and 2023 provided by Statistics Sweden (Statistiska centralbyrån). ### Loading the dataset @@ -97,3 +97,37 @@ In this case the LLM is probably going to generate code for an R Shiny dashboard ```{R} When I select columns containing a space in the column names I see an error message. Correct the code to avoid this error. ``` + +### Other examples of using LLMs for data analysis + +##### **Tables and plots** + +```{R} +Generate a table of 5 columns with values in each column drawn from 5 different distributions. +``` + +```{R} +Make a violin plot of the dataset. +``` + +```{R} +Make a canvas with three subplots; a heatmap, a histogram and a scatterplot +``` + +#### **Multivariate data** + +```{R} +Create an excel spreadsheet with 100 rows and 5 columns, where each column has values drawn from a normal distribution with a random mean. +``` + +```{R} +Include an extra column (Y) with either 1 or 2 as values. +``` + +```{R} +Scale column 3 to unit variance make a violin plot of the data with a black and white color scheme Make a PCA-plot, color by the column Y. +``` + +```{R} +Redo PCA with a red and blue color scheme. +``` diff --git a/FF2024/website.html b/FF2024/website.html index f491aba..3f3ca19 100644 --- a/FF2024/website.html +++ b/FF2024/website.html @@ -160,8 +160,14 @@

Other ideas

🧙‍♂️🧙‍♀️ADVANCED Hosting the website

Once you generate your website code the next step is to host it. This is something that the LLM cannot do for you but it possible to ask an LLM to provide guidance in this process as well. It is likely to be especially useful to those who are new to website hosting since it can answer beginner questions and provide detailed instructions.

-
-

+
+

Other examples of prompts for website generation

+
+
Create a web page that asks for weight (kg) and height (cm) of a person and calculates BMI
+
+
+
Create a web page that asks for the radius of a sphere and calculates the volume
+
diff --git a/FF2024/website.qmd b/FF2024/website.qmd index 65b206d..dd99072 100644 --- a/FF2024/website.qmd +++ b/FF2024/website.qmd @@ -96,4 +96,12 @@ Here are some other interesting types of websites you might want to try to creat Once you generate your website code the next step is to host it. This is something that the LLM cannot do for you but it possible to ask an LLM to provide guidance in this process as well. It is likely to be especially useful to those who are new to website hosting since it can answer beginner questions and provide detailed instructions. -### +### Other examples of prompts for website generation + +```{R} +Create a web page that asks for weight (kg) and height (cm) of a person and calculates BMI +``` + +```{R} +Create a web page that asks for the radius of a sphere and calculates the volume +```