ICode9

精准搜索请尝试: 精确搜索
  • python-RandomizedSearchCV使用相同的random_state给出不同的结果2019-11-11 22:57:05

    我正在使用管道使用RandomizedSearchCV执行功能选择和超参数优化.以下是代码摘要: from sklearn.cross_validation import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.feature_selection import SelectKBest from sklearn.grid_search im

  • python-由于神秘的TypeError,Scikit-learn GridSearchCV无法使用Silhouette_score拟合EM模型2019-11-11 18:55:46

    以下代码导致:TypeError:__call __()至少接受4个参数(给定3个). 我已经实例化了一个聚类分类器和一个适用于聚类的评分方法.我提供了用于拟合的简单数据集和用于网格搜索的参数字典.我很难看清哪里有错误,并且回溯是毫无帮助的. from sklearn.mixture import GaussianMixture from s

  • python-如何访问Scikit学习嵌套的交叉验证得分2019-10-26 08:56:38

    我正在使用python,并且希望将嵌套交叉验证与scikit学习一起使用.我发现一个非常好的example: NUM_TRIALS = 30 non_nested_scores = np.zeros(NUM_TRIALS) nested_scores = np.zeros(NUM_TRIALS) # Choose cross-validation techniques for the inner and outer loops, # independe

  • python-TypeError网格搜索2019-10-14 00:58:04

    我曾经创建循环来为模型找到最佳参数,这增加了我的编码错误,因此我决定使用GridSearchCV. 我正在尝试为我的模型找出PCA的最佳参数(我要在其上进行网格搜索的唯一参数).在此模型中,归一化后,我想将原始特征与PCA简化特征结合起来,然后应用线性SVM.然后,我保存整个模型以预测我的输

  • python – 管道:多个分类器?2019-10-07 02:58:19

    我在Python中阅读以下关于Pipelines和GridSearchCV的示例: http://www.davidsbatista.net/blog/2017/04/01/document_classification/ Logistic回归: pipeline = Pipeline([ ('tfidf', TfidfVectorizer(stop_words=stop_words)), ('clf', OneVsRestClassifier(

  • python – Keras:进行超参数网格搜索时内存不足2019-10-04 23:55:39

    我正在运行多个嵌套循环来进行超参数网格搜索.每个嵌套循环遍历超级参数值列表,并且在最内层循环内部,每次使用生成器构建和评估Keras顺序模型. (我没有做任何训练,我只是随机初始化,然后多次评估模型,然后检索平均损失). 我的问题是,在这个过程中,Keras似乎填满了我的GPU内存,所以

  • python – GridSearchCV是否执行交叉验证?2019-09-28 17:06:03

    我目前正在研究一个问题,该问题比较了同一数据集上三种不同的机器学习算法性能.我将数据集划分为70/30个训练/测试集,然后使用GridSearchCV和X_train,y_train对每个算法的最佳参数进行网格搜索. 第一个问题,我想在训练集上进行网格搜索还是假设在整个数据集上? 第二个问题,我知道Gri

  • 如何在python中的sklearn中使用gridsearchcv进行特征选择2019-09-27 18:59:10

    我正在使用递归特征消除和交叉验证(rfecv)作为随机森林分类器的特征选择器,如下所示. X = df[[my_features]] #all my features y = df['gold_standard'] #labels clf = RandomForestClassifier(random_state = 42, class_weight="balanced") rfecv = RFECV(estimator=clf, step=

  • GridSearchCV用于python中的多类SVM2019-09-10 14:58:46

    我正在尝试学习如何为分类器找到最佳参数.所以,我使用GridSearchCV来解决多类分类问题.在Does not GridSearchCV support multi-class?上生成了一个虚拟代码我正在使用n_classes = 3的代码. import numpy as np from sklearn.datasets import make_classification from sklearn.pr

  • python – 在sklearn中创建网格搜索函数以忽略空模型2019-08-29 20:56:37

    使用python和scikit-learn,我想进行网格搜索.但是我的一些模特最终都是空的.如何使网格搜索功能忽略这些模型? 我想我可以有一个评分函数,如果模型为空,则返回0,但我不知道如何. predictor = sklearn.svm.LinearSVC(penalty='l1', dual=False, class_weight='auto') param_dist = {

  • python – RandomForestRegressor和feature_importances_错误2019-08-28 07:55:35

    我正在努力从我的RandomForestRegressor中取出功能重要性,我得到一个: AttributeError: ‘GridSearchCV’ object has no attribute ‘feature_importances_’. 有谁知道为什么没有属性?根据文档应该存在这个属性? 完整代码: from sklearn.ensemble import RandomForestRegresso

  • python – GridSearchCV给出ValueError:DecisionTreeRegressor不支持continuous2019-08-28 06:55:43

    我正在学习ML并为波士顿房价预测做任务.我有以下代码: from sklearn.metrics import fbeta_score, make_scorer from sklearn.model_selection import GridSearchCV def fit_model(X, y): """ Tunes a decision tree regressor model using GridSearchCV on the input data X

  • python – 在Gridline for GridSearchCV中替换不同的模型2019-07-24 10:59:17

    我想在sklearn中构建一个Pipeline并使用GridSearchCV测试不同的模型. 举个例子(请不要注意选择的特定型号): reg = LogisticRegression() proj1 = PCA(n_components=2) proj2 = MDS() proj3 = TSNE() pipe = [('proj', proj1), ('reg' , reg)] pipe = Pipeline(pipe) param_gri

  • python – 使用f1作为评分函数的网格搜索,几页错误消息2019-07-17 12:58:23

    想要使用Gridsearch查找最佳参数并使用f1作为评分指标. 如果我删除评分功能,一切正常,我没有错误. 这是我的代码: from sklearn import grid_search parameters = {'n_neighbors':(1,3,5,10,15),'weights':('uniform','distance'),'algorithm':('ball_tree'

  • python – scikit-learn管道:网格搜索变压器参数以生成数据2019-07-11 16:57:45

    我想使用scikit-learn管道的第一步来生成玩具数据集,以评估我的分析性能.我想出的一个简单的示例解决方案如下所示: import numpy as np from sklearn.pipeline import Pipeline from sklearn.grid_search import GridSearchCV from sklearn.base import TransformerMixin from skl

  • python – 有没有办法在GridSearchCV中查看交叉验证的折叠?2019-07-01 21:44:40

    我目前正在使用Python中的GridSearchCV进行3倍的cv来优化超参数.我只是想知道是否有任何方法可以在GridSearchCV中使用的cv中查看训练和测试数据的索引?解决方法:如果你不想在CV阶段折叠之前将样品洗牌,你可以.您可以将KFold(或另一个CV类)的实例传递给GridSearchCV构造函数,并像这

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有