集成堆叠模型…使用不同输入(分子指纹)在一种类型的Keras模型中

我是一名化学家,仍然在学习机器学习…

我使用Keras训练了7个不同的模型,使用不同类型的分子指纹作为特征来预测一个属性…然而准确率并不是很好。

所以我使用了一个在线找到的教程

def optimized_weights(prd,y_fold):    # define bounds on each weight    bound_w = [(0.0, 1.0) for _ in range(n_members) ]    # arguments to the loss function    search_arg = (prd ,y_fold)    # global optimization of ensemble weights    result = differential_evolution(loss_function, bound_w,search_arg,  maxiter=2000, tol=0.0001)    # get the chosen weights    weights = normalize(result['x'])    return weightsdef weighted_accuracy(prd,weights,y_fold):    summed = tensordot(prd, weights, axes=((0),(0)))    yhat=np.round(summed)    score = accuracy_score(y_fold,yhat )    f1 = f1_score(y_fold,yhat)    fpr, tpr, thresholds = roc_curve(y_fold,summed,pos_label=1)    auc_test = auc(fpr, tpr)    conf_matrix=confusion_matrix(y_fold,yhat)    total=sum(sum(conf_matrix))    sensitivity = conf_matrix[0,0]/(conf_matrix[0,0]+conf_matrix[0,1])    specificity = conf_matrix[1,1]/(conf_matrix[1,0]+conf_matrix[1,1])    return score,auc_test,sensitivity,specificity,f1

对于加权平均集成模型,我在80%的数据上训练了模型,并使用20%的数据通过differential_evolution(来自scipy)来寻找最优权重以最大化准确率,但我认为这种准确率对测试数据有偏见…

我还对同样的过程进行了5折交叉验证,并确定了平均准确率….这是可以接受的吗…如果不可以,请告诉我我可以做什么

谢谢


回答:

DeepStack 提供了一个用于堆叠和“集成”Keras模型的接口。它还提供基于验证数据的性能测试,功能齐全

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注