本文整理汇总了Python中scipy.special.inv_boxcox方法的典型用法代码示例。如果您正苦于以下问题:Python special.inv_boxcox方法的具体用法?Python special.inv_boxcox怎么用?Python special.inv_boxcox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy.special
的用法示例。
在下文中一共展示了special.inv_boxcox方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _sf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import inv_boxcox [as 别名]
def _sf(self, x, c):
return sc.inv_boxcox(-x, -c)
示例2: inv_boxcox
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import inv_boxcox [as 别名]
def inv_boxcox(x, lmbda):
return np.exp(np.log1p(lmbda * x) / lmbda) if lmbda != 0 else np.exp(x)
示例3: test_inv_boxcox
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import inv_boxcox [as 别名]
def test_inv_boxcox():
x = np.array([0., 1., 2.])
lam = np.array([0., 1., 2.])
y = boxcox(x, lam)
x2 = inv_boxcox(y, lam)
assert_almost_equal(x, x2)
x = np.array([0., 1., 2.])
lam = np.array([0., 1., 2.])
y = boxcox1p(x, lam)
x2 = inv_boxcox1p(y, lam)
assert_almost_equal(x, x2)
示例4: inverse_transform
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import inv_boxcox [as 别名]
def inverse_transform(self, y, **transform_params):
self.check_is_fitted()
check_y(y)
yt = inv_boxcox(y.values, self.lambda_)
return pd.Series(yt, index=y.index)
示例5: inverse_transform
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import inv_boxcox [as 别名]
def inverse_transform(self, x):
"""
Scale back the data to the original representation.
Parameters
----------
x: DataFrame, Series, ndarray, list
The data used to scale along the features axis.
Returns
-------
DataFrame
Inverse transformed data.
"""
x = self._check_type(x)
xs = []
for col, shift, lmd in zip(x.T, self._shift, self._lmd):
for case in Switch(lmd):
if case(np.nan, np.inf):
_x = col
break
if case():
_x = inv_boxcox(col, lmd) - shift
xs.append(_x.reshape(-1, 1))
xs = np.concatenate(xs, axis=1)
if len(self._shape) == 1:
return xs.ravel()
return xs