Using AI to help write SDQL

97 views
Skip to first unread message

A B

unread,
Jun 17, 2024, 11:06:41 PM6/17/24
to SportsDataBase
Folks,
I was curious to see how well AI (Chat gpt) could handle, me inputing a plain English trend. and asking it to convert that to proper sdql. It did a pretty decent job.

Here is what I typed exactly into perplexity.ai  :
" Using the directions on how to write sdql found here: https://killersports.com/query?filter=MLB and here https://sdql.com/ and here https://groups.google.com/g/SportsDataBase , could you please write this MLB system from plain english to sdql: Play Against - Play On - Any team (PHILADELPHIA) - very good offensive team (>=5.0 runs/game) against an average starter (ERA= 4.20 to 5.20)-NL, with a slugging percentage of .390 or worse over their last 20 games "
-----------------------------
It replied:

Answer
To translate the given MLB system from plain English to SDQL, we need to break down the conditions and parameters specified:
  1. Play Against: This indicates the team we are betting against.
  2. Play On: This indicates the team we are betting on.
  3. Any team (PHILADELPHIA): The team we are focusing on is Philadelphia.
  4. Very good offensive team (>=5.0 runs/game): The opposing team must have an average of 5 or more runs per game.
  5. Against an average starter (ERA= 4.20 to 5.20): The opposing team's starting pitcher must have an ERA between 4.20 and 5.20.
  6. NL: The game must be in the National League.
  7. With a slugging percentage of .390 or worse over their last 20 games: The opposing team must have a slugging percentage of .390 or lower in their last 20 games.
Here is the SDQL query that captures all these conditions:
sdql
team != 'PHI' and o:team = 'PHI' and o:runs >= 5 and starter:ERA >= 4.20 and starter:ERA <= 5.20 and league = 'NL' and o:SLG(last 20 games) <= .390
Explanation of the SDQL query:
  • team != 'PHI': We are playing against teams that are not Philadelphia.
  • o:team = 'PHI': The opponent is Philadelphia.
  • o:runs >= 5: The opponent (Philadelphia) has an average of 5 or more runs per game.
  • starter:ERA >= 4.20 and starter:ERA <= 5.20: The starting pitcher's ERA is between 4.20 and 5.20.
  • league = 'NL': The game is in the National League.
  • o:SLG(last 20 games) <= .390: The opponent's slugging percentage over the last 20 games is .390 or worse.
This query should provide the desired data based on the specified conditions.

John Ryan

unread,
Jun 18, 2024, 7:08:10 AM6/18/24
to sportsd...@googlegroups.com
That is interesting, no doubt, but to my knowledge there is no shortcut for slugging percentage (SLG). It would be great if we did have someone create a shortcut for SLG and OPS and OPS+   along with FIP too.   Anyway, if you copy and paste the SDQL it will not work and wondering if the AI can be trained first to know that SLG is a formula and starter ERA is a formula. etc. 

--
You received this message because you are subscribed to the Google Groups "SportsDataBase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sportsdatabas...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sportsdatabase/f796a7ed-6381-40a5-920a-b705106a5782n%40googlegroups.com.

Nic Feliccia

unread,
Jun 19, 2024, 1:21:02 PM6/19/24
to sportsd...@googlegroups.com
TO my knowledge chat GPT doesn't use Retrieval Augmented Generation ; meaning it doesn't read instructions.  But apparently Perplexity does. 

I used a model tuning approach with chat GPT 3.5. 

From: sportsd...@googlegroups.com <sportsd...@googlegroups.com> on behalf of A B <ther...@gmail.com>
Sent: Monday, June 17, 2024 4:07 PM
To: SportsDataBase <sportsd...@googlegroups.com>
Subject: Using AI to help write SDQL
 
--
Reply all
Reply to author
Forward
0 new messages