preprocessing.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:ottertune 作者: cmu-db 项目源码 文件源码
def __init__(self, mins=None, maxs=None):
        from sklearn.preprocessing import MinMaxScaler

        self.scaler_ = MinMaxScaler()
        if mins is not None:
            assert isinstance(mins, np.ndarray)
            if mins.ndim == 1:
                mins = mins.reshape(1, -1)
            self.scaler_.partial_fit(mins)
            self.mins_ = mins
        else:
            self.mins_ = None
        if maxs is not None:
            assert isinstance(maxs, np.ndarray)
            if maxs.ndim == 1:
                maxs = maxs.reshape(1, -1)
            self.scaler_.partial_fit(maxs)
            self.maxs_ = maxs
        else:
            self.maxs_ = None
        if self.mins_ is not None and self.maxs_ is not None:
            self.fitted_ = True
        else:
            self.fitted_ = False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号