本文整理汇总了Python中sklearn.hmm.GaussianHMM.n_features方法的典型用法代码示例。如果您正苦于以下问题:Python GaussianHMM.n_features方法的具体用法?Python GaussianHMM.n_features怎么用?Python GaussianHMM.n_features使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.hmm.GaussianHMM
的用法示例。
在下文中一共展示了GaussianHMM.n_features方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GaussianHMM
# 需要导入模块: from sklearn.hmm import GaussianHMM [as 别名]
# 或者: from sklearn.hmm.GaussianHMM import n_features [as 别名]
print i
idx = (viterbi_states==i)
ax.plot_date(x_ax[idx],y_train[idx],'o',label='%dth state'%i)
ax.legend()
ax.set_ylabel('Load (Mlb/Hr)')
ax.set_xlabel('Time')
ax.grid(True)
plt.show()
##############################################################################
#create a new model
modelw = GaussianHMM(n_clusters,covariance_type='diag',n_iter=1000)
modelw._means_ = model.means_[:,1:]
modelw._covars_ = [item[1:,1:] for item in model.covars_]
modelw.transmat_ = model.transmat_
modelw.n_features = model.n_features-1
modelw.startprob_ = model.startprob_
##############################################################################
#RUN ENSEMBLE
def run_ensemble(X_train,y_train,X_test,y_test):
hours = X_train.index.map(lambda x: x.hour)
test_hours = X_test.index.map(lambda x: x.hour)
y_svr = []
y_gbr = []
for i in xrange(24):
X_train_hourly = X_train[hours==i]
y_train_hourly = y_train[hours==i]
X_test_hourly = X_test[test_hours==i]
from sklearn.svm import SVR
y_svr = np.append(y_svr,run_svr(X_train_hourly,y_train_hourly,X_test_hourly))