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

Expt/siblings #142

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix wrong feature order
  • Loading branch information
L-M-Sherlock committed Dec 25, 2024
commit e22b5590d068d3ab964d6623a39dd0247fa5505f
9 changes: 5 additions & 4 deletions other.py
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ def iter(
def pretrain(self, train_set):
delta_t_col = "delta_t" if not SIBLINGS else "elapsed_days"
S0_dataset_group = (
train_set[train_set["j"] == 2]
train_set[train_set["i"] == 2]
.groupby(by=["first_rating", delta_t_col], group_keys=False)
.agg({"y": ["mean", "count"]})
.reset_index()
@@ -843,11 +843,12 @@ def step(self, X: Tensor, state: Tensor) -> Tensor:
self.w[19] * new_s + (1 - self.w[19]) * state[:, 0],
new_s,
)
new_d = self.next_d(state, X[:, 1])
new_d = torch.where(
is_sibling_review,
self.w[20] * self.next_d(state, X[:, 1])
self.w[20] * new_d
+ (1 - self.w[20]) * state[:, 1],
self.next_d(state, X[:, 1]),
new_d,
)
new_d = new_d.clamp(1, 10)
new_s = new_s.clamp(S_MIN, 36500)
@@ -2203,8 +2204,8 @@ def create_siblings_features(dataset):
df["tensor"] = df.apply(
lambda x: torch.tensor(
(
tuple(map(int, x["n_r_history"].split(","))),
tuple(map(int, x["n_t_history"].split(","))),
tuple(map(int, x["n_r_history"].split(","))),
tuple(map(int, x["is_sibling_history"].split(","))),
),
dtype=torch.float32,