装了一天sklearn环境,之前已经装好numpy,scipy……,但是还有各种问题,最后用Anaconda搞定,官网下载速度太慢,存到网盘分享一下
在Anaconda的shell下pip list看一下安装好的包,import sklearn测试,pycharm调用
pycharm中添加Anaconda
sklearn测试代码
# Import the necessary modules and libraries
import numpy as np
from sklearn.tree import DecisionTreeRegressor
import matplotlib.pyplot as plt
# Create a random dataset
rng = np.random.RandomState(1)
X = np.sort(5 * rng.rand(80, 1), axis=0)
y = np.sin(X).ravel()
y[::5] += 3 * (0.5 - rng.rand(16))
# Fit regression model
regr_1 = DecisionTreeRegressor(max_depth=2)
regr_2 = DecisionTreeRegressor(max_depth=5)
regr_1.fit(X, y)
regr_2.fit(X, y)
# Predict
X_test = np.arange(0.0, 5.0,