Thursday, October 16, 2014

Installing external package for canopy / (python)

1. Go to Package Manager in Canopy, then go to Canopy Command prompt

image

2. In CMD enter

pip install --upgrade https://pypi.python.org/packages/source/p/pykalman/pykalman-0.9.5.tar.gz

(Here you can find some python packages)

image

 

Editor

Now Write code in edit with kalman

1 from pykalman import KalmanFilter
2 import numpy as np
3 print 'start';
4
5 kf = KalmanFilter(transition_matrices = [[1, 1], [0, 1]], observation_matrices = [[0.1, 0.5], [-0.3, 0.0]])
6 measurements = np.asarray([[1,0], [0,0], [0,1]]) # 3 observations
7 kf = kf.em(measurements, n_iter=5)
8 (filtered_state_means, filtered_state_covariances) = kf.filter(measurements)
9 (smoothed_state_means, smoothed_state_covariances) = kf.smooth(measurements)
10
11 print '\nfiltered_state_means'
12 print filtered_state_means;
13 print '\nfiltered_state_covariances'
14 print filtered_state_covariances;

Here is out put


image

No comments:

Post a Comment