Skip to content

Instantly share code, notes, and snippets.

@gmelodie
Created December 19, 2022 19:16
Show Gist options
  • Save gmelodie/28bc1e1e2ef7cd700600db675b238b69 to your computer and use it in GitHub Desktop.
Save gmelodie/28bc1e1e2ef7cd700600db675b238b69 to your computer and use it in GitHub Desktop.
Estuary metrics graph experiment
import plotly.express as px
import pandas as pd
def variable_total_retrievals():
df = pd.DataFrame(columns=['Name', 'Total Retrievals', 'Success Rate', 'Reputation'])
points = 10_000
success_rates = 5
for total_retrievals in range(0, 100_000, 50):
for i in range(success_rates):
success_rate = (i+1)/success_rates
successful = success_rate*total_retrievals
metric1 = (total_retrievals + successful)*success_rate
new_row = [f"t*success_rate^2 {success_rate}%", total_retrievals, success_rate, metric1]
df.loc[len(df)] = new_row
print(total_retrievals)
return px.line(df, x="Total Retrievals", y="Reputation", color="Name", title="Retrieval Metrics")
def variable_success_rate():
df = pd.DataFrame(columns=['Name', 'Success Rate', 'Reputation'])
points = 10_000
total_retrievals = 10_000
for i in range(1000):
success_rate = i/1000
successful = total_retrievals*success_rate
metric1 = (total_retrievals+successful)*success_rate
new_row = ["(t+sucessful)*success_rate", success_rate, metric1]
metric2 = successful
new_row2 = ["successful", success_rate, metric2]
df.loc[len(df)] = new_row
df.loc[len(df)] = new_row2
print(success_rate)
return px.line(df, x="Success Rate", y="Reputation", color="Name", title="Retrieval Metrics")
# fig = variable_success_rate()
fig = variable_total_retrievals()
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment