Thursday 20 July 2023

ChatGPT, Data Scientist


ChatGPT (with a plus account) have launched an application in BETA to try - Code Interpreter that can be used to produce the start of of an analysis of data. Producing Python code for the analysis  - Pandas based.




Prompt 1

So load in a file of COVID data from 2021 and type in the prompt "Acts as a data scientist and analze the datashet amd make charts and graphs to show major trends" Even with the spelling mistakes it did the following: 

 

Acts as a data scientist and analze the datashet amd make charts and graphs to show major trends

covid_1.csv

ChatGPT

Great, let's start by loading the dataset and examining its structure.

Finished working

Show work

It seems like the dataset does not have any column names. The dataset consists of three columns. Could you please provide some context about what these columns represent? This will help me to analyze the data more accurately.



Prompt 2

Follow-up prompt "first column is days, the second is group under 35 years old and third colum is a group over 35 years old"

first column is days, the second is group under 35 years old and third colum is a group over 35 years old

ChatGPT

Thank you for the clarification. Let's assign appropriate column names and take a look at some basic statistics of the data.

Finished working

RESULT

              Day  Group_Under_35  Group_Over_35

count  158.000000      158.000000     158.000000

mean    80.500000        0.009439       0.012779

std     45.754781        0.005514       0.007603

min      2.000000        0.000696       0.000414

25%     41.250000        0.005688       0.007028

50%     80.500000        0.008524       0.012666

75%    119.750000        0.013676       0.018399

max    159.000000        0.019054       0.026756

The dataset contains 158 records, spanning from day 2 to day 159.

Here are some basic statistics for each column:

  • Group_Under_35: The average is around 0.0094, with a minimum value of 0.0007 and a maximum value of 0.0190. The data varies around this average by about 0.0055 (standard deviation).
  • Group_Over_35: The average is around 0.0128, with a minimum value of 0.0004 and a maximum value of 0.0268. The data varies around this average by about 0.0076 (standard deviation).

Now, let's create some plots to visualize these trends. We'll make line plots for each group over the given days. This can give us a sense of how the values change over time for each age group.

Finished working




The line graph provides a visual representation of the trend in the dataset for both groups. From the graph, we can observe that:

  • For both groups, the trend is generally increasing over time, suggesting that the value for both groups under 35 and over 35 grows as days pass.
  • The 'Group Over 35' consistently has higher values than the 'Group Under 35'. This could suggest that the factor being measured impacts the 'Group Over 35' more significantly, or it could mean that there are more people in the 'Group Over 35'.

Remember, the precise interpretation would depend on what these values represent. For a more in-depth analysis, one could also look into statistical tests, correlation analysis, and more.

Do you have any specific questions or areas you'd like to explore in this data?

 

Thoughts

I haven't included the code here but it produced the code you would expect using Pandas in Python to perform basic analysis - all with two prompts. Not bad, need to explore it further. A more detailed introduction can be found at ChatGPT’s Code Interpreter Was Just Released. Here’s How It Will Change Data Science Forever.” by The PyCoach
link.medium.com/LSxLIoY8pBb


All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Monday 3 July 2023

The 5 most read blog posts June 2023



All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Wednesday 31 May 2023

Popular posts May 2023

Top locations









All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Monday 29 May 2023

Batmobile and micropython: first play

How do you fancy, building and programming a Batmobile? A recently fulfilled Kickstarter project from Circuitmess allows just that https://circuitmess.com/products/batmobile;an autonomous 'car' kit, programmable and controlled through a separate controller. It can also be programmed through their  CircuitBlocks environment based on MakeCode and Blockly - this approach is the starting point for this first play.


There is not going to be discussion on the building of the controller and the batmobile, in this post; Circuitmess have provided detailed instructions here: https://circuitmess.com/blogs/resources/batmobile-build-guide 


Below is a video showing it off a bit and some of the functions produced by the manufacturers.


The video largely shows going through the controller to interact with the Batmobile. You can as well start coding through https://code.circuitmess.com/ the Circuitmess coding app mentioned earlier, and choose a sketch. The controller and batmobile can be programmed separately (see examples below) 




Just to start off, I choose a sketch to play with the front lights, back lights and underlights, essentially turning them off and on.


You will need to install micropython, but you get prompted and following the onscreen instructions it is easily done.

Using the Makecode/sketch provided, added a few missing under light (shines under the car) RGB values to enable a quick play. First set of RGB gives a reddy-pink colour and then changes to green. You code in the block code, and it gives the micropython code. Both are shown below.



It starts moving, then turns on the front lights and then off, then the back light on and off, and then the under lights.

Nice kit and there are various optional extras that can going with it - see https://circuitmess.com/products/batmobile and the shop through Buy Now halfway down the webpage. Including extension circuits that plug into the controller. I will explore more.


All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Saturday 13 May 2023

Programming Robots Virtually 4: Preview of Edbot Studio

In previous post I looked at a few on-line robot simulators (see links below)

A recent addition to these is the Edbot Studio Virtual Playground https://studio.ed.bot/;  a preview of simulation technology for Robots in Schools Ltd Edbot robots. 

Two Edbot robots are shown in a gym; you can select actions for the robots to carry out, including Gangam-style dancing and Head Stands.







This is really a preview of the tech, rather than a programming option - at the moment. Robots in Schools Ltd, who make the Edbots, say the Virtual Playground will be part of their Edbot Studio a browser-based Environment to allow both coding in Scratch, Python and JavaScript, of both virtual and real robots.

I am really curious to see the full Edbot Studio in action when it is released, but for the moment getting virtual robots to dance and kick is still really good fun.


The physical robots -EdBot are available from https://ed.bot/







All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Friday 31 December 2021

Top 10 viewed posts 2021 on the Robot and Physical Computing Blog








All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Sunday 26 December 2021

Hug Avoider 4 - micropython, Eggbot and speech

The last of the posts on the Hug avoider and the 4Tronix's Eggbit



4Tronix's Eggbit (in fact I bought three of them https://shop.4tronix.co.uk/collections/bbc-micro-bit/products/eggbit-three-pack-special  :-) recently) is a cute add-on for the microbit. In three previous posts I looked at eggbit using microcode to  produce a hug avoider - warns when people at too close.



In this post using the buttons and adding (via Microbit V2 with its speaker) simple speech


1. Buttons

Pins for the buttons
  • pin8 - Green button
  • pin12 - Red button
  • pin14 - Yellow button
  • pin`6 - Blue button

    if pin12.read_digital()==1:
        #Red Button
        blank_it()
    if pin8.read_digital()==1:
        #Green button
        startingMessage()
    if pin14.read_digital()==1:
        #Yellow button
        rainbow()
    if pin16.read_digital()==1:
        #Blue botton
        display.show(Image.ASLEEP)

2. Speech


    mess1 = [
    "This is the hug avoide",
    "please keep back",
]
# Take from https://microbit-micropython.readthedocs.io/en/latest/tutorials/speech.html
    for line in mess1:
        speech.say(line, speed=120, pitch=100, throat=100, mouth=200)
        sleep(500


The speech is difficult to hear but is fun and there are possibly ways to improve this starting with the information on  https://microbit-micropython.readthedocs.io/en/latest/tutorials/speech.html



3. Overall

from microbit import *
from machine import time_pulse_us
import neopixel, speech

sonar =pin15
sonar.write_digital(0)
fireled=neopixel.NeoPixel(pin13,9)

def rainbow():
    fireled[0] = (255, 0, 40)
    fireled[1]=  (255,165,0)
    #block=yellow
    fireled[2] = (255,255,0)
    #block=green
    fireled[3] = (0,255,0)
    #block=blue
    fireled [4] = (0,0,255)
    # block=indigo
    fireled[5] = (75,0,130)
    # block=violet
    fireled[6] = (138,43,178)
    #block=purple
    fireled[7] = (255,0,255)
    fireled.show()

def blank_it():
    for j in range(8):
        fireled[j] = (63, 0, 0)
    fireled.show()

def howfar():
    sonar.write_digital(1)
    sonar.write_digital(0)

    timeus=time_pulse_us(sonar,1)
    echo=timeus/1000000
    dist=(echo/2)*34300
    sleep(100)
    return dist

def startingMessage():
    mess1 = [
    "This is the hug avoide",
    "please keep back",
]
# Take from https://microbit-micropython.readthedocs.io/en/latest/tutorials/speech.html
    for line in mess1:
        speech.say(line, speed=120, pitch=100, throat=100, mouth=200)
        sleep(500)

def buttonplay():
    if pin12.read_digital()==1:
        #Red Button
        blank_it()
    if pin8.read_digital()==1:
        #Green button
        startingMessage()
    if pin14.read_digital()==1:
        #Yellow button
        rainbow()
    if pin16.read_digital()==1:
        #Blue botton
        display.show(Image.ASLEEP)
  
while True:
    buttonplay()
    dist=howfar()
    if dist>30:
        pin2.write_digital(1)
        pin0.write_digital(0)
        display.show(Image.HAPPY)
    else:
        pin2.write_digital(1)
        pin0.write_digital(1)
        blank_it()
        speech.say("back away please", speed=120, pitch=100, throat=100, mouth=200)
        display.show(Image.ANGRY)




All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Top posts on this blog in March 2024

The Top 10 viewed post on this blog in March 2024. Covering areas such as small robots, augmented reality, Scratch programming, robots. Micr...