本文整理匯總了Python中sklearn.preprocessing.StandardScaler.std_[i]方法的典型用法代碼示例。如果您正苦於以下問題:Python StandardScaler.std_[i]方法的具體用法?Python StandardScaler.std_[i]怎麽用?Python StandardScaler.std_[i]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sklearn.preprocessing.StandardScaler
的用法示例。
在下文中一共展示了StandardScaler.std_[i]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: print
# 需要導入模塊: from sklearn.preprocessing import StandardScaler [as 別名]
# 或者: from sklearn.preprocessing.StandardScaler import std_[i] [as 別名]
X, y, weights, test_size=0.25, random_state=0)
print("train data shape: %r, train target shape: %r, train weights shape: %r"
% (X_train.shape, y_train.shape, w_train.shape))
print("test data shape: %r, test target shape: %r, test weights shape: %r"
% (X_test.shape, y_test.shape, w_test.shape))
scaler = StandardScaler()
means = np.mean(X_train)
std = np.std(X_train)
print means[0]
scaler.mean_ = np.zeros(len(means))
scaler.std_ = np.ones(len(means))
for i in range(len(means)):
scaler.mean_[i] = means[i]
scaler.std_[i] = std[i]
print scaler.mean_
#scaler.mean_ =
#X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)
print scaler.get_params(deep=True)
print scaler.mean_
print scaler.std_
sys.exit()
# Let's retrain a new model on the first subset call the **training set**:
# In[15]:
from sklearn.ensemble import AdaBoostClassifier as ABC
from sklearn.tree import DecisionTreeClassifier as DC