def _predict_scores_fixed(self, X, **kwargs): summary = dict(pm.summary(self.trace_)["mean"]) weights = np.zeros((self.n_object_features_fit_, self.n_mixtures)) for i, k in product(range(self.n_object_features_fit_), range(self.n_mixtures)): weights[i][k] = summary["weights[{},{}]".format(i, k)] utility = np.dot(X, weights) p = np.mean(npu.softmax(utility, axis=1), axis=2) return p
def _predict_scores_fixed(self, X, **kwargs): mean_trace = dict(pm.summary(self.trace_)["mean"]) weights = np.array([ mean_trace["weights[{}]".format(i)] for i in range(self.n_object_features_fit_) ]) lambda_k = np.array([ mean_trace["lambda_k[{}]".format(i)] for i in range(self.n_nests) ]) weights_ik = np.zeros((self.n_object_features_fit_, self.n_nests)) for i, k in product(range(self.n_object_features_fit_), range(self.n_nests)): weights_ik[i][k] = mean_trace["weights_ik[{},{}]".format(i, k)] alpha_ik = np.dot(X, weights_ik) alpha_ik = npu.softmax(alpha_ik, axis=2) utility = np.dot(X, weights) p = self._get_probabilities_np(utility, lambda_k, alpha_ik) return p