首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么TPOT推荐分类器的得分低于LinearSVC?

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

Stack Overflow用户
提问于 2017-03-15 21:09:42
回答 1查看 727关注 0票数 1

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

代码语言:javascript
复制
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

十代之后: TPOT推荐了GaussianNB,它在sklearn评分中的得分约为0.77。

代码语言:javascript
复制
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却不推荐。是否因为评分机制不同而导致最佳分类器不同?

非常感谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-24 15:50:14

我个人的猜测是,tpot停留在局部最大值上,可能会尝试更改测试大小,执行更多代或缩放数据可能会有所帮助。另外,您是否可以重做TPOT并查看是否得到相同的结果?(我的猜测是否定的,因为由于突变,遗传优化是不确定的)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42810781

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档