ubuntu下配置VIM做PHP的IDE开发环境

Ubuntu14.04 下将vim设置为IDE模式 操作系统:Ubuntu Desktop 10.04 LTS   一步步将vim改造成C/C++开发环境(IDE) 原文地址http://blog168.chinaunix.net/space.php?uid=23089249&do=blog&id=2855999 【参考资料】 吴垠的“手把手教你把Vim改装成一个IDE编程环境” 在Fedora下成功将Vim打造成适用于 阅读详情

转载自:http://cc.ecjtu.net/posts/vim-php-ide-ubuntu-NERDtree-taglist-AutoComplPop-ZenCoding

今天在ubuntu下将VIM配置成了PHP的IDE,用到了NERDtree,taglist,AutoComplPop,ZenCoding插件和一些

配置,具体步骤记录下:

安装vim:更新下源,sudo apt-get update ,然后在下载安装vim,sudo apt-get install vim。

设置在上篇文章:这里有介绍

上述设置启用了格式化高亮、行号显示,以及括号匹配、自动缩进等编辑功能,对于大多数情况都可以获得理

想的编辑体验。不过此时对.php文件的支持还不完善,需要下载专门的php插件。

下载地址:http://www.vim.org/scripts/script.php?script_id=1571
下载文件:php.tar.gz

将其中的php.vim复制到$VIM\vimfiles\syntax目录中即可。$VIM根据不同系统不同,我的是ubuntu,执行

whereis vim :

root@Cyrec-desktop:/usr/share/vim/vimfiles# whereis vim
vim: /usr/bin/vim /usr/bin/vim.basic /etc/vim /usr/share/vim /usr/share/man/man1/vim.1.gz 可以找到vim安装

在/usr/share/vim中,下面的/usr/share/vim都用$VIM代替。

一开始在设置里更换主题一直无法显示,后来找到问题的原因:

一般的Linux发行版默认的终端都是16色的,但事实上几乎所有的终端都支持256色终端。

1.将Terminal设为Xterm模式:编辑->配置文件首选项->颜色 设置为自定义,内置方案选择XTerm.

2.vimrc里设置:set t_Co=256

然后就可以随便color自己喜欢到主题了。我是用的:colorscheme desert。

打造PHP IDE

IDE左侧是目录导航,中间是编辑区域,而右侧则是方法列表,用于在已经打开的文件中快速跳转。在编辑区

域按下CTRL+X键,还会显示已打开文件的列表。 

其他诸如自动补全、代码模板等功能,都应有尽有。看过了漂亮的截图,我们就来一步步打造PHP IDE吧。

用NERDTree实现目录导航

在进行PHP应用开发时,同时编辑多个文件是很正常的事情。所以必须有一个方便的目录导航工具,以便在目

录结构间快速切换,找到需要编辑的文件。

vim中提供该类功能的插件很多,比较知名的有project、winmanager等。但笔者个人认为最好用的还是The

NERD Tree这个插件。NERDTree不但可以显示完整的目录树结构,还可以将任何一个目录设置为根目录。并

且提供了目录导航的书签功能,可谓非常方便。

下载地址:http://www.vim.org/scripts/script.php?script_id=1658
下载文件:NERD_tree.zip

解压缩时,要把压缩包中的目录结构完整的解压缩到$VIM\vimfiles目录中。完成后,应该分别找到$VIM

\vimfiles\doc\NERD_tree.txt文件和$VIM\vimfiles\plugin\NERD_tree.vim文件。然后在vim中输入命令:helptags

$VIM\vimfiles\doc,将NERDTree的帮助文档添加到vim中。

最后在_vimrc添加如下内容:

” NERDTree

map <F8> :NERDTreeToggle<CR>

重启vim后,按下F8键,就可以在左侧看到一个目录树了。在目录树窗口中按下?键可以查看详细的帮助信息

最常用的操作键有:

 按键 作用
 C(大写C键) 将光标所在目录设置为根目录
 u(小写u键) 转到上一级目录
 o(小写o键,不是“零”) 展开(或折叠)光标所在目录的子目录。如果光标所在位置是一个文件,则在编辑窗口中打开该文件

此外在目录树窗口中输入目录:Bookmark 收藏名还可以将光标所在目录添加到收藏夹中。下次使

用:BookmarkToRoot 收藏名可以直接转到该目录,并且以该目录作为根目录。更多命令可以参考NERDTree的

帮助文档。

用taglist实现代码导航

解决了目录和文件导航问题,我们还要为代码之间的跳转提供辅助手段,taglist就是这样一个插件。taglist可以

列出已打开文件中定义的类、函数、常量,甚至变量。

下载地址:http://www.vim.org/scripts/script.php?script_id=273
下载文件:taglist_45.zip

压缩包需要完整解压缩到$VIM\vimfiles目录,并且用:helptags $VIM\vimfiles\doc命令索引taglist插件的帮助文

档。taglist插件需要依赖ctags程序才能工作。目前常用的ctags版本是Exuberant Ctags。

sudo apt-get install ctags,然后whereis ctags,找到ctags: /usr/bin/ctags 这目录下的ctags。

将ctags复制到$VIM\vim72目录中即可。

最后在/etc/vim/vimrc添加下列内容,设置好taglist插件:

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"

” => Plugin configuration

“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"

” taglist

let Tlist_Auto_Highlight_Tag = 1

let Tlist_Auto_Open = 1

let Tlist_Auto_Update = 1

let Tlist_Close_On_Select = 0

let Tlist_Compact_Format = 0

let Tlist_Display_Prototype = 0

let Tlist_Display_Tag_Scope = 1

let Tlist_Enable_Fold_Column = 0

let Tlist_Exit_OnlyWindow = 0

let Tlist_File_Fold_Auto_Close = 0

let Tlist_GainFocus_On_ToggleOpen = 1

let Tlist_Hightlight_Tag_On_BufEnter = 1

let Tlist_Inc_Winwidth = 0

利用ctrl+ww来进行两个窗口之间的切换。

在taglist窗口中,可以使用下面的快捷键:

<CR>       跳到光标下tag所定义的位置,用鼠标双击此tag功能也一样
o             在一个新打开的窗口中显示光标下tag
<Space>  显示光标下tag的原型定义
u             更新taglist窗口中的tag
s             更改排序方式,在按名字排序和按出现顺序排序间切换
x             taglist窗口放大和缩小,方便查看较长的tag
+             打开一个折叠,同zo
-             将tag折叠起来,同zc
*             打开所有的折叠,同zR
=            将所有tag折叠起来,同zM
[[            跳到前一个文件
]]            跳到后一个文件
q            关闭taglist窗口
在vimrc中加下面设置可以按F6打开关闭taglist
"函数和变量列表
map <F6> :TlistToggle<CR>

用AutoComplPop实现代码自动提示

点击下面网址,进去下载autocomplpop插件

http://www.vim.org/scripts/script.php?script_id=1879

下载的是一个zip文件,解压后会有三个文件夹,分别是autoload,doc,plugin。到Vim的根目录下,找到名字

和这三个一样的文件夹。不同系统目录位置不同。我的fedora是/usr/share/vim/vimfiles

按照文件夹对应的把里面的acp.vim和其他的什么文件都copy过去。然后重启Vim。这时候可能会有错误提示

Error detected while processing /home/carlos/.vim/plugin/acp.vim:
line 13:
***** L9 library must be installed! *****

这是插件放出的一个错误提示,查看plugin里的acp.vim可以看到。是缺少L9 library库。这个也是需要下载的。地址在下面

http://www.vim.org/scripts/script.php?script_id=3252

下载下来,它也是一个插件形式,以同样的方式copy到Vim目录下。

安装完后就可以了。

再就是这个插件默认是没有设置php自动补全的,可以设置一个PHP函数字典,让其根据字典的内容进行自动

补全。

这个是一个PHP字典:.
编辑配置文件.vimrc,在文件后面加上下面的代码
au FileType php setlocal dict+=/etc/vim/php_funclist.txt
后面跟着的是字典的目录地址,根据自己的需求存放在一个地方就好。我是放到了/etc/vim/目录下。

php_funclist下载:php_funclist.tar.gz

再附加一些自动补全配置(加入到vimrc中):

php 中 一般是会在 "$", "->", "::" 后需要出现自动补全,在 .vimrc 中加入以下代码:

if !exists('g:AutoComplPop_Behavior')
    let g:AutoComplPop_Behavior = {}
    let g:AutoComplPop_Behavior['php'] = []
    call add(g:AutoComplPop_Behavior['php'], {
            \   'command'   : "\<C-x>\<C-o>", 
            \   'pattern'   : printf('\(->\|::\|\$\)\k\{%d,}$', 0),
            \   'repeat'    : 0,
            \})
endif

在 Vim 中实现括号自动补全:

:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>

function ClosePair(char)

if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf

这样,写代码的时候不再担心会丢掉右边的括号了,尤其是函数嵌套的时候。

安装ZenCoding插件

到http://github.com/mattn/zencoding-vim下载压缩包,然后解压到vimfiles文件夹,和上面一样,将doc plugin

autoload三个文件夹放到相应文件夹下。然后在vim中输入helptags /etc/vim/doc 导入帮助文件.就OK了。

zencoing可以很方便的写html,一些常用命令:

输入 div>p#foo$*3>a 这样的缩写,然后按 ctrl + y + , 来展开(注意那个逗号),展开后它应该是这个样子的

 <div>
      <p id="foo1">
          <a href=""></a>
      </p>
      <p id="foo2">
          <a href=""></a>
      </p>
      <p id="foo3">
          <a href=""></a>
      </p>
  </div>
  • 多行缩写

输入如下:

test1
test2
test3

然后进入行选择模式,选中这三行按 ctrl + y + ,,接着它会提示你要使用的tag名称,TAG: 输入 ‘ul>li* 会变成如下的样子

<ul>
    <li>test1</li>
    <li>test2</li>
    <li>test3</li>
</ul>

如果是输入blockquote,那么会变成这样

  <blockquote>
      test1
      test2
      test3
  </blockquote>
  • 跳转到下一个标签编辑位置

输入ctrl + y + n 进入插入模式

  • 跳转到上一个标签编辑位置

输入ctrl + y + N 进入插入模式

  • 更新标签中图片大小

假如有以下内容

<img src="foo.png" />

光标移动到img标签上,按下ctrl + y + i 该插件会自动获取foo.png的大小并插入宽高属性 看起来像这个样子

<img src="foo.png" width="32" height="48" />
  • 切换注释

如有以下段

<div>
    hello world
</div>

光标移动到此段落,输入ctrl + y + /变成

<!-- <div>
    hello world
</div> -->

再次输入则还原

  • 生成url连接

将光标移动到一个url上,如:

http://www.google.com/

输入ctrl + y + a 它会自动获取url页面的标题并生成一个连接

<a href="http://www.google.com/"></a>

Zen Coding官方提供的速查手册(PDF):http://zen-coding.googlecode.com/files/ZenCodingCheatSheet.pdf

配置OK了,最后上张帅气的vim图:

21432532452.png


vim 配置文件 vimrc 较适用于php开发 vimrc 安装配置(前提要安装git) 按如下几步操作: 1、vimrc 放到vim 目录下 2、vimfiles 新建bundle目录 3、下载插件(https://github.com/gmarik/vundle)将vundle整个目录丢进bundle目录 4、下面见证奇迹的时刻到了 命令行输入:BundleInstall 回车 哦了 此配置包涵一下插件: Bundle 'gmarik/vundle' " My Bundles here: " " original repos on github Bundle 'mattn/zencoding-vim' Bundle 'Lokaltog/vim-powerline' Bundle 'Shougo/neocomplcache' Bundle 'Shougo/vimproc' "Bundle 'Shougo/neosnippet' Bundle 'Shougo/vimshell' Bundle 'scrooloose/nerdtree' Bundle 'scrooloose/nerdcommenter' Bundle 'pangloss/vim-javascript' Bundle 'drmingdrmer/xptemplate' Bundle 'tpope/vim-surround' Bundle '2072/PHP-Indenting-for-VIm' Bundle 'Townk/vim-autoclose' Bundle 'sukima/xmledit' " vim-scripts repos Bundle 'L9' Bundle 'FuzzyFinder' Bundle 'taglist.vim' Bundle 'jsbeautify' Bundle 'FencView.vim' Bundle 'bufexplorer.zip' Bundle 'matchit.zip' Bundle 'YankRing.vim' Bundle 'SQLComplete.vim' 哈哈完工 vim配置so easy!!!!! 立即下载

相关推荐

Podman修改镜像源教程(附最新docker镜像源)

Podman修改镜像源教程(附最新docker镜像源)

道长的博客 4151

vim配置php开发环境

vim是很多程序员喜爱的代码编辑器,对于phper来说,我们需要配置和添加一些插件来方便我们进行开发。

梦回故里 862

一张图看懂中国民航适航审定体系:从适航司到审定中心,到底谁管谁?

本文深入解析中国民航适航审定体系,从立法层到执行层的完整链条,揭示适航管理的金字塔结构和核心流程。涵盖适航司、审定中心等关键机构职能,以及型号审定、生产许可审定等全生命周期管理,展现中国适航体系的特色实践与创新探索。

weixin_30896511的博客 487

使用Vim配置一个高效的PHP开发环境

将vim配置成php开发环境

书山路遥 7300

从零开始:用7353张VOC/YOLO格式混凝土缺陷数据集训练你的第一个检测模型

本文详细介绍了如何使用7353张VOC/YOLO格式的混凝土缺陷数据集训练首个目标检测模型。从环境配置、数据解析到YOLOv5模型训练与优化,提供了完整的实战指南,特别针对数据不平衡问题给出了解决方案,助力开发者快速掌握混凝土缺陷识别技术。

weixin_42651281的博客 265

[OrCad电路板设计系统].Orcad.Pspice.9.2下载安装

Orcad.Pspice.9.2详细下载安装图文步骤1 安装前准备工作1.1 下载安装包1.2 解压2 安装时步骤2.1 安装文件2.2 破解文件3 安装完成 1 安装前准备工作 1.1 下载安装包 打开百度网盘APP 链接:https://pan.baidu.com/s/1cMFxHUvuh5iEhFVT-lvciQ 提取码:7m65 1.2 解压 解压下载好的安装包 2 安装时步骤 2.1 安装文件 1.点击Setup安装文件,出现警告对话框,告诉你应该关闭所有病毒防火墙,点击确定 2.进入安装界面,

weixin_48924581的博客 1万+

ubuntu vim php ide,Ubuntu 12.04 vim IDE 插件安装和配置(上) | 学步园

一直很羡慕别人在Ubuntu下面很华丽的Vim界面,今天下定决定来搞一搞首先要知道.vimrc全局配置文件的作用。在目录 /etc/ 下面,有个名为vimrc的文件,这是系统中公共的vim配置文件,对所有用户都有效。而在每个用户的主目录($HOME)下,都可以自己建立私有的配置文件(仅对这个用户有效),命名为:“.vimrc”。例如,/root目录下,通常已经存在一个.vimrc文件。我就是在自己...

weixin_39732825的博客 212

Arch Linux 命令大全,值得收藏!

Arch Linux 是一款轻量级、高度可定制的 Linux 发行版,以其简洁和强大的特性深受高级用户喜爱。但对于新手来说,完全掌握 Arch Linux 的操作需要时间和实践。本文将为您详细介绍常用的 Arch Linux 命令,涵盖系统管理、文件操作、用户管理、软件安装与管理、网络配置和磁盘管理等内容,帮助您更高效地使用 Arch Linux。

网络技术联盟站 981

ubuntu vim php ide,基于Ubuntu 16.04 配置 Vim IDE

1.序言本文是本人在Ubuntu 16.04上Vim IDE搭建过程的总结。在Windows环境开发的小伙伴也许都知道sourceinsight这款编辑器,为了提高Linux下开发效率,本人搭建了类sourceinsight的IDE开发环境(勉强称作VIM IDE吧:))。废话不多,先上图展示本人的VIM IDE。 一个窗口同时显示了4个子终端窗口(当然也可以有更多),每一个子终端窗口类似sour...

weixin_36015213的博客 287

【跳频通信】基于MATLAB的跳频通信系统仿真

同时,跳频通信也具有良好的抗干扰能力,即使有部分频点被干扰,仍能在其他未被干扰的频点上进行正常的通信。由于跳频通信系统是瞬时窄带系统,它易于与其他的窄带通信系统兼容,也就是说,跳频电台可以与常规的窄带电台互通,有利于设备的更新。跳频是最常用的扩频方式之一,其工作原理是指收发双方传输信号的载波频率按照预定规律进行离散变化的通信方式,也就是说,通信中使用的载波频率受伪随机变化码的控制而随机跳变。从通信技术的实现方式来说,“跳频”是一种用码序列进行多频频移键控的通信方式,也是一种码控载频跳变的通信系统。

FPGA/MATLAB学习教程/源码/项目合作开发 6273

从零开始跑通3DGS教程:(四)修改(缩放、空间变换)colmap生成的sfm结果

通过colmap进行的sfm的普通方式会丢失场景的物理尺度信息,并且并不在符合一般认知的坐标系下,本文将读取colmap生成的点云和相机pose,将其进行空间变换和缩放之后,重新保存,新保存的结果仍然可以被colmap读取以及进行后续的稠密重建以及3dgs等工作

诺有缸的高飞鸟的博客 1433

vim 打造成php ide,两个命令把 Vim 打造成 Python IDE的方法

curl -O https://raw.githubusercontent.com/vince67/v7_config/master/vim.shbash vim.sh截图示例做了什么写了个方便的bash脚本,用来配置VIM使用的配置来自 fisa-vim-config 效果爆炸附脚本:•注意一: 每次运行本脚本,会把旧的 ~/.vimrc 文件备份到 /tmp/vimrc.bak ,并替换原来的...

weixin_36050604的博客 152

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

ubuntu创建vim php文件,ubuntu下配置VIM做PHP的IDE开发环境

转载自:http://cc.ecjtu.net/posts/vim-php-ide-ubuntu-NERDtree-taglist-AutoComplPop-ZenCoding今天在ubuntu下将VIM配置成了PHP的IDE,用到了NERDtree,taglist,AutoComplPop,ZenCoding插件和一些配置,具体步骤记录下:安装vim:更新下源,sudo apt-get upda...

weixin_35462903的博客 278

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

ubuntu创建vim php文件,ubuntu下配置VIM做PHP的IDE開發環境

轉載自:http://cc.ecjtu.net/posts/vim-php-ide-ubuntu-NERDtree-taglist-AutoComplPop-ZenCoding今天在ubuntu下將VIM配置成了PHP的IDE,用到了NERDtree,taglist,AutoComplPop,ZenCoding插件和一些配置,具體步驟記錄下:安裝vim:更新下源,sudo apt-get upda...

weixin_35985162的博客 149

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Vim PHP环境设置文章

可能有重复: 在ubuntu 上配置vim的PHP开发环境http://blog.csdn.net/robertaqi/article/details/6117546 手把手教你把Vim改装成一个IDE编程环境(图文):http://blog.csdn.net/wooin/article/details/1858917 用Gvim建立IDE编程环境 (Windows篇)http...

dechen6073的博客 98

配置vim

ubuntu搭建C/C++环境附VIM的常用命令表 发布于: January 25, 2012, 5:21 am分类: linux,web服务器作者: Cyrec阅读: [2382] 1,配置gcc 刚装好的的gcc什么文件都不能编译,因为没有一些必须的头文件,所以必须安装build-essential包,安装这 个包会安装上g++、libc6-dev、linux-libc-dev、l

u010258505的专栏 745

配置VIM做PHP的IDE开发环境

转自:http://cc.ecjtu.net/posts/vim-php-ide-ubuntu-NERDtree-taglist-AutoComplPop-ZenCoding 今天在ubuntu下将VIM配置成了PHP的IDE,用到了NERDtree,taglist,AutoComplPop,ZenCoding插件和一些 配置,具体步骤记录下: 安装vim:更新下源,

jibing57的学习摘录 1560

Atom 安装与使用

Atom是一款由GitHub开发的开源文本编辑器,基于Web技术构建,支持丰富的插件扩展,可作为轻量级IDE使用。文章介绍了Ubuntu系统下通过PPA源安装/卸载Atom的方法,以及MacOS的下载安装步骤。重点推荐了常用插件:汉化包、代码运行工具Script、Vim模式插件,并分类列举了Python、PHP、JavaScript等语言的开发辅助插件,包括自动补全、语法检查、调试等功能。文中还提供了快捷键操作说明(如Ctrl+Shift+B运行代码)和相关参考链接。

人无远虑,必有近忧 5099

Ubuntu配置C++开发环境以及Vim的配置

Ubuntu配置C++开发环境以及Vim的配置1. 安装gcc, g++环境新的ubuntu系统一般都已经安装好,可通过 “gcc –version” 以及 “g++ –version” 查看是否已经安装好;如果没有安装,命令如下:sudo apt-get install build-essential sudo apt-get install g++-4.42. 安装Vimsudo apt-get

simple笔记 1万+

Vim【常用插件】安装 & 使用方法:一步一步配置VIM开发环境

1、ctags 功能:代码追踪 安装方法 sudo apt-get install ctags //Ubuntu安装ctags whatis ctags //查看是否安装成功 使用方法 1、在代码根目录下执行命令:【ctags -R】用于生成代码索引关系 2、生成完成之后便可以使用快捷键来进行追踪与跳出追踪操作了 命令 含义 ctrl+] 追踪...

Ace's Blog 8396

ubuntu vim开发php,window下用vim做php开发环境(虽然小弟我一直是在ubuntu下用vim).

window下用vim做php开发环境(虽然我一直是在ubuntu下用vim)...虽然vim本质上只是一个编辑器。但只要配合一些适当的插件,vim也能变成一个全功能的IDE。笔者使用vim已经有挺长一段时间了,经过反复的试验,配置了一个高效的PHP开发环境,实为居家旅行、谋财害命、杀人越货必备之良品。安装vim鉴于大多数读者都是使用Windows环境,所以本文就以Windows作为运行环境。不过...

weixin_39562928的博客 130

ubuntu创建vim php文件,window下用vim做php开发环境(虽然小弟我一直是在ubuntu下用vim)....

window下用vim做php开发环境(虽然我一直是在ubuntu下用vim)...虽然vim本质上只是一个编辑器。但只要配合一些适当的插件,vim也能变成一个全功能的IDE。笔者使用vim已经有挺长一段时间了,经过反复的试验,配置了一个高效的PHP开发环境,实为居家旅行、谋财害命、杀人越货必备之良品。安装vim鉴于大多数读者都是使用Windows环境,所以本文就以Windows作为运行环境。不过...

weixin_42515295的博客 181

Ubuntu下将vim配置为Python IDE

转载自:http://tntcastle.net/2012/09/ubuntu%E4%B8%8B%E5%B0%86vim%E9%85%8D%E7%BD%AE%E4%B8%BApython-ide/ 工欲善其事,必先利其器。 配置好了Django的环境,该把vim好好配置一下当做python的IDE来用。 在Windows下用惯了各种现成的工具,转到Linux下,一下没了头绪…

wulong710的专栏 1416
上一篇: Ubuntu12.04 更新源
下一篇: 开启Ubuntu下lamp的php错误提示
KUN_PHP
博客等级 码龄14年 1粉丝 29原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值