forked from bigdata-ustc/EduCAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffe6042
commit 74b0d44
Showing
40 changed files
with
370 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
CAT/cognitive_structure/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
CAT/cognitive_structure/__pycache__/structure.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
get theta ,get a b, [theta][alpha,beta] | ||
compute MFI by getMFI top-k | ||
compute by dot production | ||
conpute loss | ||
""" | ||
from CAT.distillation.model import dMFIModel | ||
from CAT.distillation.tool import transform,split_data | ||
import torch | ||
import json | ||
dataset='assistment' | ||
cdm='irt' | ||
stg='KLI' | ||
trait = json.load(open(f'/data/yutingh/CAT/data/{dataset}/{stg}/trait.json', 'r')) | ||
utrait = trait['user'] | ||
itrait = trait['item'] | ||
# print(utrait,itrait) | ||
label = trait['label'] | ||
k_info = trait['k_info'] | ||
if stg=='KLI': | ||
tested_info= trait['tested_info'] | ||
train_data, test_data = split_data(utrait,label,k_info,0.8,tested_info) | ||
else: | ||
train_data, test_data = split_data(utrait,label,k_info,0.8) | ||
|
||
torch.manual_seed(0) | ||
train_set = transform(itrait,*train_data) | ||
test_set = transform(itrait,*test_data) | ||
k=50 | ||
embedding_dim=15 | ||
lr=0.005 if dataset=='assistment' else 0.01 | ||
print(f'lr: {lr}') | ||
user_dim=2 if stg =='KLI'else 1 | ||
dMFI = dMFIModel(k,embedding_dim,user_dim,device='cuda:4') | ||
dMFI.train(train_set,test_set,itrait,epoch=30,lr=lr) | ||
dMFI.save(f'/data/yutingh/CAT/ckpt/{dataset}/{cdm}_{stg}_ip.pt') | ||
|
||
|
||
|
||
|
Binary file not shown.
Oops, something went wrong.