- 博客(42)
- 收藏
- 关注
原创 Code实现注册系统服务
主要用到三个Functions:#define RegOpenKeyEx RegOpenKeyExARegOpenKeyExA( _In_ HKEY hKey, _In_opt_ LPCSTR lpSubKey, _In_opt_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResul
2017-10-23 16:32:03 832
原创 获取路径下所有文件
#include #include #include #include #include #include using namespace std;void GetAllFiles(string path, vector& files){ long hfile = 0; struct _finddata_t fileinfo; string p; if ((hfile =
2017-10-23 15:42:41 399
原创 Console 模式与Windows模式互换
有时候Project需要将console模式与windows模式互换。其实,非常简单。大致有二点改动:1.程序入口。int main(int argc, char **argv) int wWinMain(HINSTANCE,HINSTANCE,LPWSTR,int)
2017-10-12 17:05:41 2568
翻译 Applying Machine Learning to Sentiment Analysis
1. Obtaining the IMDb movie review dataset :A compressed archive of the movie review dataset ---- http://ai.stanford.edu/~amaas/data/sentiment/import pandas as pddf = pd.read_csv('./datasets
2017-04-27 19:39:44 484
原创 make_unique的使用
关于make_unique的构造及使用例程,MSDN的讲解非常详细 (https://msdn.microsoft.com/zh-cn/library/dn439780.aspx )使用过程中,我的理解主要有这么几个关键点:1. make_unique 同 unique_ptr 、auto_ptr 等一样,都是 smart pointer,可以取代new 并且无需 delete
2017-04-25 22:16:31 32630
翻译 Leveraging weak learners via adaptive boosting(AdaBoost)
In this section about ensemble methods, we discussboosting with a special focus on its most common implementation,AdaBoost 。1. Via the base_estimatorattribute, we train the AdaBoostClassifier
2017-04-25 21:07:56 298
翻译 Bagging – building an ensemble of classifers from bootstrap samples
1. Create a more complex classifcation problem using theWine datasetimport pandas as pddf_wine = pd.read_csv('./datasets/wine/wine.data', header=None)# https://archive.
2017-04-24 21:55:08 325
原创 三种C/C++创建文件夹的方法
第一种:调用MFC封装好的接口函数,主要会用到 PathIsDirectory //判断是否存在::CreateDirectory //创建例如: #include "shlwapi.h" #pragma comment(lib,"shlwapi.lib") #include CString path = "../../../STL/stl2"; if (!PathIsDirec
2017-04-23 22:56:33 23208
原创 获取指定路径下所有文件的C++函数
#include #include #include std::vector getAllFiles(const std::string inputpath){ std::vector allfiles; struct _finddata_t fileinfo; std::string path; auto hfile = _findfirst(path.assign(inputp
2017-04-22 21:10:07 404
翻译 Evaluating and tuning the ensemble classifer
1. Compute the ROC curves from the test set to check if theMajorityVoteClassifier generalizes well to unseen data .from sklearn.metrics import roc_curvefrom sklearn.metrics import auccolors =
2017-04-22 13:55:24 303
翻译 Implementing a simple majority vote classifer
start with a warm-up exercise and implement a simpleensemble classifer for majority voting in Python.Although the following algorithm also generalizes to multi-class settings via plurality voting,
2017-04-22 12:49:59 687
翻译 Learning with ensembles
The goal behind ensemble methodsis to combine different classifers into a meta-classifer that has a better generalization performance than each individual classifer alone。focus on the most popular
2017-04-22 12:19:48 339
翻译 Plotting a receiver operating characteristic(ROC)
Receiver operator characteristic (ROC)graphs are useful tools for selecting models for classifcation based on their performance with respect to the false positive andtrue positive rates, which are
2017-04-19 21:00:37 316
翻译 Learning Best Practices for Model Evaluation and Hyperparameter Tuning
1. Streamlining workflows with pipelines 1.1 Loading the Breast Cancer Wisconsin datasetfrom distutils.version import LooseVersion as Versionfrom sklearn import __version__ as sklearn_vers
2017-04-18 22:41:51 501
翻译 Kernel principal component analysis in scikit-learn
For our convenience, scikit-learn implements a kernel PCA class in the sklearn.decompositionsubmodule. The usage is similar to the standard PCA class, and we can specify the kernel via thekernel p
2017-04-16 16:44:03 421
翻译 Projecting new data points
In this section, We learn how to project data points that were not part of the training dataset .1. modify the rbf_kernel_pca function returns the eigenvalues of the kernel matrix:from sc
2017-04-16 16:33:06 272
翻译 Using kernel principal component analysis for nonlinear mappings
Take a look at a kernelized version of PCA, or kernel PCA, which relates to the concepts of kernel SVM.Using kernel PCA, we will learn how to transform data that is not linearly separable onto a n
2017-04-15 10:16:54 280
翻译 Supervised data compression via LDA
Linear Discriminant Analysis (LDA) can be used as a technique for feature extraction to increase the computational effciency and reduce the degree of over-ftting due to the curse of dimensionality i
2017-04-12 21:36:11 413
翻译 Unsupervised dimensionality reduction via PCA
1. Total and explained variance 1.1 process theWine data into separate training and test setsimport pandas as pdfrom sklearn.model_selection import train_test_splitfrom sklearn.prep
2017-04-11 22:57:03 577
翻译 Sparse solutions with L1 regularization
1. Common solutions to reduce the generalization error are listed as follows :• Collect more training data• Introduce a penalty for complexity via regularization【L1、 L2】• Choose a simple
2017-04-10 22:37:59 401
原创 生成caffe训练过程中需要的图片描述文本
使用caffe的时候,需要先将图片生成描述文本,然后通过 convert_imageset 根据该描述文本生成 LMDB 或者 LEVELD 格式数据,用于Training 。当图片数据很多的,就需要通过脚本来实现。我写了个 shell 脚本来实现。首先,把图片放入不同类的目录下。例如: 2. 运行脚本 #!/usr/bin/env sh
2017-04-10 11:05:20 302
翻译 K-nearest neighbors(KNN) learning algorithm
1. Call functionfrom sklearn.neighbors import KNeighborsClassifierknn = KNeighborsClassifier(n_neighbors=5, p=2, metric='minkowski')knn.fit(X_train_std, y_train)2. Plt resultplot_de
2017-04-09 16:15:16 344
翻译 Decision tree learning
1. Building a decision tree from sklearn.tree import DecisionTreeClassifiertree = DecisionTreeClassifier(criterion='entropy', max_depth=3, random_state=0)tree.fit(X_train, y_train)X_combined
2017-04-09 12:46:23 378
翻译 Solving non-linear problems using a kernel SVM
1. Create a simple dataset that has the form of an XOR gate using thelogical_xorfunction from NumPy .np.random.seed(0)X_xor = np.random.randn(200, 2)y_xor = np.logical_xor(X_xor[:, 0] > 0,
2017-04-09 12:21:14 300
翻译 Dealing with the nonlinearly separable case using slack variables
1. Train a SVM model :from sklearn.svm import SVCsvm = SVC(kernel='linear', C=1.0, random_state=0)svm.fit(X_train_std, y_train)plot_decision_regions(X_combined_std, y_combined, classifier=svm
2017-04-09 11:04:18 283
翻译 Training a logistic regression model with scikit-learn
1. Since scikit-learn implements a highly optimized version oflogistic regression that also supports multiclass settings off-the-shelf, we will skip the implementation and use the sklearn.linear_mod
2017-04-08 22:17:52 463
翻译 Training a perceptron via scikit-learn
1. Load Dataimport numpy as npfrom sklearn import datasetsiris = datasets.load_iris()X = iris.data[:, [2, 3]]y = iris.target2. Split data into train and testfrom distutils.version impo
2017-04-08 21:23:53 472
翻译 Large scale machine learning in Python
class AdalineSGD(object): def __init__(self, eta=0.01, n_iter=10, shuffle=True, random_state=None): self.eta = eta self.n_iter = n_iter self.w_initialized = False
2017-04-08 14:55:03 353
翻译 Implementing an Adaptive Linear Neuron in Python
class AdalineGD(object): def __init__(self, eta=0.01, n_iter=50): self.eta = eta self.n_iter = n_iter def fit(self, X, y): self.w_ = np.zeros(1 + X.shape[1]) s
2017-04-08 14:25:30 394
翻译 Implementing a perceptron learning algorithm in Python
class Perceptron(object): def __init__(self, eta=0.01, n_iter=10): self.eta = eta self.n_iter = n_iter def fit(self, X, y): self.w_ = np.zeros(1 + X.shape[1])
2017-04-08 14:05:57 443
原创 Python下Caffe的使用
前面编译成功caffe的python接口,就可以 import caffe 调用了。先通过caffe自带的draw_net.py 玩玩看。选择examples 下 lenet_train_test.prototxt 、bvlc_caffenet_full_conv.prototxt。一般来说,开始会出现错误,因为缺少 dot.exe 完成 visualization 。
2017-02-23 20:49:40 664
原创 编译Caffe 的 Python 接口
pycaffe.vcxproj -> C:\projects\caffe-windows\windows\..\Build\Win32\Release\_caffe.pyd PythonPostBuild.cmd : copy python generated scripts to output. C:\projects\caffe-windows\windows\..\python\
2017-02-21 15:55:41 1597
翻译 Handwritten digit recognition with ANNs
digits_ann .py :import cv2import cPickleimport numpy as npimport gzipdef load_data(): mnist = gzip.open('mnist.pkl.gz', 'rb') training_data, classification_data, test_data = cPickle.
2017-02-12 15:38:07 558
翻译 MotionDetect_OpenCV_Python
Reference to 《learning opencv3 computer vision with python》import cv2import numpy as npcamera = cv2.VideoCapture(0)es = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (9, 4))kernel = np.one
2017-02-11 23:09:27 1287
翻译 CAMShift_OpenCV_Python
Reference to 《learning opencv3 computer vision with python》import numpy as npimport cv2cap = cv2.VideoCapture(0)# take first frame of the videoret, frame = cap.read()# setup initial loca
2017-02-11 22:58:49 2211
原创 DIY水果店收银软件
先前在水果店买单,看见人家是通过将水果编码,结账的时候输入水果的ID就可以了。其实这个软件不难,主要就是UI+逻辑实现+database,于是自己就动手写了个。One------UI界面:client.py:# -*- coding: utf-8 -*-from PyQt4 import QtCore, QtGuitry: _fromUtf8 = QtCore.QSt
2017-01-21 19:16:53 1517
原创 Python抓取CSV文件中数据【V2】
前面 《Python抓取CSV文件中数据》是通过Python 的csv模块直接调用。但这周自己在做一个one-person project的时候,发现这样后面数据管理会有些不方便,就转而选择数据库pysql了(安装:pip install pymysql)。第一步,安装MySQL,通过Table Data Import wizard导入.csv文件。第二步,MySQL测试链接。
2017-01-20 07:27:43 884
原创 Linux下查看程序所需动态链接库
分享一个linux环境下程序开发时很可能会用的命令——ldd 。尤其是当我们调用了第三库支持,一般来说,程序设计时会安装整个库,但实际程序需要的并不会是整个库,这时候我们只要通过 ldd 就可以很清晰的查看其动态链接库。例如:也就是说,如果这个OpenCV_Detection给人使用,要保证对应目录下有这几个链接库文件。对于一些独立的、特殊的库文件,copy就可以了,而不用安装第三
2017-01-13 15:32:30 8315
原创 Python抓取CSV文件中数据
最近在用Caffe_Windows做CNN分类识别。先前数据采集这块不是由我负责的,今天突然也想把这块跑通,这样后面就可以玩一些自己的想要的识别了。由于CNN training Datasets特别重要,抓取数据必不可少。例程数据集:wget -c https://storage.googleapis.com/openimages/2016_08/images_2016_08_v5.tar.g
2017-01-12 17:27:12 5058
原创 python模块调用心得体会
我们知道,python流行的很大的原因就是代码模块化,开源供他人使用------https://pypi.python.org/pypi 。当我们调用模块时,一般来说,都需要看简介等,但是对于如何具体调用其函数、类,并不是很清楚。好在python规定了模块化必须有 __init__.py文件,通过该文件可以看到类、函数、宏定义等。以 一个新手使用OpenCV为例,假设我想做对图片做轮廓
2017-01-11 16:52:58 562
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人