Skip to content

Instantly share code, notes, and snippets.

@miahj1
Created June 12, 2023 21:56
Show Gist options
  • Save miahj1/1ac99b10dae956acdd5616bb53d08921 to your computer and use it in GitHub Desktop.
Save miahj1/1ac99b10dae956acdd5616bb53d08921 to your computer and use it in GitHub Desktop.
Chatgpt prompts for insurance fraud classification project.

I took all the unique values out of the incident_state column and then used boolean logic via a for loop to print a sum of all the incidents for each state.

πŸ§‘ Prompt

Add all the numbers from this data:
"SC: 248
VA: 110
NY: 262
OH: 23
WV: 217
NC: 110
PA: 30
"

πŸ€– Chatgpt

To add all the numbers from the given data, simply sum up the values provided:

248 + 110 + 262 + 23 + 217 + 110 + 30 = 1000

The sum of all the numbers is 1000.

You can see the python code for the prompt's data as mentioned before below.

# States where incidents occured.
incident_states = insurance_claims_df['incident_state'].unique()

for state in incident_states:
  print(f"{state}: {((insurance_claims_df['incident_state'] == state)).sum()}")

Let's now use chatgpt to make the percentages values needed for the visualization.

πŸ§‘ Prompt

Now, repost the data but divide each number by 1000 and then format them in percents
so the data would look like this
State:Percent%

πŸ€– Chatgpt

Sure! Here's the data with each number divided by 1000 and formatted as percentages:

SC: 24.8%
VA: 11.0%
NY: 26.2%
OH: 2.3%
WV: 21.7%
NC: 11.0%
PA: 3.0%

The output format isn't very useful right now, so I had chatgpt format it for me.

πŸ§‘ Prompt

Give me all the percents in a line separated by a comma and space so
%, % . . .

πŸ€– Chatgpt

Certainly! Here are all the percents separated by a comma and space:

24.8%, 11.0%, 26.2%, 2.3%, 21.7%, 11.0%, 3.0%

It's still not the format we want, do better chatgpt!

πŸ§‘ Prompt

Send it again but without the percentage symbol

πŸ€– Chatgpt

Apologies for the confusion. Here are all the percents without the percentage symbol, separated by a comma and space:

24.8, 11.0, 26.2, 2.3, 21.7, 11.0, 3.0

We also have to check if what chatgpt gives us is correct. Let's have it add up all the percentages to see if the total is 100%.

πŸ§‘ Prompt

Add all the percentages.

πŸ€– Chatgpt

To add all the percentages, we need to convert them back to decimal form, add them up, and then convert the sum back to a percentage.

24.8% + 11.0% + 26.2% + 2.3% + 21.7% + 11.0% + 3.0%

Converting to decimal form:

0.248 + 0.110 + 0.262 + 0.023 + 0.217 + 0.110 + 0.030

Summing up the decimals:

0.248 + 0.110 + 0.262 + 0.023 + 0.217 + 0.110 + 0.030 = 1.000

Converting back to a percentage:

1.000 * 100% = 100%

The sum of all the percentages is 100%.

It looks like everything is done correctly; we can thank chatgpt for being able to check itself--at times it does this incorrectly. Just in case, I have double checked all its output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment