promp.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:promplib 作者: baxter-flowers 项目源码 文件源码
def add_demonstration(self, demonstration):
        interpolate = interp1d(np.linspace(0, 1, len(demonstration)), demonstration, kind='cubic')
        stretched_demo = interpolate(self.x)
        self.Y = np.vstack((self.Y, stretched_demo))
        self.nrTraj = len(self.Y)
        self.W = np.dot(np.linalg.inv(np.dot(self.Phi, self.Phi.T)), np.dot(self.Phi, self.Y.T)).T  # weights for each trajectory
        self.meanW = np.mean(self.W, 0)                                                             # mean of weights
        w1 = np.array(map(lambda x: x - self.meanW.T, self.W))
        self.sigmaW = np.dot(w1.T, w1)/self.nrTraj                                                  # covariance of weights
        self.sigmaSignal = np.sum(np.sum((np.dot(self.W, self.Phi) - self.Y) ** 2)) / (self.nrTraj * self.nrSamples)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号