Lightspeed matlab toolbox
=========================
This library provides:
* highly optimized versions of mathematical functions such as `normcdf`, set intersection, and `gammaln`
* efficient random number generators
* evaluation of common probability densities
* routines for counting floating-point
operations (FLOPS), useful for benchmarking algorithms.
* utilities such as filename globbing and parsing of variable-length argument lists.
* graphics functions such as `axis_pct` and `mobile_text` (in the graphics subdirectory).
See Contents.m for a table of contents.
Also see my general tips on [accelerating matlab](http://tminka.github.io/software/matlab/).
Flop counting
=============
Matlab is frequently used for research, so I have included routines
that faciliate research.
In particular, Lightspeed features a set of routines for accurate
floating-point operation (flop) counting. These flop counts allow
machine-independent and programmer-independent comparison of numerical
algorithms, because they represent the minimal number of operations that
the algorithm needs. Consequently, you can compare algorithms based on
their Matlab implementations alone, without having to code them efficiently
in C and report their run time on a particular processor.
Hopefully these routines will allow more informative algorithm
comparisons in research papers.
The flop count routines in lightspeed are significantly more accurate than
the `flops` function which was included in Matlab up to version 5.
For example, according to Matlab 5, `inv(3)` requires more flops
than `1/3`. Matlab 5 also returned slightly
incorrect flop counts for matrix multiplies and overly pessimistic flop
counts for solving linear systems. Lightspeed always returns the minimal
number of flops for matrix operations, as though the best possible
algorithm was used, no matter what method you are actually using.
Perhaps the biggest difference between flop counting in lightspeed versus
Matlab 5 is the handling of special functions like `exp` and
`sqrt`. Matlab 5 counted these as one flop, which is much too low.
A more accurate count for `exp`, based on the
Pentium 4 processor, is 40 flops. Similarly, `sqrt` is 8 flops.
Interestingly, the run time in Matlab 6 for `sqrt` is
significantly longer than `exp`, and even longer than the time
for `x^(0.51)` (raising to an arbitrary power other than 0.5).
This emphasizes the importance of measuring the `idealized' run time,
represented by flops, rather than the actual run time, which is subject to
odd inefficiencies in Matlab (or any programming language).
Flop counting in lightspeed is a more manual process than in Matlab 5. In Matlab 5, the flop counter is incremented automatically after every operation. Lightspeed does not increment the flop counter automatically. Instead, you must specify which operations should have their flops counted. For example, after performing a matrix multiply you should call `addflops(flops_mul(...))`, and after every Cholesky decomposition you should call `addflops(flops_chol(...))`. Some operations do not have a dedicated flops routine. For these you should consult the help for `flops`.
Manual flop counting has two advantages. First, it can be different from the operation that you actually performed, allowing you to count the flops for an `idealized' algorithm rather than the one you implemented. Second, since only the operations that you explicitly count get added to the flop counter, unrelated operations (such as debugging code) will not interfere with the result.
Incrementing the flop counter on every operation can cause your code to run slower. To avoid this, you can batch up the count for many operations. For example, to get the flop count for a loop, you can save time by computing the flops for one iteration of the loop and then multiply by the number of iterations. For examples, see [fastfit/dirichlet_fit_newton.m](https://github.com/tminka/fastfit/blob/master/dirichlet_fit_newton.m) or [logreg/train_cg.m](https://github.com/tminka/logreg/blob/master/train_cg.m).
Installation
============
The toolbox has been tested on all versions of Matlab from 6.5 to 8.4 with
Windows XP, Vista, 7, and 8. It has been tested on 32-bit and 64-bit machines, with Microsoft Visual Studio 2008-2013 (Professional and Express Editions). It should work on Macs and Linux as well. Most (but not all) functions work with Matlab 6.1 and 5.
You can place the lightspeed directory anywhere.
To make sure lightspeed is always in your path, create a startup.m
file in your matlab directory, if you don't already have one, and add
a line like this:
addpath(genpath('c:\matlab\lightspeed'))
Replace 'c:\matlab\lightspeed' with the location of the lightspeed directory.
There are some Matlab Extension (MEX) files that need to be compiled.
This can be done in matlab via:
cd c:\matlab\lightspeed
install_lightspeed
I recommend using Microsoft Visual C++ as the mex compiler, though this is not required. You can set the mex compiler by typing 'mex -setup' in matlab.
You can find timing tests in the tests/ subdirectory.
The test_lightspeed.m script will run all tests, and is a good way to check
that lightspeed installed properly.
Troubleshooting
===============
If you are having problems compiling the mex files, check your matlab installation by compiling one of the examples that comes with matlab, such as:
mex([matlabroot '/extern/examples/mex/explore.c'])
If this does not work, then contact MathWorks for help. You can find some common fixes below.
To use Microsoft Visual C++ 2013 with Matlab 8.1 (R2013a), you will need to download this patch:
http://www.mathworks.com/matlabcentral/fileexchange/45878-setting-microsoft-visual-c++-2013-as-default-mex-compiler
To use Microsoft Visual C++ 2010 with Matlab 7.10 (R2010a), you will need to download this patch:
http://www.mathworks.com/support/solutions/en/data/1-D5W493/?solution=1-D5W493
To use Microsoft Visual C++ 2008 on Windows 64-bit, you will need to follow the instructions at:
http://www.mathworks.com/matlabcentral/answers/98351-how-can-i-set-up-microsoft-visual-studio-2008-express-edition-for-use-with-matlab-7-7-r2008b-on-64
To use Microsoft Visual C++ with Matlab 7.0 (R14), you will need to download
R14 service pack 2, as described here:
http://www.mathworks.com/support/solutions/en/data/1-UMEKK/?solution=1-UMEKK
To compile mex files on a Snow Leopard upgrade, prior to Matlab R2014a:
1. Go to mexopts.sh in your $HOME/.matlab/ directory, and change the line SDKROOT='/Developer/SDKs/MacOSX10.5.sdk' to SDKROOT='/Developer/SDKs/MacOSX10.6.sdk'. That line is not updated during updating mac OSX, so you need to do manually. This file also exists in the standard matlab bin, so if you run mex with the -v option it will tell you which mexopts.sh file it's looking at.
2. You may also need to change some lines in install_lightspeed.m. By default, install_lightspeed.m is set up for 64-bit MacOSX 10.6 with gcc-4.0. If you are using some other version of MacOSX or some other compiler, then you need to edit a few lines (see the comments in that file).
Changelist
==========
### 2.8
Changed to MIT license. intersect_sorted provides multiple outputs, for compatibility with intersect. Added support for different number types to randbinom and int_hist. Added graphics/draw_loess. Fixes to install_lightspeed, flops_solve, hhist, cut_quantile.
### 2.7
Added the hist2 function.
Updated the installer to handle Matlab versions up to R2014b. In version R2014a and later, installation on Mac is now much easier. In version R2013b and later, lightspeed does not replace Matlab's built-in repmat, because the built-in is now faster. Congratulations to MathWorks---it only took them 11 years to catch up with lightspeed's repmat. Perhaps now they can try making sum(x,2) run as fast as lightspeed's row_sum.
### 2.6
Updated the installer to handle MacOSX 10.6 and older ve
没有合适的资源?快使用搜索试试~ 我知道了~
matlab代码粒子群算法-bayes_opt_mat:BayesOptMat:MATLAB的贝叶斯优化
共3470个文件
fig:2064个
m:931个
mat:133个
需积分: 49 29 下载量 117 浏览量
2021-05-27
02:09:49
上传
评论 3
收藏 191.69MB ZIP 举报
温馨提示
matlab代码粒子群算法BayesOptMat:MATLAB的贝叶斯优化 这是使用修正的高斯过程优化。 使用不同的采集功能执行贝叶斯全局优化。 除其他功能外,还可以使用BayesOptMat优化物理实验并调整机器学习算法的参数。 该代码具有以下附加功能: 采集函数优化的优化方法的其他选项,包括粒子群优化(PSO),CMAES,DIRECT, 贝叶斯优化诊断和测井工具,以测试优化速度和效率; 可视化和动画实用程序,用于低维数据和测试目标函数,以及性能指标的图表。 设置 根文件夹包含文件start.m ,该文件将相关依赖项添加到当前路径。 执行任何操作之前,请确保运行此文件。 根文件夹还包含有关如何使用各种功能的演示文件,并且这些方法具有有关其输入和输出的注释。
资源详情
资源评论
资源推荐
收起资源包目录
matlab代码粒子群算法-bayes_opt_mat:BayesOptMat:MATLAB的贝叶斯优化 (3470个子文件)
install_random.bat 1KB
dtrsm.c 11KB
util.c 10KB
matfile.c 9KB
repmat.c 8KB
random.c 7KB
randbinom.c 5KB
mcholC.c 4KB
ndsumC.c 4KB
test_flops.c 3KB
solve_triu.c 3KB
solve_tril.c 3KB
int_hist.c 2KB
solve_chol.c 2KB
lbfgsC.c 2KB
lbfgsProdC.c 2KB
table1.c 2KB
gammaln.c 1KB
setnonzeros.c 1KB
sample_hist.c 1KB
randomseed.c 1KB
digamma.c 1KB
mexutil.c 1KB
tetragamma.c 1KB
trigamma.c 1KB
randgamma.c 883B
xones.c 802B
lbfgsAddC.c 768B
flops.c 472B
sameobject.c 407B
getaddress.c 370B
addflops.c 320B
changelog 257B
Copyright 2KB
matlabprogram.cpp 7KB
lbfgsb.cpp 4KB
program.cpp 4KB
arrayofmatrices.cpp 2KB
matlabmatrix.cpp 2KB
matlabstring.cpp 1KB
matlabscalar.cpp 984B
timing.cpp 874B
matlabexception.cpp 512B
style.css 77B
uber-raw-data-sep14.csv 45.34MB
uber-raw-data-aug14.csv 36.55MB
uber-raw-data-jul14.csv 35.16MB
Dial7_B00887.csv 32.79MB
uber-raw-data-jun14.csv 29.27MB
uber-raw-data-may14.csv 28.78MB
CrawledData.csv 25.62MB
uber-raw-data-apr14.csv 24.9MB
Prestige_B01338.csv 17.85MB
Skyline_B00111.csv 10.93MB
BeijingData.csv 10.43MB
Carmel_B00256.csv 9.47MB
Lyft_B02510.csv 8.95MB
CrawledData.csv 8.56MB
Highclass_B01717.csv 7.56MB
Firstclass_B01536.csv 7.44MB
Diplo_B01196.csv 5.31MB
American_B01362.csv 5.07MB
ShanghaiData.csv 4.17MB
CrawledData.csv 3.34MB
other-FHV-data-jan-aug-2015.csv 1.38MB
M3C_Monthly_blocked.csv 938KB
M3C_Monthly.csv 938KB
chimet.csv 812KB
bramblemet.csv 734KB
sotonmet.csv 638KB
cambermet.csv 529KB
Federal_02216.csv 61KB
Chi06Apr2017.csv 28KB
Chi07Apr2017.csv 28KB
Chi31Mar2017.csv 28KB
Chi30Mar2017.csv 28KB
Chi02Apr2017.csv 28KB
Chi03Apr2017.csv 28KB
Chi01Apr2017.csv 28KB
Chi04Apr2017.csv 28KB
Chi28Mar2017.csv 28KB
Chi29Mar2017.csv 28KB
Chi27Mar2017.csv 28KB
Chi26Mar2017.csv 28KB
Chi06Apr2017.csv 21KB
Chi07Apr2017.csv 21KB
Chi31Mar2017.csv 21KB
Chi30Mar2017.csv 21KB
Chi02Apr2017.csv 21KB
Chi03Apr2017.csv 21KB
Chi04Apr2017.csv 21KB
Chi01Apr2017.csv 21KB
Chi28Mar2017.csv 21KB
Chi29Mar2017.csv 21KB
Chi27Mar2017.csv 21KB
Chi26Mar2017.csv 21KB
Cam30Mar2017.csv 19KB
Cam28Mar2017.csv 19KB
Cam27Mar2017.csv 19KB
Cam31Mar2017.csv 19KB
共 3470 条
- 1
- 2
- 3
- 4
- 5
- 6
- 35
weixin_38581308
- 粉丝: 2
- 资源: 893
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0