polylearn.kernels.
safe_power
Element-wise power supporting both sparse and dense data.
X : ndarray or sparse
The array whose entries to raise to the power.
degree : int, default: 2
The power to which to raise the elements.
X_ret : ndarray or sparse
Same shape as X, but (x_ret)_ij = (x)_ij ^ degree