亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lbfgs.java

?? dragontoolkit用于機器學習
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package dragon.ml.seqmodel.crf;/* RISO: an implementation of distributed belief networks. * Copyright (C) 1999, Robert Dodier. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA, * or visit the GNU web site, www.gnu.org. *//** <p> This class contains code for the limited-memory Broyden-Fletcher-Goldfarb-Shanno  * (LBFGS) algorithm for large-scale multidimensional unconstrained minimization problems.  * This file is a translation of Fortran code written by Jorge Nocedal.  * The only modification to the algorithm is the addition of a cache to  * store the result of the most recent line search. See <tt>solution_cache</tt> below.  *  * LBFGS is distributed as part of the RISO project. Following is a message from Jorge Nocedal:  * <pre>  *   From: Jorge Nocedal [mailto:nocedal@dario.ece.nwu.edu]  *   Sent: Friday, August 17, 2001 9:09 AM  *   To: Robert Dodier  *   Subject: Re: Commercial licensing terms for LBFGS?  *  *   Robert:  *   The code L-BFGS (for unconstrained problems) is in the public domain.  *   It can be used in any commercial application.  *  *   The code L-BFGS-B (for bound constrained problems) belongs to  *   ACM. You need to contact them for a commercial license. It is  *   algorithm 778.  *  *   Jorge  * </pre>  *  * <p> This code is derived from the Fortran program <code>lbfgs.f</code>.  * The Java translation was effected mostly mechanically, with some  * manual clean-up; in particular, array indices start at 0 instead of 1.  * Most of the comments from the Fortran code have been pasted in here  * as well.</p>  *  * <p> Here's some information on the original LBFGS Fortran source code,  * available at <a href="http://www.netlib.org/opt/lbfgs_um.shar">  * http://www.netlib.org/opt/lbfgs_um.shar</a>. This info is taken  * verbatim from the Netlib blurb on the Fortran source.</p>  *  * <pre>  * 	file    opt/lbfgs_um.shar  * 	for     unconstrained optimization problems  * 	alg     limited memory BFGS method  * 	by      J. Nocedal  * 	contact nocedal@eecs.nwu.edu  * 	ref     D. C. Liu and J. Nocedal, ``On the limited memory BFGS method for  * 	,       large scale optimization methods'' Mathematical Programming 45  * 	,       (1989), pp. 503-528.  * 	,       (Postscript file of this paper is available via anonymous ftp  * 	,       to eecs.nwu.edu in the directory pub/lbfgs/lbfgs_um.)  * </pre>  *  * @author Jorge Nocedal: original Fortran version, including comments  * (July 1990). Robert Dodier: Java translation, August 1997.  */public class LBFGS{    /** Specialized exception class for LBFGS; contains the      * <code>iflag</code> value returned by <code>lbfgs</code>.      */    public static class ExceptionWithIflag extends Exception    {		private static final long serialVersionUID = 1L;		public int iflag;        public ExceptionWithIflag( int i, String s ) { super(s); iflag = i; }        public String toString() { return getMessage()+" (iflag == "+iflag+")"; }    }    /** Controls the accuracy of the line search <code>mcsrch</code>. If the      * function and gradient evaluations are inexpensive with respect      * to the cost of the iteration (which is sometimes the case when      * solving very large problems) it may be advantageous to set <code>gtol</code>      * to a small value. A typical small value is 0.1.  Restriction:      * <code>gtol</code> should be greater than 1e-4.      */    public static double gtol = 0.9;    /** Specify lower bound for the step in the line search.      * The default value is 1e-20. This value need not be modified unless      * the exponent is too large for the machine being used, or unless      * the problem is extremely badly scaled (in which case the exponent      * should be increased).      */    public static double stpmin = 1e-20;    /** Specify upper bound for the step in the line search.      * The default value is 1e20. This value need not be modified unless      * the exponent is too large for the machine being used, or unless      * the problem is extremely badly scaled (in which case the exponent      * should be increased).      */    public static double stpmax = 1e20;    /** The solution vector as it was at the end of the most recently      * completed line search. This will usually be different from the      * return value of the parameter <tt>x</tt> of <tt>lbfgs</tt>, which      * is modified by line-search steps. A caller which wants to stop the      * optimization iterations before <tt>LBFGS.lbfgs</tt> automatically stops      * (by reaching a very small gradient) should copy this vector instead      * of using <tt>x</tt>. When <tt>LBFGS.lbfgs</tt> automatically stops,      * then <tt>x</tt> and <tt>solution_cache</tt> are the same.      */    public static double[] solution_cache = null;    private static double gnorm = 0, stp1 = 0, ftol = 0, stp[] = new double[1], ys = 0, yy = 0, sq = 0, yr = 0, beta = 0, xnorm = 0;    private static int iter = 0, nfun = 0, point = 0, ispt = 0, iypt = 0, maxfev = 0, info[] = new int[1], bound = 0, npt = 0, cp = 0, i = 0, nfev[] = new int[1], inmc = 0, iycn = 0, iscn = 0;    private static boolean finish = false;    private static double[] w = null;    /** This method returns the total number of evaluations of the objective      * function since the last time LBFGS was restarted. The total number of function      * evaluations increases by the number of evaluations required for the      * line search; the total is only increased after a successful line search.      */    public static int nfevaluations() { return nfun; }    /** This subroutine solves the unconstrained minimization problem      * <pre>      *     min f(x),    x = (x1,x2,...,x_n),      * </pre>      * using the limited-memory BFGS method. The routine is especially      * effective on problems involving a large number of variables. In      * a typical iteration of this method an approximation <code>Hk</code> to the      * inverse of the Hessian is obtained by applying <code>m</code> BFGS updates to      * a diagonal matrix <code>Hk0</code>, using information from the previous M steps.      * The user specifies the number <code>m</code>, which determines the amount of      * storage required by the routine. The user may also provide the      * diagonal matrices <code>Hk0</code> if not satisfied with the default choice.      * The algorithm is described in "On the limited memory BFGS method      * for large scale optimization", by D. Liu and J. Nocedal,      * Mathematical Programming B 45 (1989) 503-528.      *      * The user is required to calculate the function value <code>f</code> and its      * gradient <code>g</code>. In order to allow the user complete control over      * these computations, reverse  communication is used. The routine      * must be called repeatedly under the control of the parameter      * <code>iflag</code>.      *      * The steplength is determined at each iteration by means of the      * line search routine <code>mcsrch</code>, which is a slight modification of      * the routine <code>CSRCH</code> written by More' and Thuente.      *      * The only variables that are machine-dependent are <code>xtol</code>,      * <code>stpmin</code> and <code>stpmax</code>.      *      * Progress messages and non-fatal error messages are printed to <code>System.err</code>.      * Fatal errors cause exception to be thrown, as listed below.      *      * @param n The number of variables in the minimization problem.      *		Restriction: <code>n &gt; 0</code>.      *      * @param m The number of corrections used in the BFGS update.      *		Values of <code>m</code> less than 3 are not recommended;      *		large values of <code>m</code> will result in excessive      *		computing time. <code>3 &lt;= m &lt;= 7</code> is recommended.      *		Restriction: <code>m &gt; 0</code>.      *      * @param x On initial entry this must be set by the user to the values      *		of the initial estimate of the solution vector. On exit with      *		<code>iflag = 0</code>, it contains the values of the variables      *		at the best point found (usually a solution).      *      * @param f Before initial entry and on a re-entry with <code>iflag = 1</code>,      *		it must be set by the user to contain the value of the function      *		<code>f</code> at the point <code>x</code>.      *      * @param g Before initial entry and on a re-entry with <code>iflag = 1</code>,      *		it must be set by the user to contain the components of the      *		gradient <code>g</code> at the point <code>x</code>.      *      * @param diagco  Set this to <code>true</code> if the user  wishes to      *		provide the diagonal matrix <code>Hk0</code> at each iteration.      *		Otherwise it should be set to <code>false</code> in which case      *		<code>lbfgs</code> will use a default value described below. If      *		<code>diagco</code> is set to <code>true</code> the routine will      *		return at each iteration of the algorithm with <code>iflag = 2</code>,      *		and the diagonal matrix <code>Hk0</code> must be provided in      *		the array <code>diag</code>.      *      * @param diag If <code>diagco = true</code>, then on initial entry or on      *		re-entry with <code>iflag = 2</code>, <code>diag</code>      *		must be set by the user to contain the values of the      *		diagonal matrix <code>Hk0</code>. Restriction: all elements of      *		<code>diag</code> must be positive.      *      * @param iprint Specifies output generated by <code>lbfgs</code>.      *		<code>iprint[0]</code> specifies the frequency of the output:      *		<ul>      *		<li> <code>iprint[0] &lt; 0</code>: no output is generated,      *		<li> <code>iprint[0] = 0</code>: output only at first and last iteration,      *		<li> <code>iprint[0] &gt; 0</code>: output every <code>iprint[0]</code> iterations.      *		</ul>      *      *		<code>iprint[1]</code> specifies the type of output generated:      *		<ul>      *		<li> <code>iprint[1] = 0</code>: iteration count, number of function      *			evaluations, function value, norm of the gradient, and steplength,      *		<li> <code>iprint[1] = 1</code>: same as <code>iprint[1]=0</code>, plus vector of      *			variables and  gradient vector at the initial point,      *		<li> <code>iprint[1] = 2</code>: same as <code>iprint[1]=1</code>, plus vector of      *			variables,      *		<li> <code>iprint[1] = 3</code>: same as <code>iprint[1]=2</code>, plus gradient vector.      *		</ul>      *      *	@param eps Determines the accuracy with which the solution      *		is to be found. The subroutine terminates when      *		<pre>      *            ||G|| &lt; EPS max(1,||X||),      *		</pre>      *		where <code>||.||</code> denotes the Euclidean norm.      *      *	@param xtol An estimate of the machine precision (e.g. 10e-16 on a      *		SUN station 3/60). The line search routine will terminate if the      *		relative width of the interval of uncertainty is less than      *		<code>xtol</code>.      *      * @param iflag This must be set to 0 on initial entry to <code>lbfgs</code>.      *		A return with <code>iflag &lt; 0</code> indicates an error,      *		and <code>iflag = 0</code> indicates that the routine has      *		terminated without detecting errors. On a return with      *		<code>iflag = 1</code>, the user must evaluate the function      *		<code>f</code> and gradient <code>g</code>. On a return with      *		<code>iflag = 2</code>, the user must provide the diagonal matrix      *		<code>Hk0</code>.      *      *		The following negative values of <code>iflag</code>, detecting an error,      *		are possible:      *		<ul>      *		<li> <code>iflag = -1</code> The line search routine      *			<code>mcsrch</code> failed. One of the following messages      *			is printed:      *			<ul>      *			<li> Improper input parameters.      *			<li> Relative width of the interval of uncertainty is at      *				most <code>xtol</code>.      *			<li> More than 20 function evaluations were required at the      *				present iteration.      *			<li> The step is too small.      *			<li> The step is too large.      *			<li> Rounding errors prevent further progress. There may not      *				be  a step which satisfies the sufficient decrease and      *				curvature conditions. Tolerances may be too small.      *			</ul>      *		<li><code>iflag = -2</code> The i-th diagonal element of the diagonal inverse      *			Hessian approximation, given in DIAG, is not positive.      *		<li><code>iflag = -3</code> Improper input parameters for LBFGS      *			(<code>n</code> or <code>m</code> are not positive).      *		</ul>      *      *	@throws LBFGS.ExceptionWithIflag      */    public static void lbfgs ( int n , int m , double[] x , double f , double[] g , boolean diagco , double[] diag , int[] iprint , double eps , double xtol , int[] iflag ) throws ExceptionWithIflag    {        boolean execute_entire_while_loop = false;        if ( w == null || w.length != n*(2*m+1)+2*m )        {            w = new double[ n*(2*m+1)+2*m ];        }        if ( iflag[0] == 0 )        {            // Initialize.            solution_cache = new double[n];            System.arraycopy( x, 0, solution_cache, 0, n );            iter = 0;            if ( n <= 0 || m <= 0 )            {                iflag[0]= -3;                throw new ExceptionWithIflag( iflag[0], "Improper input parameters  (n or m are not positive.)" );            }            if ( gtol <= 0.0001 )            {                System.err.println( "LBFGS.lbfgs: gtol is less than or equal to 0.0001. It has been reset to 0.9." );                gtol= 0.9;            }            nfun= 1;            point= 0;            finish= false;            if ( diagco )            {                for ( i = 1 ; i <= n ; i += 1 )                {                    if ( diag [ i -1] <= 0 )                    {                        iflag[0]=-2;                        throw new ExceptionWithIflag( iflag[0], "The "+i+"-th diagonal element of the inverse hessian approximation is not positive." );                    }                }            }            else            {                for ( i = 1 ; i <= n ; i += 1 )                {                    diag [ i -1] = 1;                }            }            ispt= n+2*m;            iypt= ispt+n*m;            for ( i = 1 ; i <= n ; i += 1 )            {                w [ ispt + i -1] = - g [ i -1] * diag [ i -1];            }            gnorm = Math.sqrt ( ddot ( n , g , 0, 1 , g , 0, 1 ) );            stp1= 1/gnorm;            ftol= 0.0001;            maxfev= 20;            if ( iprint [ 1 -1] >= 0 ) lb1 ( iprint , iter , nfun , gnorm , n , m , x , f , g , stp , finish );            execute_entire_while_loop = true;        }        while ( true )        {            if ( execute_entire_while_loop )            {                iter= iter+1;                info[0]=0;                bound=iter-1;                if ( iter != 1 )

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文在线资源观看网站视频免费不卡| 香蕉久久夜色精品国产使用方法| 亚洲欧美另类综合偷拍| 日韩av电影免费观看高清完整版 | 日韩精品福利网| 国产91高潮流白浆在线麻豆 | 国产色综合一区| 香蕉乱码成人久久天堂爱免费| 国产成人精品网址| 337p亚洲精品色噜噜狠狠| 亚洲欧美怡红院| 国产电影精品久久禁18| 日韩精品一区二区三区蜜臀| 亚洲成人一区二区在线观看| 99久久精品免费| 欧美国产精品一区| 国产精品一区二区三区乱码 | 久久久www成人免费毛片麻豆| 日韩和欧美一区二区| 91在线视频播放| 国产精品久久久久久久午夜片| 韩日av一区二区| 日韩精品专区在线影院观看| 日韩精品国产精品| 欧美日韩国产123区| 亚洲一区二区三区四区五区中文 | 国产不卡在线视频| 国产亚洲短视频| 国产福利不卡视频| 久久精品亚洲麻豆av一区二区 | 成人深夜视频在线观看| 久久精品日产第一区二区三区高清版| 久久电影网站中文字幕| 日韩欧美在线不卡| 蜜桃视频第一区免费观看| 制服丝袜成人动漫| 秋霞成人午夜伦在线观看| 日韩免费一区二区三区在线播放| 奇米影视一区二区三区小说| 欧美一级高清片| 国产一区在线看| 国产精品久久久久久久第一福利 | 亚洲欧美一区二区久久| 欧美午夜精品电影| 青椒成人免费视频| 久久色视频免费观看| 高清日韩电视剧大全免费| 国产精品久久久久久久久搜平片 | 成人国产精品视频| 亚洲欧洲日韩在线| 欧美日本韩国一区二区三区视频 | 日韩精品电影在线观看| 欧美白人最猛性xxxxx69交| 国产精品一区二区免费不卡| 中文字幕第一区二区| 在线区一区二视频| 麻豆精品精品国产自在97香蕉| 国产亚洲精品超碰| 欧美优质美女网站| 国精产品一区一区三区mba桃花 | 日韩你懂的在线播放| 成人永久免费视频| 丝袜美腿一区二区三区| 精品国产一区二区国模嫣然| 成人av电影在线| 日产国产欧美视频一区精品| 国产欧美一区二区精品性色| 日本精品一级二级| 国产精品18久久久久久久久久久久 | √…a在线天堂一区| 欧美精三区欧美精三区| 国产精品一区在线观看乱码| 亚洲一区二区三区免费视频| 久久综合资源网| 欧美在线观看18| 成人午夜激情在线| 秋霞av亚洲一区二区三| 亚洲六月丁香色婷婷综合久久| 日韩天堂在线观看| 91麻豆自制传媒国产之光| 精品无人区卡一卡二卡三乱码免费卡 | 一区二区三区小说| 久久精品欧美一区二区三区麻豆| 91福利小视频| 成人在线视频一区二区| 精品一区二区三区免费| 亚洲一区二区不卡免费| 国产精品久久久久久久久免费樱桃 | 91精品国产一区二区三区香蕉| 国产大陆a不卡| 天堂va蜜桃一区二区三区| 亚洲欧美一区二区在线观看| 欧美videossexotv100| 欧美午夜片在线观看| av日韩在线网站| 国产91精品精华液一区二区三区 | 亚洲一区二区三区在线播放 | 精品国产免费视频| 精品视频一区二区三区免费| 北条麻妃国产九九精品视频| 国产精品综合久久| 麻豆精品精品国产自在97香蕉| 日本中文字幕一区二区视频| 亚洲一区二区欧美| 亚洲一区精品在线| 亚洲午夜久久久久久久久电影网| 亚洲视频一区二区免费在线观看| 久久久久久久综合日本| 精品久久久网站| 久久综合久久综合九色| 日韩欧美电影一区| 精品久久一区二区| 国产亚洲欧美一区在线观看| 久久久精品国产99久久精品芒果 | 777色狠狠一区二区三区| 欧美三级资源在线| 欧美色视频在线| 欧美久久一区二区| 欧美一区2区视频在线观看| 在线不卡免费av| 日韩美女视频在线| 久久品道一品道久久精品| 久久精品日韩一区二区三区| 中文字幕乱码亚洲精品一区| 国产精品成人午夜| 亚洲综合一区二区| 日韩1区2区日韩1区2区| 国产精一区二区三区| 成人国产亚洲欧美成人综合网| 91麻豆精品视频| 精品视频一区三区九区| 日韩免费高清av| 国产精品午夜在线| 亚洲综合色区另类av| 奇米影视7777精品一区二区| 国产呦萝稀缺另类资源| 99国产精品一区| 欧美日韩精品系列| 久久影视一区二区| 国产精品国产三级国产a | 激情欧美日韩一区二区| 国产suv精品一区二区三区| av在线不卡电影| 91.麻豆视频| 中文字幕第一区综合| 午夜精品福利一区二区三区av| 久久99国产精品久久99 | 欧美日韩成人激情| 精品动漫一区二区三区在线观看| 中文久久乱码一区二区| 一区二区三区在线免费播放| 奇米精品一区二区三区在线观看| 成人小视频免费观看| 精品视频资源站| 国产精品不卡在线观看| 天堂成人国产精品一区| 北岛玲一区二区三区四区| 91精品国产手机| 亚洲欧美日韩国产综合| 久久99精品网久久| 欧美性xxxxxx少妇| 国产精品久久久久久户外露出 | 欧美一区二区三区免费观看视频 | 欧美三级一区二区| 国产欧美久久久精品影院| 亚瑟在线精品视频| 成人app软件下载大全免费| 日韩欧美精品在线| 亚洲一区在线播放| 不卡一区二区中文字幕| 久久综合久久鬼色| 日本亚洲免费观看| 欧美性大战久久久| 亚洲男人天堂av| 成人激情黄色小说| 久久女同精品一区二区| 日本女优在线视频一区二区| 色天使久久综合网天天| 国产人成一区二区三区影院| 麻豆一区二区三| 91精品国产91综合久久蜜臀| 亚洲va国产天堂va久久en| 91美女精品福利| 亚洲欧美中日韩| 成人精品高清在线| 国产精品日韩成人| 成人网男人的天堂| 国产欧美一区二区在线观看| 九九在线精品视频| 91精品国产综合久久久久久| 亚洲gay无套男同| 欧美撒尿777hd撒尿| 亚洲一区二区在线免费看| 91蝌蚪porny成人天涯| 欧美国产禁国产网站cc| 国产一区三区三区| 国产偷v国产偷v亚洲高清| 成人中文字幕合集| 国产精品高潮呻吟久久| 91一区在线观看|