# -*- 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. Aizu - 2200 Mr. Rito Post Office

    题意:/*你是某个岛国(ACM-ICPC Japan)上的一个苦逼程序员,你有一个当邮递员的好基友利腾桑遇到麻烦了:全岛有一些镇子通过水路和旱路相连,走水路必须要用船,在X处下船了船就停在X处.而且岛 ...

  2. php编程 之 php基础三

    1,php里的while循环 循环执行代码块指定的次数,或者当指定的条件为真时循环执行代码块. while实例: <html> <body> <?php $i=1; wh ...

  3. C# 事务 四种事务隔离级别

    http://www.zsythink.net/archives/1233 不同隔离级别的问题   脏读(Dirty Read) 一个事务处理过程里读取了另一个未提交的事务中的数据 例子: 当一个事务 ...

  4. LeetCode Two Add Two Numbers (JAVA)

    问题简介:输入两个数字链表,输出求和后的链表(链表由数字位数倒序组成) 问题详解: 给定两个非空链表,表示两个非负整数. 数字以相反的顺序存储,每个节点包含一位数字.对两个整数作求和运算,将结果倒序作 ...

  5. Trickbot增加的远程应用程序凭证抓取功能

    来源 https://blog.trendmicro.com/trendlabs-security-intelligence/trickbot-adds-remote-application-cred ...

  6. Python运维开发基础08-文件基础【转】

    一,文件的其他打开模式 "+"表示可以同时读写某个文件: r+,可读写文件(可读:可写:可追加) w+,写读(不常用) a+,同a(不常用 "U"表示在读取时, ...

  7. vue后台项目记录

    1.当我们用axios进行接口访问时,必须同时使用Qs,否则后端接收不到所传的数据! npm 安装qs,然后引用 import Qs from 'qs' // 创建axios实例 const serv ...

  8. cocos开发插件笔记

    写插件菜单时要注意大小写 { "name": "hello-world", "version": "0.0.1", &q ...

  9. latex公式、编号、对齐

    原文地址:http://blog.csdn.net/hjq376247328/article/details/49718931 LaTeX的数学公式有两种,即行中公式和独立公式.行中公式放在正文中间, ...

  10. Chrome表单文本框自动填充黄色背景色样式

    chrome表单自动填充后,input文本框的背景会变成偏黄色的,这是由于chrome会默认给自动填充的input表单加上input:-webkit-autofill私有属性,然后对其赋予以下样式: ...