推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
acone2003
V2EX  ›  Python

请问如何用训练集的参数标准化测试集?

  •  
  •   acone2003 · Jul 11, 2018 · 4207 views
    This topic created in 2879 days ago, the information mentioned may be changed or developed.
    train_features 是训练集的原始特征,test_features 是测试集的原始特征。我现在想先把训练集中每列进行标准化,然后用它的参数(平均值和标准差)去标准化测试集对应的列,问一下该怎么做?
    4 replies    2018-07-11 10:01:01 +08:00
    acone2003
        1
    acone2003  
    OP
       Jul 11, 2018
    我这样做对吗?
    scaler = preprocessing.StandardScaler()
    Ens_seg1_all_std_probaes = scaler.fit_transform( Ens_seg1_all_probaes )
    Ens_seg2_all_std_probaes = scaler.transform( Ens_seg2_all_probaes )
    其中 Ens_seg1_all_probaes 为训练集特征矩阵,Ens_seg2_all_probaes 为测试集的
    capo
        2
    capo  
       Jul 11, 2018
    没有思考过这个问题,一直都是先在整个数据集上做标准化这样的工作,然后再划分训练集之类的
    glasslion
        3
    glasslion  
       Jul 11, 2018
    对的
    Morriaty
        4
    Morriaty  
       Jul 11, 2018
    训练集和测试集特征空间不一致,这模型还有什么用.....
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   924 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 19:27 · PVG 03:27 · LAX 12:27 · JFK 15:27
    ♥ Do have faith in what you're doing.