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

how to input data from obsidian-spaced-repetition-recall, ob-revlog.csv, into optimizer #13

Closed
dryezl opened this issue Aug 2, 2023 · 26 comments · Fixed by #18
Closed

Comments

@dryezl
Copy link

dryezl commented Aug 2, 2023

I tried to input the data from obsidian-spaced-repetition-recall, ob-revlog.csv, into optimizer in the colab. I could not find the right method for the data, ob-revlog.csv.

Thank @L-M-Sherlock and @Newdea for your help. Based on the answer below, the solution are as followed:

  1. Ensure the version of obsidian-spaced-repetition-recall >= 1.10.1.6
  2. Only those records with the first review state as 0 (new) would be included.
  3. download fsrs-optimizer and optimizer
# bash
python -m pip install fsrs-optimizer
python -m fsrs_optimizer /path/to/ob_revlog.csv -y

NB:
If the number of valid records is too small (<100), the program would crash.

@L-M-Sherlock
Copy link
Member

Could you share the ob-revlog.csv with me? I haven't implement the method because I don't have sample to test it.

@dryezl
Copy link
Author

dryezl commented Aug 2, 2023

ob_revlog.csv
Yes, this is my data. Thanks for your help.

@L-M-Sherlock
Copy link
Member

@Newdea 表头好像不太对。应该是 card_id, review_time, review_rating, review_state, review_duration 才对。

@dryezl
Copy link
Author

dryezl commented Aug 2, 2023

可能只是表头生成出问题的。数据按照分隔符(,)还是有五行的。读取数据的时候,可以考虑把表头忽略掉,重新赋值。

@Newdea
Copy link

Newdea commented Aug 4, 2023

ob_revlog.csv Yes, this is my data. Thanks for your help.

这个表格是更新插件前的旧表,需要更新到最新的插件,把旧表删除,再复习的时候就按新表头保存了

@dryezl
Copy link
Author

dryezl commented Aug 4, 2023

ob_revlog.csv Yes, this is my data. Thanks for your help.

这个表格是更新插件前的旧表,需要更新到最新的插件,把旧表删除,再复习的时候就按新表头保存了

请问是只删除这个ob_revlog.csv吗?另外的tracked_files.json不需要处理(别删!若删除的话,所有记录都会消失的)。

安装新插件(https://github.com/open-spaced-repetition/obsidian-spaced-repetition-recall/releases/ ;V4),将新的三个文件覆盖原来的文件。
我重新进行复习之后,现在没有ob_revlog.csv输出的。

@Newdea
Copy link

Newdea commented Aug 4, 2023

我晚上看下,可能是个bug

@Newdea
Copy link

Newdea commented Aug 5, 2023

问题已经修复了,现在可以正常输出到日志文件了

https://github.com/open-spaced-repetition/obsidian-spaced-repetition-recall/releases/tag/1.10.1.6

@dryezl
Copy link
Author

dryezl commented Aug 5, 2023

ob_revlog.csv
这是新生成的数据文件,表头是没有问题的。
谢谢@Newdea

@L-M-Sherlock
Copy link
Member

image

@Newdea, 感觉有点奇怪,为什么每张卡片的第一次学习的 review_state 都是 2,不是 0?

@Newdea
Copy link

Newdea commented Aug 7, 2023

他已经复习过多次,而之前的数据没有记录上

@L-M-Sherlock
Copy link
Member

好的

@YIRU69
Copy link

YIRU69 commented Aug 8, 2023

所以到底怎么才能得到优化后的参数呢?

@L-M-Sherlock
Copy link
Member

目前数据不足,还无法测试。

@L-M-Sherlock
Copy link
Member

我先加入这个 feature 支持吧。

@L-M-Sherlock L-M-Sherlock linked a pull request Aug 8, 2023 that will close this issue
@L-M-Sherlock
Copy link
Member

先装一下 fsrs-optimizer

python -m pip install fsrs-optimizer

然后在你 ob_revlog.csv 的文件目录下,运行下面这个命令

python -m fsrs_optimizer "ob_revlog.csv"

就可以优化了。

@dryezl
Copy link
Author

dryezl commented Aug 9, 2023

我在google colab里面尝试上述方法,运行出错的。
输入文件是ob_revlog.csv
具体报错如下:
The defaults will switch to whatever you entered last.

Timezone list: https://gist.github.com/heyalexej/8bf688fd67d7199be4a1682b3eec7568
input used timezone : Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/dist-packages/fsrs_optimizer/main.py", line 177, in
process(filename)
File "/usr/local/lib/python3.10/dist-packages/fsrs_optimizer/main.py", line 52, in process
remembered_fallback_prompt("timezone", "used timezone")
File "/usr/local/lib/python3.10/dist-packages/fsrs_optimizer/main.py", line 46, in remembered_fallback_prompt
remembered_fallbacks[key] = prompt(f"input {pretty}", remembered_fallbacks[key])
File "/usr/local/lib/python3.10/dist-packages/fsrs_optimizer/main.py", line 16, in prompt
response = input(f"{msg} {default}: ")
EOFError: EOF when reading a line

CalledProcessError Traceback (most recent call last)
in <cell line: 1>()
----> 1 get_ipython().run_cell_magic('sh', '', 'python -m fsrs_optimizer "ob_revlog.csv"\n')

4 frames
/usr/local/lib/python3.10/dist-packages/google/colab/_shell.py in run_cell_magic(self, magic_name, line, cell)
332 if line and not cell:
333 cell = ' '
--> 334 return super().run_cell_magic(magic_name, line, cell)
335
336

/usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2471 with self.builtin_trap:
2472 args = (magic_arg_s, cell)
-> 2473 result = fn(*args, **kwargs)
2474 return result
2475

/usr/local/lib/python3.10/dist-packages/IPython/core/magics/script.py in named_script_magic(line, cell)
140 else:
141 line = script
--> 142 return self.shebang(line, cell)
143
144 # write a basic docstring:

in shebang(self, line, cell)

/usr/local/lib/python3.10/dist-packages/IPython/core/magic.py in (f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):

/usr/local/lib/python3.10/dist-packages/IPython/core/magics/script.py in shebang(self, line, cell)
243 sys.stderr.flush()
244 if args.raise_error and p.returncode!=0:
--> 245 raise CalledProcessError(p.returncode, cell, output=out, stderr=err)
246
247 def _run_script(self, p, cell, to_close):

CalledProcessError: Command 'b'python -m fsrs_optimizer "ob_revlog.csv"\n'' returned non-zero exit status 1.

@L-M-Sherlock
Copy link
Member

L-M-Sherlock commented Aug 9, 2023

优化器使用过程中需要通过交互输入参数。CLI 的维护者应该没在 Colab 上测过,没有做适配。

python -m fsrs_optimizer "revlog.csv" -y

后面接个 -y 就可以跳过输入参数,直接用默认配置。

@L-M-Sherlock
Copy link
Member

image

@dryezl
Copy link
Author

dryezl commented Aug 9, 2023

加上参数"-y"仍然报错的,可能是输入文件的问题。
运行代码
请问你可不可以帮忙看一下这个文件ob_revlog.csv为什么会出错呢?

@L-M-Sherlock
Copy link
Member

我在本地测试了一下,发现只有一条有效数据,数据不够优化,就报错了。

@dryezl
Copy link
Author

dryezl commented Aug 9, 2023

谢谢。请问数据是否有效的判断标准是?

@L-M-Sherlock
Copy link
Member

每张卡片的复习数据的第一条的review_state是否为0

@dryezl
Copy link
Author

dryezl commented Aug 9, 2023

不好意思,加一个问题。请问一般需要多少条有效数据才能进行优化呢?

@L-M-Sherlock
Copy link
Member

不好意思,加一个问题。请问一般需要多少条有效数据才能进行优化呢?

一般来说至少需要 100 条

@dryezl
Copy link
Author

dryezl commented Aug 9, 2023

谢谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants