Python 为什么TPOT推荐分类器的得分低于LinearSVC?

Python 为什么TPOT推荐分类器的得分低于LinearSVC?,python,machine-learning,svm,genetic-algorithm,genetic-programming,Python,Machine Learning,Svm,Genetic Algorithm,Genetic Programming,所以我发现LinearSVC在TPOT分类器中,我一直在我的模型中使用它,得到了一个相当不错的分数(sklearn分数为0.95) 十代后:TPOT推荐了GaussianNB,其sklearn得分约为0.77 def process(stock): df = format_data(stock) df[['HSI Volume', 'HSI', stock]] = df[['HSI Volume', 'HSI', stock]].pct_change() # shift future

所以我发现LinearSVC在TPOT分类器中,我一直在我的模型中使用它,得到了一个相当不错的分数(sklearn分数为0.95)

十代后:TPOT推荐了GaussianNB,其sklearn得分约为0.77

def process(stock):
  df = format_data(stock)
  df[['HSI Volume', 'HSI', stock]] = df[['HSI Volume', 'HSI', stock]].pct_change()

# shift future value to current date
  df[stock+'_future'] = df[stock].shift(-1)
  df.replace([-np.inf, np.inf], np.nan, inplace=True)
  df.dropna(inplace=True)
  df['class'] = list(map(create_labels, df[stock], df[stock+'_future']))
  X = np.array(df.drop(['class', stock+'_future'], 1)) # 1 = column
  # X = preprocessing.scale(X)
  y = np.array(df['class'])

  X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=0.2)

  tpot = TPOTClassifier(generations = 10, verbosity=2)
  fitting = tpot.fit(X_train, y_train)
  prediction = tpot.score(X_test, y_test)
  tpot.export('pipeline.py')
  return fitting, prediction
Generation 1 - Current best internal CV score: 0.5322255571                     
Generation 2 - Current best internal CV score: 0.55453535828                    
Generation 3 - Current best internal CV score: 0.55453535828                    
Generation 4 - Current best internal CV score: 0.55453535828                    
Generation 5 - Current best internal CV score: 0.587469903893                   
Generation 6 - Current best internal CV score: 0.587469903893                   
Generation 7 - Current best internal CV score: 0.597194474469                   
Generation 8 - Current best internal CV score: 0.597194474469                   
Generation 9 - Current best internal CV score: 0.597194474469                   
Generation 10 - Current best internal CV score: 0.597194474469                  

Best pipeline: GaussianNB(RBFSampler(input_matrix, 0.22))
(None, 0.54637855142056824)
我只是好奇为什么LinearSVC得分更高,但TPOT不推荐。是否因为评分机制不同,从而导致不同的最优分类器


非常感谢你

我个人的猜测是,tpot停留在一个局部最大值上,可能尝试改变测试大小、进行更多代或扩展数据可能会有所帮助。另外,你能重做TPOT,看看是否得到同样的结果吗?(我的猜测是否定的,因为基因优化由于变异而不确定)

我个人的猜测是tpot停留在一个局部最大值上,可能尝试改变测试规模,进行更多代或扩展数据可能会有所帮助。另外,你能重做TPOT,看看是否得到同样的结果吗?(我的猜测是否定的,因为基因优化由于变异而不确定)

你是对的,我通过向TPOT添加更多代来解决问题,并获得更高的准确性。你是对的,我通过在TPOT中添加更多的代来解决这个问题,并获得了更高的精度。原因是生成时间不够长,分类器对数据拟合不足。原因是生成时间不够长,分类器对数据拟合不足。