python gridsearchcv 里的评价准则
http://scikit-learn.org/stable/modules/model_evaluation.html
3.3.1. The scoring
parameter: defining model evaluation rules
Model selection and evaluation using tools, such as model_selection.GridSearchCV
and model_selection.cross_val_score
, take a scoring
parameter that controls what metric they apply to the estimators evaluated.
3.3.1.1. Common cases: predefined values
For the most common use cases, you can designate a scorer object with the scoring
parameter; the table below shows all possible values. All scorer objects follow the convention that higher return values are better than lower return values. Thus metrics which measure the distance between the model and the data, like metrics.mean_squared_error
, are available as neg_mean_squared_error which return the negated value of the metric.
Scoring | Function | Comment |
---|---|---|
Classification | ||
‘accuracy’ | metrics.accuracy_score |
|
‘average_precision’ | metrics.average_precision_score |
|
‘f1’ | metrics.f1_score |
for binary targets |
‘f1_micro’ | metrics.f1_score |
micro-averaged |
‘f1_macro’ | metrics.f1_score |
macro-averaged |
‘f1_weighted’ | metrics.f1_score |
weighted average |
‘f1_samples’ | metrics.f1_score |
by multilabel sample |
‘neg_log_loss’ | metrics.log_loss |
requires predict_proba support |
‘precision’ etc. | metrics.precision_score |
suffixes apply as with ‘f1’ |
‘recall’ etc. | metrics.recall_score |
suffixes apply as with ‘f1’ |
‘roc_auc’ | metrics.roc_auc_score |
|
Clustering | ||
‘adjusted_rand_score’ | metrics.adjusted_rand_score |
|
Regression | ||
‘neg_mean_absolute_error’ | metrics.mean_absolute_error |
|
‘neg_mean_squared_error’ | metrics.mean_squared_error |
|
‘neg_median_absolute_error’ | metrics.median_absolute_error |
|
‘r2’ | metrics.r2_score |
Usage examples:
python gridsearchcv 里的评价准则的更多相关文章
- Python程序里的注释和#号
Python程序里的注释是很重要的.它们可以用自然语言告诉你某段代码的功能是什么.在你想要临时移除一段代码时,你还可以用注解的方式将这段代码临时禁用.接下来的练习将让你学会注释 : # A comme ...
- Python正则表达式里的单行re.S和多行re.M模式
Python正则表达式里的单行re.S和多行re.M模式 Python 的re模块内置函数几乎都有一个flags参数,以位运算的方式将多个标志位相加.其中有两个模式:单行(re.DOTALL, 或者r ...
- python世界里的局部变量和全局变量: 潜规则太重要了!!!
python世界里的局部变量和全局变量: 潜规则太重要了!!! 先上代码: def fun(): def test_global(): ''' 内层和外层都需要声明为global, 才能彻底打通变量名 ...
- Python 3里,reduce()函数已经被从全局名字空间里移除了,它现在被放置在fucntools模块里
reduce函数:在Python 3里,reduce()函数已经被从全局名字空间里移除了,它现在被放置在fucntools模块里 用的话要 先引入:>>> from functool ...
- ORM基础3 在python脚本里调用Django环境
1.查询 1.# all获取所有的object,结果QuerySet,列表 print('all'.center(80, '=')) ret = models.Person.objects.all() ...
- Python 3. 里filter与generator expression的区别
# -*- coding: utf-8 -*- """ A test to show the difference between filter and genrator ...
- python命令里运行正确但是pycharm里面运行就是报错的问题
这两天在学习爬虫,第一步就是 import scrapy class StackOverflowSpider(scrapy.Spider): 结果一直报错,说是scrapy没有spider这个方法,各 ...
- python+appium里的等待时间
为什么要用等待时间: 今天在写App的自动化的脚本时发现一个元素,时而能点击,时而又不能点击到,很是心塞,原因是:因为元素还没有被加载出来,查找的代码就已经被执行了,自然就找不到元素了.解决方式:可以 ...
- 理解Python语言里的异常(Exception)
Exception is as a sort of structured "super go to".异常是一种结构化的"超级goto". 作为一个数十年如一日 ...
随机推荐
- 抛弃Https让Cas以Http协议提供单点登录服务
本文环境: 1.apache-tomcat-7.0.50-windows-x86 2.cas-server-3.4.11 3.cas-client-3.2.1 将cas-server-webapp-3 ...
- [CSU1911]Card Game
vjudge 题意 两个数组\(\{a_i\}\)和\(\{b_i\}\),求从中分别选出两个数或运算结果为\(x\)的方案数. sol 裸的FWT. code #include<cstdio& ...
- CSS设计取消a标签的修饰,转为文本
用法:text-decoration:none;修饰:text-decoration的用法:http://www.runoob.com/cssref/pr-text-text-decoration.h ...
- log4j及其log4j2的使用
简单的说 log4j2 是log4j2的升级版,据说采用了一些新技术(无锁异步.等等),使得日志的吞吐量.性能比log4j 1.x提高10倍,并解决了一些死锁的bug,而且配置更加简单灵活.其使用方式 ...
- PHP 页面编码声明方法详解(header或meta)(转)
编码格式有两种,一种是php文件本身的编码格式,如 editplus之类的编辑器在保存文件的时候允许你指定文件编码格式:另一种是php输出的文本的编码格式,这个信息只对浏览器生效,方法为<?ph ...
- HTTP协议-简介
1.什么是http协议? 百度百科上的解释:超文本传输协议(HTTP,HyperText Transfer Protocol)是互联网上应用最为广泛的一种网络协议.所有的WWW文件都必须遵守这个标准. ...
- 浅谈对【OSI七层协议】的理解
我们每天都在上网冲浪,在这背后到底有那些设备.协议去支撑呢?ISO是[Open System Interconnection]的缩写,该模型定义了不同计算机互联的标准,是设计和描述计算机网络通信的基本 ...
- java代码求奖金。要求从键盘输入利润
总结:看似文字描述很多, package com.ai; import java.util.Scanner; import com.b.Scaner; //v企业发放的奖金根据利润提成.利润(I)低于 ...
- Java-Runoob:Java 条件语句
ylbtech-Java-Runoob:Java 条件语句 1.返回顶部 1. Java 条件语句 - if...else 一个 if 语句包含一个布尔表达式和一条或多条语句. 语法 if 语句的语法 ...
- PHP手机号中间四位用星号*代替显示
三种实现方式 <?php $tel = '12345678910'; //1.字符串截取法 $new_tel1 = substr($tel, 0, 3).'****'.substr($tel, ...