Coder Social home page Coder Social logo

Comments (15)

L-M-Sherlock avatar L-M-Sherlock commented on June 11, 2024 1

@asukaminato0721 and I will deal with it.

from fsrs-rs.

L-M-Sherlock avatar L-M-Sherlock commented on June 11, 2024

I forget to remove outliers in the Rust optimizer:

        def remove_outliers(group: pd.DataFrame) -> pd.DataFrame:
            grouped_group = (
                group.groupby(by=["r_history", "delta_t"], group_keys=False)
                .agg({"y": ["mean", "count"]})
                .reset_index()
            )
            sort_index = grouped_group.sort_values(
                by=[("y", "count"), "delta_t"], ascending=[True, False]
            ).index

            total = sum(grouped_group[("y", "count")])
            has_been_removed = 0
            for i in sort_index:
                count = grouped_group.loc[i, ("y", "count")]
                if has_been_removed + count >= total * 0.05:
                    break
                has_been_removed += count
            group = group[
                group["delta_t"].isin(
                    grouped_group[grouped_group[("y", "count")] >= count]["delta_t"]
                )
            ]
            return group

        df[df["i"] == 2] = (
            df[df["i"] == 2]
            .groupby(by=["r_history", "t_history"], as_index=False, group_keys=False)
            .apply(remove_outliers)
        )
        df.dropna(inplace=True)

        def remove_non_continuous_rows(group):
            discontinuity = group["i"].diff().fillna(1).ne(1)
            if not discontinuity.any():
                return group
            else:
                first_non_continuous_index = discontinuity.idxmax()
                return group.loc[: first_non_continuous_index - 1]

        df = df.groupby("card_id", as_index=False, group_keys=False).progress_apply(
            remove_non_continuous_rows
        )

from fsrs-rs.

L-M-Sherlock avatar L-M-Sherlock commented on June 11, 2024

fsrs-rs:
image
fsrs-py:
image

from fsrs-rs.

L-M-Sherlock avatar L-M-Sherlock commented on June 11, 2024

To increase num_epochs could reduce the errors. But it also will slow down the the optimization.

from fsrs-rs.

L-M-Sherlock avatar L-M-Sherlock commented on June 11, 2024

The left is generated by Anki. The right is generated by python optimizer.

image

from fsrs-rs.

Expertium avatar Expertium commented on June 11, 2024

To increase num_epochs could reduce the errors. But it also will slow down the the optimization.

By the way, how many epochs does the optimizer in the beta version use? Also, does it use splits, with averaging of the parameters afterwards?
And I don't think that the optimization becoming 2 or even 3 times slower is that important. Currently, the optimizer is blazingly fast, and even on a large collection optimization takes a minute or so. I don't think users will be very upset if the optimization takes 2-3 minutes instead of 1 minute.

from fsrs-rs.

L-M-Sherlock avatar L-M-Sherlock commented on June 11, 2024

By the way, how many epochs does the optimizer in the beta version use? Also, does it use splits, with averaging of the parameters afterwards?

It uses 16 epochs and doesn't have splits because the framework doesn't support splits.

from fsrs-rs.

dae avatar dae commented on June 11, 2024

from fsrs-rs.

user1823 avatar user1823 commented on June 11, 2024

Why are we talking about num_epochs here? Wouldn't this problem be solved just by adding the outlier filter to the rust optimizer?

from fsrs-rs.

Expertium avatar Expertium commented on June 11, 2024

So the code related to removing outliers will be added in the next release?

from fsrs-rs.

L-M-Sherlock avatar L-M-Sherlock commented on June 11, 2024

I implement the outlier filter, but the first four weights are still very different from the Python optimizer. So it's not caused by outlier filter. By the way, I think the weights generated by the Python optimizer doesn't fit the forgetting curve well:

image

A smaller value of stability would be better:

image

Maybe RMSE is not a good loss function here. I plan to use log loss.

from fsrs-rs.

Expertium avatar Expertium commented on June 11, 2024

Maybe RMSE is not a good loss function here. I plan to use log loss.

I would recommend running the benchmark with both RMSE and logloss to determine whether there is a difference in the final RMSE.

from fsrs-rs.

user1823 avatar user1823 commented on June 11, 2024

I implement the outlier filter, but the first four weights are still very different from the Python optimizer. So it's not caused by outlier filter. By the way, I think the weights generated by the Python optimizer doesn't fit the forgetting curve well:

The supposed poor fitting of weights produced by the Python optimizer is definitely worth investigating. But, for now, the main focus should be on finding out why the first four weights generated by the Rust and the Python optimizer very different.

from fsrs-rs.

Expertium avatar Expertium commented on June 11, 2024

Maybe RMSE is not a good loss function here. I plan to use log loss.

I know this issue is closed, but I'm curious, did you end up testing RMSE vs logloss in pretrain? If so, which one is better?

from fsrs-rs.

L-M-Sherlock avatar L-M-Sherlock commented on June 11, 2024

I tested it. The log loss is more robust than RMSE in pretrain.

from fsrs-rs.

Related Issues (20)

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.