This commit is contained in:
Michael Zhang 2021-08-28 00:53:25 -05:00
commit 7efac2bbfa
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
13 changed files with 163 additions and 0 deletions

0
.gitignore vendored Normal file
View file

10
LICENSE.md Normal file
View file

@ -0,0 +1,10 @@
This project comes in two parts:
- Lesson material, which lives in `material`, licensed with [CC BY-SA 4.0][2].
- Source code, which is everything else in this repository, licensed with [GPL 3.0][1].
The full legal text of the license can be found in a file called LICENSE within
the respective directories.
[1]: https://www.gnu.org/licenses/quick-guide-gplv3.html
[2]: https://creativecommons.org/licenses/by-sa/4.0/

1
README.md Normal file
View file

@ -0,0 +1 @@
eduproj

41
flake.lock Normal file
View file

@ -0,0 +1,41 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1630125726,
"narHash": "sha256-STeKWv2RQCTwA9FEAiGCcO9l+CiXhVuaTl1bz3mJRxw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "45131df1671d5886821908b5294f5fba5fb23fc7",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

14
flake.nix Normal file
View file

@ -0,0 +1,14 @@
{
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
flakePkgs = rec {
sm2 = pkgs.python39Packages.callPackage ./sm2 {};
};
in rec {
defaultPackage = packages.sm2;
packages = flake-utils.lib.flattenTree flakePkgs;
});
}

17
ideas.txt Normal file
View file

@ -0,0 +1,17 @@
concepts:
- learning targets
- can relate to other concepts in the following ways:
- concept A "depends" on concept B; explaining concept A requires some information from concept B
- concept A "optdepends" on concept B
- concept A "satisfies" concept B; mastery of concept A implies mastery of concept B
topics:
- groups of concepts
- can nest infinitely
"reviews" are randomly constructed sets of activities
each user has a mastery level for each concept
references:
- super memo algorithm used by anki: https://en.wikipedia.org/wiki/SuperMemo#Description_of_SM-2_algorithm

10
material/proof.rst Normal file
View file

@ -0,0 +1,10 @@
.. TODO: split out into math proofs and formal proofs
:title: Proof
:subtopics:
- induction
:summary:
Proofs are arguments that present evidence that constructs an argument.

1
result Symbolic link
View file

@ -0,0 +1 @@
/nix/store/gqxdrhrrpjadp664vj934mj5nhzk7y9f-sm2

19
sm2/default.nix Normal file
View file

@ -0,0 +1,19 @@
{ buildPythonApplication, nix-gitignore, python, mypy }:
let
pythonBuildInputs = [ ];
pythonWithBuildInputs = python.withPackages (_: pythonBuildInputs);
in
buildPythonApplication {
name = "sm2";
src = nix-gitignore.gitignoreSourcePure [ ../.gitignore ] ./.;
doCheck = true;
checkInputs = [ mypy ];
checkPhase = ''
${mypy}/bin/mypy --no-color-output \
--package sm2 \
--python-executable ${pythonWithBuildInputs}/bin/python \
--strict
'';
}

1
sm2/pyproject.toml Normal file
View file

@ -0,0 +1 @@
[build-system]

6
sm2/setup.py Normal file
View file

@ -0,0 +1,6 @@
from setuptools import setup
setup(
name = "sm2",
packages = ["sm2"],
)

0
sm2/sm2/__init__.py Normal file
View file

43
sm2/sm2/sm2.py Normal file
View file

@ -0,0 +1,43 @@
from typing import Tuple
def sm2_algo(
user_grade: int,
n: int,
ef: float,
i: int,
) -> Tuple[int, float, int]:
"""
From https://en.wikipedia.org/wiki/SuperMemo#Description_of_SM-2_algorithm
n: repetition number, how many times a number was repeated
ef: easiness-factor, how quickly the interval grows
i: interval (in days)
returns the updated version of these values
"""
# grade >= 3 means the response was correct
if user_grade >= 3:
# update the number of days until the next review
# increases exponentially starting with 1 day and 6 days
if n == 0:
i = 1
elif n == 1:
i = 6
else:
i = round(i * ef)
# increment the number of days
n += 1
# incorrect
else:
n = 0
i = 1
inv_grade = 5 - user_grade
ef = ef + (0.1 - inv_grade * (0.08 + inv_grade * 0.02))
if ef < 1.3:
ef = 1.3
return (n, ef, i)