Ejemplo n.º 1
0
matA_UU_CN = matA_UU * inv_D_U
matA_UI_CN = matA_UI * inv_D_I
matA_UT_CN = matA_UT * inv_D_T
matA_IU_CN = matA_IU * inv_D_U
matA_II_CN = matA_II * inv_D_I
matA_IT_CN = matA_IT * inv_D_T
matA_TU_CN = matA_TU * inv_D_U
matA_TI_CN = matA_TI * inv_D_I
matA_TT_CN = matA_TT * inv_D_T

vecttt = csr_matrix(
    ones((1, valItemNum)) * matA_IU_CN + ones((1, valTagNum)) * matA_TU_CN)

# Theta_UU
LA.gradient_mn(gradientA_UU_UU, gradientA_IU_UU, gradientA_TU_UU, matA_UU,
               matA_IU, matA_TU, valUserNum, valItemNum, valTagNum,
               vecTheta_UU, inv_D_U, colSum_U)

# Theta_UI
LA.gradient_mn(gradientA_UI_UI, gradientA_II_UI, gradientA_TI_UI, matA_UI,
               matA_II, matA_TI, valUserNum, valItemNum, valTagNum,
               vecTheta_UI, inv_D_I, colSum_I)

# Theta_UT
LA.gradient_mn(gradientA_UT_UT, gradientA_IT_UT, gradientA_TT_UT, matA_UT,
               matA_IT, matA_TT, valUserNum, valItemNum, valTagNum,
               vecTheta_UT, inv_D_T, colSum_T)

# Theta_IU
LA.gradient_mn(gradientA_UU_IU, gradientA_IU_IU, gradientA_TU_IU, matA_UU,
               matA_IU, matA_TU, valUserNum, valItemNum, valTagNum,
Ejemplo n.º 2
0
#
# column normalization on transition probabilities matrices
#
mat_a_uu_col_norm = mat_a_uu * inv_mat_d_u
mat_a_ui_col_norm = mat_a_ui * inv_mat_d_i
mat_a_ut_col_norm = mat_a_ut * inv_mat_d_t
mat_a_iu_col_norm = mat_a_iu * inv_mat_d_u
mat_a_ii_col_norm = mat_a_ii * inv_mat_d_i
mat_a_it_col_norm = mat_a_it * inv_mat_d_t
mat_a_tu_col_norm = mat_a_tu * inv_mat_d_u
mat_a_ti_col_norm = mat_a_ti * inv_mat_d_i
mat_a_tt_col_norm = mat_a_tt * inv_mat_d_t

# Theta_UU
LA.gradient_mn(drv_mat_a_uu_drv_vec_theta_uu, drv_mat_a_iu_drv_vec_theta_uu,
               drv_mat_a_tu_drv_vec_theta_uu, mat_a_uu, mat_a_iu, mat_a_tu,
               val_user_num, val_item_num, val_tag_num, vec_theta_uu,
               inv_mat_d_u, vec_sum_col_u, tensor_x_uu, 1)

# Theta_UI
LA.gradient_mn(drv_mat_a_ui_drv_vec_theta_ui, drv_mat_a_ii_drv_vec_theta_ui,
               drv_mat_a_ti_drv_vec_theta_ui, mat_a_ui, mat_a_ii, mat_a_ti,
               val_user_num, val_item_num, val_tag_num, vec_theta_ui,
               inv_mat_d_i, vec_sum_col_i, tensor_x_ui, 1)

# Theta_UT
LA.gradient_mn(drv_mat_a_ut_drv_vec_theta_ut, drv_mat_a_it_drv_vec_theta_ut,
               drv_mat_a_tt_drv_vec_theta_ut, mat_a_ut, mat_a_it, mat_a_tt,
               val_user_num, val_item_num, val_tag_num, vec_theta_ut,
               inv_mat_d_t, vec_sum_col_t, tensor_x_ut, 1)

# Theta_IU