任何与 pypi 联系的 pip 命令在 Ubuntu 18.04 上运行速度都非常慢。
$ pip install -v pandas
Created temporary directory: /tmp/pip-ephem-wheel-cache-hvbcg1k_
Created temporary directory: /tmp/pip-install-7_spppvw
Collecting pandas
1 location(s) to search for versions of pandas:
* https://pypi.org/simple/pandas/
Getting page https://pypi.org/simple/pandas/
Looking up "https://pypi.org/simple/pandas/" in the cache
Current age based on date: 324440
Freshness lifetime from max-age: 600
Freshness lifetime from request max-age: 600
Starting new HTTPS connection (1): pypi.org
Run Code Online (Sandbox Code Playgroud)
挂起约 1-2 分钟(至少)。
使用该选项可以--index-url=http://pypi.python.org/simple/大大加快速度,但似乎并不理想,因为它跳过了加密。有什么解决方法吗?
xgboost的绘图API说明:
xgboost.plot_importance(booster, ax=None, height=0.2, xlim=None, ylim=None, title='Feature importance', xlabel='F score', ylabel='Features', importance_type='weight', max_num_features=None, grid=True, **kwargs)¶
Run Code Online (Sandbox Code Playgroud)
绘制基于拟合树木的重要性.
参数:
booster (Booster, XGBModel or dict) – Booster or XGBModel instance, or dict taken by Booster.get_fscore()
...
max_num_features (int, default None) – Maximum number of top features displayed on plot. If None, all features will be displayed.
Run Code Online (Sandbox Code Playgroud)
但是,在我的实现中,运行:
booster_ = XGBClassifier(learning_rate=0.1, max_depth=3, n_estimators=100,
silent=False, objective='binary:logistic', nthread=-1,
gamma=0, min_child_weight=1, max_delta_step=0, subsample=1,
colsample_bytree=1, colsample_bylevel=1, reg_alpha=0,
reg_lambda=1, scale_pos_weight=1, base_score=0.5, seed=0)
booster_.fit(X_train, y_train)
from xgboost import …Run Code Online (Sandbox Code Playgroud)