自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(51)
  • 资源 (3)
  • 收藏
  • 关注

原创 python链接数据库SQL Server 2005出错怎么办???附解决方案以及开启TCP/IP协议和查看默认端口的过程

import pymssqlconn=pymssql.connect(host='127.0.0.1:1433',user='sa',password='jxn',database='scott',charset="UTF-8")'''如果和本机数据库交互,只需修改链接字符串conn=pymssql.connect(host='.',database='Michael')'''cur=...

2018-03-16 12:26:57 9306 4

原创 在python36上安装pymssql包

首先,需要去一个网站下载pymssql安装包,该网站都是python一些常用的包,各种版本都有,还在不断更新建议大家收藏之!网址为:点击打开链接因为安装pymssql包,直接在电脑终端使用pip install pymssql是安装失败的,不信看下图:那么,就要想其他办法了,在开头的网页中下载pymssql-2.2.0.dev0-cp36-cp36m-win_amd64.whl,然后将其放在pyt...

2018-03-15 20:34:03 3573 1

原创 如何使用R语言链接数据库并对数据库中的表进行查询操作

需求:1、安装R           2、安装数据库,我的是SQL Server 2005, ,我在数据库里事先创建了一个名叫scott的数据库,并且scott数据库里包含了名叫emp的表,用于查询操作,如下图所示:下面先放上R语言代码,然后我再一步步给解释一下,自己刚学的时候什么也不会,查了好多资料,先将学习过程记录下来以共勉:library(RODBC)myconn <- odbcCo...

2018-03-15 09:14:18 11223

原创 使用python爬取天气预报

首先,附上代码import jsonimport requestsimport bs4def get_html(url): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51

2018-01-16 21:19:38 2050

原创 爬取微信好友的部分资料,并将所有人的个性签名制成词云图,哈哈~~~~

import itchatitchat.login()friends = itchat.get_friends(update=True)[0:]male = female = other = 0for i in friends[1:]: sex = i["Sex"] if sex == 1: male += 1 elif sex == 2:

2018-01-16 19:53:48 1410 4

原创 透视变换实现代码(全)

好久没写博客了,因为白天要去实习,晚上看论文实在抽不出时间,由于项目需要,研究了透视变换,在网上找了一圈不是缺腿就是少胳膊的,后来对缺省的代码进行补充使其可以调通,现贴出来供大家学习使用,代码如下:#include#include#includeusing namespace cv;using namespace std;int main( ) { Mat img=

2017-10-19 20:46:09 9104 1

原创 使用opencv读取一段视频并对视频进行canny边缘检测

使用opencv读取视频并对视频进行canny边缘检测代码如下:#include using namespace cv;int main(){ VideoCapture capture("1.avi"); Mat edges;//定义一个Mat变量,用于存储每一帧经过处理后的图像图像 while(1) { Mat frame;//定义一个Mat变量,用于存储每一帧图像

2017-09-24 10:59:33 2203 1

原创 使用CMake制作lib文件以及Dlib机器学习库的安装和使用-亲测可行

第一步骤:使用CMake制作lib文件CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程)。他能够输出各种各样的makefile或者project文件,能测试编译器所支持的C++特性,类似UNIX下的automake。这里使用Dlib机器学习库做实验,进行打包实验工具/原料CMake

2017-09-24 08:42:47 4231 4

原创 机器学习经典算法优缺点总结

1.决策树:判别模型,多分类与回归,正则化的极大似然估计特点:适用于小数据集,在进行逐步应答过程中,典型的决策树分析会使用分层变量或决策节点,例如,可将一个给定用户分类成信用可靠或不可靠。场景举例:基于规则的信用评估、赛马结果预测优点: 计算量简单,可解释性强,比较适合处理有缺失属性值的样本,能够处理不相关的特征;擅长对人、地点、事物的一系列

2017-09-23 18:31:34 1311 1

原创 C中的struct与C++中的struct区别以及C++中的struct与C++中的class的区别

c中的struct是没有权限设置的。 C++中struct增加了访问权限,且可以和类一样有成员函数。 C++中的struct等同于class,只是class默认成员权限是private,而struct默认成员权限是public。

2017-09-23 17:25:38 300

原创 python3上skflow安装教程

本人之前按照网上的安装教程,一直安装不成功,后来索性自己尝试安装1、网上失败的安装过程,记录一下,以防重蹈覆辙第一,需要在https://github.com/tensorflow/skflow网站上下载skflow安装包,下载好之后放在python文件夹下第二,打开cmd终端,用cd/d+skflow路径将切换到setup.py文件夹下,如下图所示操作:然后按回车

2017-09-22 09:14:37 2341

原创 使用Tensorflow自定义一个线性分类器用于对“良/恶性乳腺癌肿瘤”进行预测

import tensorflow as tfimport numpy as npimport pandas as pdtrain = pd.read_csv('breast-cancer-train.csv')test = pd.read_csv('breast-cancer-test.csv')#分割特征与分类目标x_train = np.float32(train[['Clu

2017-09-20 17:04:01 761

原创 windows-64下安装xgboost

在这里安装的xgboost不需要在VS下进行编译,很简单先在http://www.lfd.uci.edu/~gohlke/pythonlibs/#xgboost下载对应版本的xgboost,将下载的xgboost-0.6-cp36-cp36m-win_amd64.whl放在合适的地方,根据自己的喜好然后打开电脑终端,在电脑里输入如下内容,注意路径根据自己的需要进行修改:这样就可

2017-09-19 21:35:41 346

原创 windows系统64位—在python3下安装nltk

在网上找了各种安装教程,都没有在python3下安装nltk,于是我自己尝试着安装,算是成功了1、首先,假设你的python3已经安装好,并且安装了numpy,matplotlib,pandas一些常用的库,当你安装nltk时,我相信你一定具备了一些python的常用技能,所以默认你已经安装了以上常用模块2、然后,用cmd打开电脑终端,然后输入D:\Python362\Scripts\pi

2017-09-19 20:28:53 3335

原创 使用单线程对文本分类的朴素贝叶斯模型的超参数组合执行网络搜索

from sklearn.datasets import fetch_20newsgroupsimport numpy as npnews = fetch_20newsgroups(subset='all')from sklearn.model_selection import train_test_splitx_train, x_test, y_train, y_test = trai

2017-09-19 18:01:02 823 1

原创 用python实现将数组元素按从小到大的顺序排列

def findSmallest(arr): smallest = arr[0]#将第一个元素的值作为最小值赋给smallest smallest_index = 0#将第一个值的索引作为最小值的索引赋给smallest_index for i in range(1, len(arr)): if arr[i] < smallest:#对列表arr中的元素进行

2017-09-18 21:37:03 18483

原创 使用python实现二分查找

import mathdef binary_search(list0, item):#list是已知的数组,item是要在list中寻找的数 low = 0 high = len(list0) - 1 while low <= high: mid = math.floor((low + high) / 2)#Python2中有自动向下取整功能,pytho

2017-09-18 19:28:08 601

原创 tensorflow在python2和python3上的安装教程

使用本地的pip对tensorflow进行安装如果在你的电脑上既没有python2,也没有安装python3,那么请立刻安装:Tensorflow支持在windows下的python2和python3版本。需要注意的是,如果你的电脑安装的是python3,那么需要使用pip3安装包管理器对tensorflow进行安装python2:            https://www.p

2017-09-15 14:44:17 12516 5

原创 分别使用1次,2次,4次多项式回归模型在比萨训练样本上进行拟合

import matplotlib.pyplot as pltx_train = [[6], [8], [10], [14], [18]]y_train = [[7], [9], [13], [17.5], [18]]from sklearn.linear_model import LinearRegressionregressor = LinearRegression()regre

2017-09-15 13:26:21 3262

原创 使用线性回归模型在比萨训练样本上进行拟合

训练数据和测试数据代码:x_train = [[6], [8], [10], [14], [18]]y_train = [[7], [9], [13], [17.5], [18]]from sklearn.linear_model import LinearRegressionregressor = LinearRegression()regressor.fit(x_train,

2017-09-15 10:52:09 759

原创 使用Titanic 数据集,通过特征筛选的方法一步步提升决策树的预测性能

运行python机器学习及实践代码59会出错,本人经过调试对其进行改进,主要原因是因为python 的版本不同,我的是python3源代码:import pandas as pdtitanic = pd.read_csv('http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic.txt')y = titanic[

2017-09-14 21:48:43 2495 3

原创 分别使用CountVectorizer与TfidfVectorizer, 并且去掉停用词的条件下,对文本特征进行量化的朴素贝叶斯分类性能测试

from sklearn.datasets import fetch_20newsgroupsnews = fetch_20newsgroups()from sklearn.model_selection import train_test_splitx_train, x_test, y_train, y_test = train_test_split(news.data, news.ta

2017-09-14 13:36:02 2471

原创 使用TfidfVectorizer并且不去掉停用词的条件下,对文本特征进行量化的朴素贝叶斯分类性能测试

from sklearn.datasets import fetch_20newsgroupsnews = fetch_20newsgroups()from sklearn.model_selection import train_test_splitx_train, x_test, y_train, y_test = train_test_split(news.data, news.ta

2017-09-14 13:32:02 1434

原创 使用CountVectorizer并且不去掉停用词的条件下,对文本特征进行量化的朴素贝叶斯分类性能测试

from sklearn.datasets import fetch_20newsgroupsnews = fetch_20newsgroups()from sklearn.model_selection import train_test_splitx_train, x_test, y_train, y_test = train_test_split(news.data, news.ta

2017-09-14 13:28:45 1536

原创 显示手写体数字图片经PCA压缩后的二维空间分布

import pandas as pdimport numpy as npdigits_train = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/optdigits/optdigits.tra', header=None)digits_test = pd.read_csv('https://

2017-09-14 08:39:12 1246

原创 使用三种继承回归模型对美国波士顿房价训练数据进行学习,并对测试数据进行预测

from sklearn.model_selection import train_test_splitx_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.25, random_state=33)#25%数据用于测试,75%数据用于训练from sklearn.preprocessing import

2017-09-12 22:00:39 1847

原创 使用回归树对美国波士顿房价训练数据进行学习,并对测试数据进行预测

from sklearn.datasets import load_bostonboston = load_boston()#加载boston数据集import numpy as npx = boston.datay = boston.targetfrom sklearn.model_selection import train_test_splitx_train, x_test,

2017-09-12 21:41:25 2658 1

原创 使用两种不同配置的K近邻回归模型对美国波士顿房价数据进行回归预测

from sklearn.datasets import load_bostonimport numpy as npboston = load_boston()x = boston.datay = boston.targetfrom sklearn.model_selection import train_test_splitx_train, x_test, y_train, y_t

2017-09-12 20:50:24 888

原创 Tensorflow实战之用softmax Regression识别手写数字

from tensorflow.examples.tutorials.mnist import input_datamnist = input_data.read_data_sets("MNIST_data/", one_hot=True)#通过input_data.read_data_sets函数生成的类会自动将MINIST数据集划分为train,validation,testprint(m

2017-09-12 17:04:38 372

原创 利用sklearn中的支持向量机回归模型(linear,poly,rbf三种核)对boston房价进行预测并作出评估

from sklearn.datasets import load_bostonboston = load_boston()print(boston.DESCR)import numpy as pdx = boston.datay = boston.targetfrom sklearn.model_selection import train_test_splitx_train,

2017-09-12 11:04:29 14113

原创 针对python机器学习与实战代码在python3上运行出现的错误分析和warning的修改代码34—38

#导入model_selection进行数据分割from sklearn.model_selection import train_test_splitimport numpy as npx = boston.datay = boston.targetx_train, x_test, y_train, y_test = train_test_split(x, y , test_size

2017-09-12 08:43:29 15088 7

原创 运行代码,出现TypeError: fit() missing 1 required positional argument: 'y',对其进行修改

from sklearn.datasets import load_bostonboston = load_boston()print(boston.DESCR)#导入model_selection进行数据分割from sklearn.model_selection import train_test_splitimport numpy as npx = boston.datay

2017-09-12 08:35:58 87073 1

原创 DataFrame.to_dict(orient='dict')英文文档翻译

DataFrame.to_dict(orient='dict')将DataFrame格式的数据转化成字典形式参数:当然参数orient可以是字符串{'dict', 'list', 'series', 'split', 'records', 'index'}中的任意一种来决定字典中值的类型字典dict(默认):类似于{列:{索引:值}}这样格式的字典列表list:类似于{列:[值]}

2017-09-11 08:38:15 6665

原创 sklearn.datasets.fetch_20newsgroups英文文档翻译

sklearn.datasets.fetch_20newsgroups(data_home=None, subset='train', categories=None, shuffle=True, random_state=42, remove=(), download_if_missing=True)fetch_20newsgroups的作用是加载文件名,加载20个新闻群组数据集中的

2017-09-10 17:01:56 935

原创 python机器学习及实战代码13-16,程序运行时出现提醒及修改

import pandas as pdimport numpy as npcolumn_names = ['Sample code number', 'Clump Thickness', 'Uniformity of Cell Size', 'Uniformity of Cell Shape', 'Marginal Adhesion', 'Single Epithelial Cell Siz

2017-09-10 10:38:24 1094

原创 python机器学习及实战-Python基础综合实践

#读取数据import pandas as pddf_train = pd.read_csv('breast-cancer-train.csv')df_test = pd.read_csv('breast-cancer-test.csv')#print(df_train.info())#print(df_test.info())df_test_negative = df_test.

2017-09-09 21:47:42 638

原创 python机器学习4-6代码及运行结果

import urllib.requestfrom pylab import *from math import sqrtimport matplotlib.pyplot as plottarget_url = ("http://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.data")data =

2017-09-09 19:46:23 695

原创 python机器学习4-5代码及运行结果

import urllib.requestimport matplotlib.pyplot as plotfrom math import sqrt, cos, logtarget_url = ("http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv")data

2017-09-09 11:06:33 1085

原创 python机器学习4-4代码及运行结果

import urllib.requestimport sysfrom math import sqrtimport matplotlib.pyplot as plottarget_url = ("http://archive.ics.uci.edu/ml/machine-learning-databases/undocumented/connectionist-bench/sonar/

2017-09-09 09:55:37 570

原创 python机器学习4-3代码讲解

import urllib.requestimport numpyfrom sklearn import datasets, linear_modelfrom math import sqrtimport matplotlib.pyplot as plotdef S(z, gamma): if gamma >= abs(z): return 0.0 re

2017-09-08 16:40:02 433

算法导论中文版PDF

算法导论,计算机行业的经典教材,高清版本

2017-08-30

stopwords.txt

在该论坛花了2个C币下载的两份wordstop,现把它们打包在一起可以节省大家的金币

2017-08-23

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除