A biosensor that learns on the go