Caffeinated Logistic Regression of HDF5 Data
来源:互联网 发布:天盾安卓微信恢复软件 编辑:程序博客网 时间:2024/04/30 20:55
Caffeinated Logistic Regression of HDF5 Data
该例子是利用Caffe完成一个浅层模型的训练,这里使用手工生成的数据训练一个logistic regression for classification。手工生成的数据将保存到HDF5中,然后以向量的形式输入到Caffe中。例子中分别对比了sklearn-learn库和两个Caffe模型进行训练和预测,对比了训练时间和精度,可以看到Caffe在较少的时间内可以获得较高的训练精度。
整个过程包括:定义模型、实验和部署。l
本文为了运行于本机,只做了细微修改和中文说明,原始文件来源于Caffe官网对应的Notebook Examples。http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/hdf5_classification.ipynb
---Last update 2015年6月7日
Setup
import numpy as npimport pandas as pdimport matplotlib.pyplot as plt%matplotlib inline# 切换工作目录到 caffe-master%cd '/home/ouxinyu/caffe-master'# Make sure that caffe is on the python path:caffe_root = './' # this file is expected to be in {caffe_root}/examplesimport syssys.path.insert(0, caffe_root + 'python')import caffeimport osimport h5pyimport shutilimport tempfile# You may need to 'pip install scikit-learn'import sklearnimport sklearn.datasetsimport sklearn.linear_model
生成训练数据
生成10000个4-vectors的向量用于binary分类,包含2种informative feature和2种noise features。
X, y = sklearn.datasets.make_classification( n_samples=10000, n_features=4, n_redundant=0, n_informative=2, n_clusters_per_class=2, hypercube=False, random_state=0)# Split into train and testX, Xt, y, yt = sklearn.cross_validation.train_test_split(X, y)# Visualize sample of the dataind = np.random.permutation(X.shape[0])[:1000]df = pd.DataFrame(X[ind])_ = pd.scatter_matrix(df, figsize=(9, 9), diagonal='kde', marker='o', s=40, alpha=.4, c=y[ind])
阅读全文
0 0
- Caffeinated Logistic Regression of HDF5 Data
- An Interpretation of Logistic Regression
- 笔记 of Andrew Ng , Linear Regression 和 Logistic Regression
- logistic regression
- logistic regression
- logistic regression
- Logistic Regression
- Logistic Regression
- logistic regression
- Logistic Regression
- Logistic Regression
- logistic regression
- Logistic regression
- Logistic Regression
- Logistic Regression
- Logistic Regression
- Logistic Regression
- Logistic Regression
- 参考资料整合
- Docker初学者
- L1-009. N个数求和
- js解析json的两种方法
- ng ui-route的toState, toParams, fromState, fromParams
- Caffeinated Logistic Regression of HDF5 Data
- 纪中集训d1 提高A组模拟
- Siamese network embedding 该例子是利用Caffe完成Siamese网络的特征抽取和plotting的例子。本文为了运行于本机,只做了细微修改和中文说明,原始文件来源于Ca
- 杭电 OJ 1302 The Snail
- 使用Qt编写opengl学习路线
- PLC梯形图编程基础知识详解
- POJ-3352 Road Construction(边双连通分量+缩点)
- java8之内存篇
- Js 获取客户区大小