Giter Site home page Giter Site logo

sm-15's People

Contributors

slaypni avatar yangchenyun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sm-15's Issues

Paid for Reverse Engineering SM-18

Hello Slaypni,

This is really amazing that seeing someone able to reverse engineering SM algo. Are you able to reverse engineering SM-18 algo? I am willing to pay for it. Please contact me on telegram at @habibi4898

Question about decay constant

Hi,
I am wondering how do you calculate the decay constant for a power approximation at L278?
I checked on wiki that only exponential function will have a decay constant, how do you approach to compute one for a fixed point power function?
Thanks again ๐Ÿ‘

Best,

Question about the initial forgetting curves

Hi @slaypni ,
Thanks for writing out this implementation, I have used it as a reference when I try to implement the algorithm.
There are several initial "tweaks" to make the algorithm work properly, such as AF range, REP range etc. I found your implementation follows the description quite well. But for the forgetting curve initialization, I cannot found any relevant description about supermemo site. The closet I could find is:

At the beginning of the learning process, there is no repetition history and no repetition data to compute R-Factors. It will take some time before your first forgetting curves are plotted. For that reason, the initial value of the RF matrix is taken from the model of a less-than-average student.

 I am curious about how you choose to setup that curve ?

Best,

Basic answering seems to lead to a compromised state

I'm using the algorithm as a backend to an application with about 5-6000 items in it. I've noticed on any item if I answer an item with values 5, then 0, then 5, the data in the algorithm gets into a state where any answer of 5 on any item results in a null value from OFM.of which then results in different NaN or null values and eventually results in the dueDate being "Invalid Date." There is seemingly no way to recover from this state.

Here is a video of my app showing the problem. In the lower right is the item.data() of the item being answered. "Remember" translates to an answer of 5 and "I don't know" translates to an answer of 0.
https://youtu.be/OdpKgqCOEFM

Here is the results of SM.data(), JSON.stringify-ed so you can try for yourself:
On first initializing the app, which just involves instantiation SM and adding each item using addItem. The value of the item is just an ID, since I'm just using sm.js as a backend: https://gist.github.com/meelash/7d9ef5c9cd5cf3743abcbc00ffbe0622
After answering with "5" to any random item (this is sm.data() but I deleted the .q array to make it more manageable): https://gist.github.com/meelash/119cf9deb2b33743ff0bb4d8742af1e3
After answering with "0" to that same item. At this point sm.js is in an unrecoverable broken state: https://gist.github.com/meelash/78189f7a9e26f632a11eabb3040716b7
Which becomes apparent after answering with "5" to that item or any other item: https://gist.github.com/meelash/df09618cdfebfa7623e106532f049a5e

I can supply these as the raw output as well, that has the quotation marks escaped.
Any help or any clue in what could be going wrong or if I'm missing something in my usage would be highly appreciated.

Can't instantiate `SM`: undefined `points`

Trying to instantiate an SM produces a type error. For some reason, points is undefined.

C:\Users\shodan\Desktop>coffee --version
CoffeeScript version 2.7.0

C:\Users\shodan\Desktop>coffee supermemo.coffee
(a)add, (n)next, (N)next advanceably, (s)save, (l)load, (e)exit
TypeError: Cannot read properties of undefined (reading 'length')
    at exponentialRegression (C:\Users\shodan\Desktop\supermemo.coffee:314:14)
    at ForgettingCurve.uf (C:\Users\shodan\Desktop\supermemo.coffee:252:18)
    at RFM.rf (C:\Users\shodan\Desktop\supermemo.coffee:261:61)
    at OFM.<anonymous> (C:\Users\shodan\Desktop\supermemo.coffee:277:68)
    at OFM.<anonymous> (C:\Users\shodan\Desktop\supermemo.coffee:542:16)
    at OFM.update (C:\Users\shodan\Desktop\supermemo.coffee:277:12)
    at new OFM (C:\Users\shodan\Desktop\supermemo.coffee:272:6)
    at new SM (C:\Users\shodan\Desktop\supermemo.coffee:16:12)
    at main (C:\Users\shodan\Desktop\supermemo.coffee:443:8)
    at Object.<anonymous> (C:\Users\shodan\Desktop\supermemo.coffee:540:1)
    at Object.<anonymous> (C:\Users\shodan\Desktop\supermemo.coffee:5:4)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Object.CoffeeScript.run (C:\Users\shodan\AppData\Roaming\npm\node_modules\coffeescript\lib\coffeescript\index.js:67:23)
    at compileScript (C:\Users\shodan\AppData\Roaming\npm\node_modules\coffeescript\lib\coffeescript\command.js:285:29)
    at compilePath (C:\Users\shodan\AppData\Roaming\npm\node_modules\coffeescript\lib\coffeescript\command.js:237:14)
    at Object.exports.run (C:\Users\shodan\AppData\Roaming\npm\node_modules\coffeescript\lib\coffeescript\command.js:158:20)
    at Object.<anonymous> (C:\Users\shodan\AppData\Roaming\npm\node_modules\coffeescript\bin\coffee:22:45)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Function.Module._load (node:internal/modules/cjs/loader:972:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

OptimumInterval output is NaN value.

I want to use this project as a js library, but I found the output optimumInterval sometimes can be a NaN value:
When I put three review histories into it:
mark=5,date=now
mark=3,date=now+10days
mark=3,date=now+100days

the final optimumInterval will be a NaN value:

repetition:0,date:2021-01-01,mark:5,optimumInterval:4.0 hour

repetition:1,date:2021-01-11,mark:3,optimumInterval:59.2 days

repetition:2,date:2021-04-11,mark:3,optimumInterval:NaN days

code to reproduce this issue:


const sm_util = require("./sm.js")
const sm = new sm_util.SM()
const ONE_DAY = 24 * 3600 * 1000

function mytest() {
    const now = new Date().getTime()

    const item = sm.addItem("")

    answer_core(5, item, new Date(now))

    answer_core(3, item, new Date(now + ONE_DAY * 10))

    answer_core(3, item, new Date(now + ONE_DAY * 100))
}

function answer_core(mark, item, date) {
    sm.answer(mark, item, date)
    const data = item.data()
    const optimumInterval = format_interval(data["optimumInterval"])
    const repetition = data["repetition"]
    console.log(`repetition:${repetition},date:${formatDate(date)},mark:${mark},optimumInterval:${optimumInterval}`)
}

function format_interval(optimumInterval) {
    let days = optimumInterval / 24 / 3600 / 1000
    if (days < 1.0) {
        days = (optimumInterval / 1000 / 3600).toFixed(1) + " hour"
    } else {
        days = days.toFixed(1) + " days"
    }
    return days
}

function formatDate(date) {
    var d = new Date(date),
        month = '' + (d.getMonth() + 1),
        day = '' + d.getDate(),
        year = d.getFullYear();

    if (month.length < 2)
        month = '0' + month;
    if (day.length < 2)
        day = '0' + day;

    return [year, month, day].join('-');
}

mytest()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.