当前位置: 首页>>代码示例>>Python>>正文


Python ARDRegression.predict方法代码示例

本文整理汇总了Python中sklearn.linear_model.ARDRegression.predict方法的典型用法代码示例。如果您正苦于以下问题:Python ARDRegression.predict方法的具体用法?Python ARDRegression.predict怎么用?Python ARDRegression.predict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sklearn.linear_model.ARDRegression的用法示例。


在下文中一共展示了ARDRegression.predict方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ARDRegression_on_fold

# 需要导入模块: from sklearn.linear_model import ARDRegression [as 别名]
# 或者: from sklearn.linear_model.ARDRegression import predict [as 别名]
def ARDRegression_on_fold(feature_sets, train, test, y, y_all, X, dim, dimsum, learn_options):
    '''
    '''
    clf = ARDRegression()
    clf.fit(X[train], y[train][:, 0])
    y_pred = clf.predict(X[test])[:, None]
    return y_pred, clf
开发者ID:pablocarderam,项目名称:genetargeter,代码行数:9,代码来源:regression.py

示例2: fit_model_16

# 需要导入模块: from sklearn.linear_model import ARDRegression [as 别名]
# 或者: from sklearn.linear_model.ARDRegression import predict [as 别名]
    def fit_model_16(self,toWrite=False):
        model = ARDRegression()

        for data in self.cv_data:
            X_train, X_test, Y_train, Y_test = data
            model.fit(X_train,Y_train)
            pred = model.predict(X_test)
            print("Model 16 score %f" % (logloss(Y_test,pred),))

        if toWrite:
            f2 = open('model16/model.pkl','w')
            pickle.dump(model,f2)
            f2.close()
开发者ID:JakeMick,项目名称:kaggle,代码行数:15,代码来源:days_work.py

示例3: f

# 需要导入模块: from sklearn.linear_model import ARDRegression [as 别名]
# 或者: from sklearn.linear_model.ARDRegression import predict [as 别名]
plt.plot(clf.scores_, color='navy', linewidth=2)
plt.ylabel("Score")
plt.xlabel("Iterations")


# Plotting some predictions for polynomial regression
def f(x, noise_amount):
    y = np.sqrt(x) * np.sin(x)
    noise = np.random.normal(0, 1, len(x))
    return y + noise_amount * noise


degree = 10
X = np.linspace(0, 10, 100)
y = f(X, noise_amount=1)
clf_poly = ARDRegression(threshold_lambda=1e5)
clf_poly.fit(np.vander(X, degree), y)

X_plot = np.linspace(0, 11, 25)
y_plot = f(X_plot, noise_amount=0)
y_mean, y_std = clf_poly.predict(np.vander(X_plot, degree), return_std=True)
plt.figure(figsize=(6, 5))
plt.errorbar(X_plot, y_mean, y_std, color='navy',
             label="Polynomial ARD", linewidth=2)
plt.plot(X_plot, y_plot, color='gold', linewidth=2,
         label="Ground Truth")
plt.ylabel("Output y")
plt.xlabel("Feature X")
plt.legend(loc="lower left")
plt.show()
开发者ID:AlexandreAbraham,项目名称:scikit-learn,代码行数:32,代码来源:plot_ard.py

示例4: standardizeExpression

# 需要导入模块: from sklearn.linear_model import ARDRegression [as 别名]
# 或者: from sklearn.linear_model.ARDRegression import predict [as 别名]
        rescaledExpressionClinical = L2Normalizer.transform(np.log10(rescaledExpressionClinical+1))
#    else:
#        prunedRnaSeqExpressionNormalized, L2Normalizer = standardizeExpression(prunedRnaSeqExpression.ix[cellExpression.shape[0],;], L2Normalizer, log10Normalize)
#        prunedArrayExpressionNormalized = L2Normalizer.transform(np.log10(prunedRescaledExpressionClinical+1))

    #Load Docetaxel IC50 Data
    docetaxelData = getDrugIC50('Docetaxel', inputFolder)
    
    #Assemble training data with both IC50 and expression data    
    docetaxelData = pd.merge(docetaxelData, rnaSeqExpressionNormalized, how='inner', left_index=True, right_index=True).drop('cell_line', axis=1)
        
    #Train Docetaxel model    
    clf.fit(docetaxelData.drop(['IC50'], axis=1), docetaxelData['IC50'])    
    
    #Validate on Clinical Data
    resistance_predictions = clf.predict(rescaledExpressionClinical)
    
    #Calculates ROC, first 11 samples correspond to sensitive patients, last 13 are resistant            
    roc_auc_score(np.hstack((np.repeat(0,11), np.repeat(1,13))), resistance_predictions)

    roc_data = pd.DataFrame()
    roc_data['fpr'], roc_data['tpr'],roc_data['thresholds'] = roc_curve(np.hstack((np.repeat(0,11), np.repeat(1,13))), resistance_predictions)


    #Plot Results
    from bokeh.charts import show, output_file
    from bokeh.plotting import figure

    output_file(outputFolder + 'Docetaxel_ROC_Curve_rankIC50.html')
        
开发者ID:gkoytiger,项目名称:OncologyOracle,代码行数:31,代码来源:validateDocetaxelClinical.py

示例5: load_boston

# 需要导入模块: from sklearn.linear_model import ARDRegression [as 别名]
# 或者: from sklearn.linear_model.ARDRegression import predict [as 别名]
from sklearn.datasets import load_boston
from sklearn.metrics import explained_variance_score, mean_squared_error
import numpy as np
import pylab as pl
#Loading boston datasets 
boston = load_boston()
# Creating Regression Design Matrix 
x = boston.data
# Creating target dataset
y = boston.target
# Create ARDRegression Regression object 
ARD= ARDRegression(alpha_1=0.01, alpha_2=0.01, lambda_1=1e-06, lambda_2=1e-06)
# Fitting a linear model using the dataset
ARD.fit(x,y)
# Y predicted values
yp = ARD.predict(x)
#Calculation 10-Fold CV
yp_cv = cross_val_predict(ARD, x, y, cv=10)
#Printing RMSE and Explained Variance
Evariance=explained_variance_score(y,yp)
Evariance_cv=explained_variance_score(y,yp_cv)
RMSE =np.sqrt(mean_squared_error(y,yp))
RMSECV=np.sqrt(mean_squared_error(y,yp_cv))
print('Method: ARDRegression Regression')
print('RMSE on the dataset: %.4f' %RMSE)
print('RMSE on 10-fold CV: %.4f' %RMSECV)
print('Explained Variance Regression Score on the dataset: %.4f' %Evariance)
print('Explained Variance Regression 10-fold CV: %.4f' %Evariance_cv)
#plotting real vs predicted data
pl.figure(1)
pl.plot(yp, y,'ro')
开发者ID:omoreira,项目名称:GM-Python-Workbook,代码行数:33,代码来源:ARDRegression_boston10foldcv.py


注:本文中的sklearn.linear_model.ARDRegression.predict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。