Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies versions and readme #6

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
prerelease: false
enable-pep582: false
cache: true
- name: Install dependencies
run: pdm sync -G :all
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Dunning–Kruger effect suggests that people with low competence in a domain

## Try the live demo

Experience the simulation firsthand. Visit the app hosted on Streamlit Community Cloud: [Random number simulation of the Dunning and Kruger experiments](https://dunning-kruger.streamlit.app).
Visit the app hosted on Streamlit Community Cloud: [Random number simulation of the Dunning and Kruger experiments](https://dunning-kruger.streamlit.app).

## Try it locally

Expand Down
26 changes: 14 additions & 12 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
QUARTILES = ("bottom", "2nd", "3rd", "top")


def percentile(x: npt.NDArray[np.float_]) -> npt.NDArray[np.int_]:
def percentile(x: npt.NDArray[np.float64]) -> npt.NDArray[np.int64]:
return x.argsort().argsort() * 100 // len(x)

def generate_data(
Expand Down Expand Up @@ -56,8 +56,8 @@ def generate_data(

def create_point_chart(data: pl.DataFrame, x: str, y: str) -> alt.Chart:
return alt.Chart(data).mark_point().encode(
alt.X(f"{x}:Q").title(x.replace("_", " ")),
alt.Y(f"{y}:Q").title(y.replace("_", " ")),
alt.X(f"{x}:Q").title(x.replace("_", " ")), # type: ignore
alt.Y(f"{y}:Q").title(y.replace("_", " ")), # type: ignore
)


Expand All @@ -70,21 +70,21 @@ def create_quartile_chart(data: pl.DataFrame, quartile_col: str) -> alt.Chart:
)
.group_by(quartile_col)
.mean()
.melt(id_vars=quartile_col, value_name="average")
.unpivot(index=quartile_col, value_name="average")
.pipe(alt.Chart)
.mark_line(point=True)
.encode(
alt.Color("variable:N")
.sort(("test score", "perceived ability"))
.sort(("test score", "perceived ability")) # type: ignore
.legend(orient="bottom-right")
.title(None),
alt.X(f"{quartile_col}:N")
.sort(QUARTILES)
.sort(QUARTILES) # type: ignore
.axis(labelAngle=0)
.title(quartile_col.replace("_", " ")),
alt.Y("average:Q")
.scale(domain=(0, 100))
.title("average percentile"),
.title("average percentile"), # type: ignore
)
)

Expand Down Expand Up @@ -152,11 +152,13 @@ def custom_theme() -> dict[str, Any]:
"""))

st.markdown(textwrap.dedent("""\
The Dunning–Kruger effect suggests that people with low competence in a domain\
often overestimate their abilities. But do the foundational experiments truly\
confirm this effect? This app offers a random number simulation challenging\
those original findings. For a deep dive into the topic, check out my blog post\
[Debunking the Dunning–Kruger effect with random number simulation](https://e10v.me/debunking-dunning-kruger-effect/).
The Dunning–Kruger effect is a cognitive bias wherein people with limited\
competence in a particular domain overestimate their abilities. It turns out\
that the Dunning and Kruger experiments do not prove that the effect is real.\
This app illustrates this using a random number simulation. The data generation\
process doesn't imply that "incompetent" participants overestimate their\
abilities. See more details in my blog post [Debunking the Dunning–Kruger\
effect with random number simulation](https://e10v.me/debunking-dunning-kruger-effect/).
"""))

st.header("Test score vs. perceived ability")
Expand Down
Loading