def _create_response_matrix(self):
LOGGER.info("Creating response matrix.")
df = pd.DataFrame({
'index': self.train_df.index,
'y': self.train_df[self.response]})
Y = pd.pivot_table(df,
index='index',
columns=['y'],
aggfunc=len,
fill_value=0).as_matrix()
self.response = Y
self.J = self.response.shape[1]
LOGGER.info("Created response matrix with shape (%d, %d)",
self.response.shape[0], self.response.shape[1])
评论列表
文章目录