Forgetting curve using Duolingo data I'm trying to replicate the forgetting curve using the open sourced Duolingo data for fun.
The problem is that my finding doesn't make any sense, namely that the longer you wait the better recall value. Anyone have any pointers?

# make our plot outputs appear and be stored within the notebook.
%matplotlib inline 

import matplotlib.pyplot as plt # import matplotlib for scatterplot, use the alias plt
import numpy as np # import the numpy package with alias np
import pandas as pd
from scipy.optimize import curve_fit

df = pd.read_csv('learning_traces.13m.csv') # Load Duolingo data
df = df[(df['history_seen'] == 1) &amp; (df['session_seen'] == 1)] # Seen only once before
df = df.sort_values('delta') # sort by: time (in seconds) since the last lesson/practice that included this word/lexeme
df['delta'] = df['delta'] / 60.0 # Seconds to minutes
minInMonth = 44640

def func(x, a):
    return np.exp2(-x / a)

xdata = df['delta']
ydata = df['p_recall']

plt.scatter(xdata, ydata)

popt, pcov = curve_fit(func, xdata, ydata)
print(popt) # Show the result
plt.plot(xdata, func(xdata, *popt), 'r-', label='fit')


Expectation:


Reality


Rolling Mean
I think the most important problem you are facing is that you are trying to fit a function that somewhat erratically flips between 0 and 1 as if it were a smooth function. My Mathematical intuition says that won't be numerically stable.

To create a more smooth function you could calculate a running average of your y data and plot it against the corresponding time data.
It should descend as you forget more over a longer period of time and should be easy to plot to demonstrate your intuition.

It has hysteresis/history since initial successes will be remembered. Your fit function would be the integral: 

$$\int_0^X e^{-x/a} dx = a - a\cdot e^{-X/a}$$ 

where $a$ will be the estimator of the forgetting rate.

Other problems could be in the time domain (just leave the unit of time at seconds), or you are mixing time scale/sample scale.

Both your expectation and reality plot should cover the complete time range on the x-axis to make them better comparable.
Maybe you should throw away data with exceptionally large time delta values anyway, as they are likely to disturb the calculations and the plots. The programs from your references remove data > 9 months and &lt; 45 minutes if I recall correctly.

Another domain problem that could interfere is that the data mixed words that are easy to remember and words that are difficult to remember, e.g. 'cat' is in many languages easier to remember than 'butterfly'  (though that could also average out over much measurement data).