# -*- coding: utf-8 -*-

import numpy as np
from sklearn import svm
from sklearn.model_selection import train_test_split
from sklearn.externals import joblib
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import zero_one_loss
from sklearn.ensemble import AdaBoostClassifier path = u'extract.txt' data0 = np.loadtxt(path,dtype = str,delimiter = ' ')
data = np.array( [[row[i] for i in range(0, 8) if i != 7] for row in data0] )#del the last col of the array
x = data[:,(1,2,3,4,5,6)]
y = data[:,0]
x = np.uint8(x)
y = np.uint8(y)
#y[y[:]==255]=1
#y[y[:]==0]=-1
#x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=1, train_size=0.6)
#clf = svm.SVC()
"""
n_estimators = 800
learning_rate = 1.0
dt_stump = DecisionTreeClassifier(max_depth=12, min_samples_leaf=1)
dt_stump.fit(x, y)
ada_discrete = AdaBoostClassifier(
base_estimator=dt_stump,
learning_rate=learning_rate,
n_estimators=n_estimators,
algorithm="SAMME")
ada_discrete.fit(x, y)
"""
clf = svm.SVC(C=0.8, kernel='rbf', gamma=20, decision_function_shape='ovr')
clf.fit(x, y.ravel())
joblib.dump(clf, "train_model.m")

眼底血管分割训练函数(SVM,Adaboost)的更多相关文章

  1. 深度学习(七)U-Net原理以及keras代码实现医学图像眼球血管分割

    原文作者:aircraft 原文链接:https://www.cnblogs.com/DOMLX/p/9780786.html DRIVE数据集下载百度云链接:链接:https://pan.baidu ...

  2. 如何正确训练一个 SVM + HOG 行人检测器

    这几个月一直在忙着做大论文,一个基于 SVM 的新的目标检测算法.为了做性能对比,我必须训练一个经典的 Dalal05 提出的行人检测器,我原以为这个任务很简单,但是我错了. 为了训练出一个性能达标的 ...

  3. Sql Server分割字符串函数

    -- Description: 分割字符串函数 -- SELECT * FROM dbo.Split('a,b,c,d,e,f,g',',') -- ========================= ...

  4. 使用OpenCV训练Haar like+Adaboost分类器的常见问题

    <FAQ:OpenCV Haartraining>——使用OpenCV训练Haar like+Adaboost分类器的常见问题 最近使用OpenCV训练Haar like+Adaboost ...

  5. Matlab中常见的神经网络训练函数和学习函数

    一.训练函数 1.traingd Name:Gradient descent backpropagation (梯度下降反向传播算法 ) Description:triangd is a networ ...

  6. SQL 字符串分割表函数

    --字符串分割表函数 ) ) declare @i int; declare @count int; ); ); declare @Index int; )) declare @rowID int; ...

  7. TensorFlow自定义训练函数

    本文记录了在TensorFlow框架中自定义训练函数的模板并简述了使用自定义训练函数的优势与劣势. 首先需要说明的是,本文中所记录的训练函数模板参考自https://stackoverflow.com ...

  8. 程序员训练机器学习 SVM算法分享

    http://www.csdn.net/article/2012-12-28/2813275-Support-Vector-Machine 摘要:支持向量机(SVM)已经成为一种非常受欢迎的算法.本文 ...

  9. Oracle拆分字符串,字符串分割的函数。

    第一种:oracle字符串分割和提取 分割 create or replace function Get_StrArrayLength ( av_str varchar2, --要分割的字符串 av_ ...

随机推荐

  1. MySql cmd下的学习笔记 —— 有关建立数据库的操作(连接Mysql,建立数据库,删除数据库等等)

    (01) 连接数据库 mysql -uroot -p 之后输入密码 ******.(由于我的密码设置的是111,所以输入的是111) (02) 退出数据库 exit (03) 查看数据库 show d ...

  2. c/C++编译的程序占用的内存分为以下几个部分

    首先要搞清楚编译程序占用的内存的分区形式:一.预备知识—程序的内存分配一个由c/C++编译的程序占用的内存分为以下几个部分1.栈区(stack)—由编译器自动分配释放,存放函数的参数值,局部变量的值等 ...

  3. [转] 指定进程运行的CPU

    转自:https://www.cnblogs.com/liuhao/archive/2012/06/21/2558069.html coolshell最新的文章<性能调优攻略>在“多核CP ...

  4. 使用Office Online Server在线预览Office

    微软官方文档介绍 ⒈介绍 Office Online Server是 Office Web Apps Server 的升级版本,安装环境必须为两台Windows Server 2012 R2 或 Wi ...

  5. [Harbor]Docker登录Harbor仓库(HTTP方式)

    Docker登录到Harbor仓库时,不管是使用http协议还是使用https协议,都需要修改一些配置. 这篇文章来介绍一下,在使用http协议时,需要进行什么哪些配置. 首先,确定自己的Harbor ...

  6. Linux动态调频系统CPUFreq之一:概述【转】

    转自:https://blog.csdn.net/zhangyongfeiyong/article/details/53506362 随着技术的发展,我们对CPU的处理能力提出了越来越高的需求,芯片厂 ...

  7. python父类调用子类了解一下

    class B(): def __init__(self): pass def start(self): print(self.parse()) class A(B): def __init__(se ...

  8. 删除元素splice、shift\pop

      splice() 方法: 向/从数组中添加/删除项目,然后返回被删除的项目. splice( index位数, 数量, 新添加 ) 该方法会改变原始数组 删除数组中第一个元素 arr.shift( ...

  9. Ubuntu18系统qt生成程序无法双击运行问题

    1.Ubuntu18 安装qt编译生成的程序文件类型为application/x-sharedlib,无法双击直接运行.文件类型应该为x-executable. 2.解决方法 在.pro文件中添加下面 ...

  10. maven项目板块的pom.xml配置

    项目名为helloweb 项目文件结构图1 helloweb>pom.xml内容如下: <project xmlns="http://maven.apache.org/POM/4 ...