本文整理汇总了Python中sklearn.cross_decomposition.PLSRegression.y_scores_方法的典型用法代码示例。如果您正苦于以下问题:Python PLSRegression.y_scores_方法的具体用法?Python PLSRegression.y_scores_怎么用?Python PLSRegression.y_scores_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.cross_decomposition.PLSRegression
的用法示例。
在下文中一共展示了PLSRegression.y_scores_方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reduce_PLS
# 需要导入模块: from sklearn.cross_decomposition import PLSRegression [as 别名]
# 或者: from sklearn.cross_decomposition.PLSRegression import y_scores_ [as 别名]
def reduce_PLS(dataframe):
PLS_file="data/pls_structure.pickle"
selectedcolumn=[x for x in dataframe.columns if x not in ["id","click","device_id","device_ip"]]
X=np.array(dataframe[selectedcolumn])
y=np.array(dataframe["click"])
if os.path.exists(PLS_file):
stand_PLS=pickle.load(open(PLS_file,'rb'))
print "PLS structure is loaded."
else:
stand_PLS=PLSRegression(n_components=10,scale=True)
stand_PLS.fit(X, y[:,np.newaxis])
stand_PLS.y_scores_=None
stand_PLS.x_scores_=None
pickle.dump(stand_PLS,open(PLS_file,"wb"))
print "PLS transform structure is stored."
T=stand_PLS.transform(X)
print "PLS transformation is performed."
return T