Giter VIP home page Giter VIP logo

kalmankit's People

Contributors

dependabot[bot] avatar mbalatsko avatar xylambda avatar

Stargazers

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

Watchers

 avatar  avatar

kalmankit's Issues

ENH: add bibtex to README

@misc{alejandro2019kalmanfilter,
  title={kalmanfilter},
  author={Alejandro Pérez-Sanjuán},
  year={2019},
  howpublished={\url{https://github.com/Xylambda/kalmanfilter}},
}

ENH: RTS Smoother for EKF

Implement RTS smoother for EKF.

Possible code:

def smooth(Z, U):
      # allow U to be None without the filter failing
      U = check_none_and_broadcast(U, Z)

      # filtering process to get posteriors
      x_est, P_est = self.filter(Z=Z, U=U)

      # mean and covariance array allocation
      xk_smooth = np.zeros((len(Z), self.state_size))
      Pk_smooth = np.zeros((len(Z), self.state_size, self.state_size))

      # smooth initialization
      xk_smooth[-1] = x_est[-1]
      Pk_smooth[-1] = P_est[-1]

      n_obs = len(Z)
      for k in range(n_obs - 2, -1, -1):
          # select appropiate parameters for each time step
          xk = x_est[k]
          uk = U[k]
          Qk = self.Q[k]

          # predicted mean and covariance
          xk_ahead = self.f(xk, uk)  # mk is x_est[k]
          Ak = self.jacobian_A(x_est[k], uk)
          Pk_ahead = Ak @ (P_est[k] @ Ak.T) + Qk

          # smooth (like butter) process
          Kk = P_est[k] @ (Ak.T @ np.linalg.pinv(Pk_ahead))
          xk_smooth[k] = x_est[k] + Kk @ (xk_smooth[k + 1] - xk_ahead)
          Pk_smooth[k] = P_est[k] + Kk @ ((Pk_smooth[k + 1] - Pk_ahead.T) @ Kk)

      return xk_smooth, Pk_smooth

ENH: output format

I'm not happy with the current output format of the filter. It is a list of arrays, instead of an array with the values. I think I can use the state_size attribute to allocate an array of the appropiate size.

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.