Skip to content

Commit

Permalink
updated docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
djl11 committed Feb 22, 2025
1 parent d865123 commit 4c6f136
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
10 changes: 10 additions & 0 deletions demo_testing/derived_entry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import unify
import random

unify.activate("derived_entry")

for _ in range(20):
unify.log(
x=random.random(),
y=random.random()
)
19 changes: 19 additions & 0 deletions demo_testing/gender_loc_salary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import unify
unify.activate("gender_loc_salary")
import random

gender_factors = {"male": 1500, "female": 750}
loc_offsets = {"UK": 15000, "US": 45000}
for gender in ["male", "female"]:
for loc in ["UK", "US"]:
for age in range(20, 55):
unify.log(
gender=gender,
nationality=loc,
age=age,
salary=(
age*500 +
age*gender_factors[gender]*random.random() +
loc_offsets[loc]*random.random()
),
)
20 changes: 20 additions & 0 deletions demo_testing/histogram_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import unify
unify.activate("histogram-demo", overwrite=True)
import random
from datetime import date

n = 10
for month in range(1, 13):
num_queries = random.randint(month*n, (month+10)*n)
print(f"creating logs for {month} with {num_queries} queries... ")
unify.create_logs(
entries=[
{
"date": date(
2025, month, random.randint(1, 28)
).isoformat()
}
for _ in range(num_queries)
]
)
print(f"created {num_queries} logs for {month}")
10 changes: 7 additions & 3 deletions interfaces/plots.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,23 @@ For example, let's say we want to see the distribution of user traffic over the
Has our product been gaining traction?

```python
n = 1000
n = 10
for month in range(1, 13):
num_queries = random.randint(month*n, (month+10)*n)
unify.create_logs(
entries=[
{"date": f"{random.randint(1, 28)}/{month}/2024"}
{
"date": date(
2025, month, random.randint(1, 28)
).isoformat()
}
for _ in range(num_queries)
]
)
```

Let's take a look at the corresponding histogram.

IMG
<img class="dark-light" width="100%" src="https://raw.githubusercontent.com/unifyai/unifyai.github.io/refs/heads/main/img/externally_linked/histogram_dark.gif"/>

We can see that the usage has been steadily increasing throughout the year, good stuff! 📈

0 comments on commit 4c6f136

Please sign in to comment.