commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r857558 [6/39] - in /websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3: ./ analysis/ analysis/differentiation/ analysis/interpolation/ complex/ dfp/ distribution/ distribution/fitting/ exc...
Date Sat, 06 Apr 2013 23:42:02 GMT
Modified: websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.html (original)
+++ websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.html Sat Apr  6 23:42:01 2013
@@ -23,117 +23,138 @@
 <FONT color="green">020</FONT>    import org.apache.commons.math3.stat.correlation.Covariance;<a name="line.20"></a>
 <FONT color="green">021</FONT>    import org.apache.commons.math3.linear.RealMatrix;<a name="line.21"></a>
 <FONT color="green">022</FONT>    <a name="line.22"></a>
-<FONT color="green">023</FONT>    import org.junit.After;<a name="line.23"></a>
-<FONT color="green">024</FONT>    import org.junit.Assert;<a name="line.24"></a>
-<FONT color="green">025</FONT>    import org.junit.Before;<a name="line.25"></a>
-<FONT color="green">026</FONT>    import org.junit.Test;<a name="line.26"></a>
-<FONT color="green">027</FONT>    <a name="line.27"></a>
-<FONT color="green">028</FONT>    /**<a name="line.28"></a>
-<FONT color="green">029</FONT>     * Test cases for {@link MultivariateNormalDistribution}.<a name="line.29"></a>
-<FONT color="green">030</FONT>     */<a name="line.30"></a>
-<FONT color="green">031</FONT>    public class MultivariateNormalDistributionTest {<a name="line.31"></a>
-<FONT color="green">032</FONT>        /**<a name="line.32"></a>
-<FONT color="green">033</FONT>         * Test the ability of the distribution to report its mean value parameter.<a name="line.33"></a>
-<FONT color="green">034</FONT>         */<a name="line.34"></a>
-<FONT color="green">035</FONT>        @Test<a name="line.35"></a>
-<FONT color="green">036</FONT>        public void testGetMean() {<a name="line.36"></a>
-<FONT color="green">037</FONT>            final double[] mu = { -1.5, 2 };<a name="line.37"></a>
-<FONT color="green">038</FONT>            final double[][] sigma = { { 2, -1.1 },<a name="line.38"></a>
-<FONT color="green">039</FONT>                                       { -1.1, 2 } };<a name="line.39"></a>
-<FONT color="green">040</FONT>            final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);<a name="line.40"></a>
-<FONT color="green">041</FONT>    <a name="line.41"></a>
-<FONT color="green">042</FONT>            final double[] m = d.getMeans();<a name="line.42"></a>
-<FONT color="green">043</FONT>            for (int i = 0; i &lt; m.length; i++) {<a name="line.43"></a>
-<FONT color="green">044</FONT>                Assert.assertEquals(mu[i], m[i], 0);<a name="line.44"></a>
-<FONT color="green">045</FONT>            }<a name="line.45"></a>
-<FONT color="green">046</FONT>        }<a name="line.46"></a>
-<FONT color="green">047</FONT>    <a name="line.47"></a>
-<FONT color="green">048</FONT>        /**<a name="line.48"></a>
-<FONT color="green">049</FONT>         * Test the ability of the distribution to report its covariance matrix parameter.<a name="line.49"></a>
-<FONT color="green">050</FONT>         */<a name="line.50"></a>
-<FONT color="green">051</FONT>        @Test<a name="line.51"></a>
-<FONT color="green">052</FONT>        public void testGetCovarianceMatrix() {<a name="line.52"></a>
-<FONT color="green">053</FONT>            final double[] mu = { -1.5, 2 };<a name="line.53"></a>
-<FONT color="green">054</FONT>            final double[][] sigma = { { 2, -1.1 },<a name="line.54"></a>
-<FONT color="green">055</FONT>                                       { -1.1, 2 } };<a name="line.55"></a>
-<FONT color="green">056</FONT>            final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);<a name="line.56"></a>
-<FONT color="green">057</FONT>    <a name="line.57"></a>
-<FONT color="green">058</FONT>            final RealMatrix s = d.getCovariances();<a name="line.58"></a>
-<FONT color="green">059</FONT>            final int dim = d.getDimension();<a name="line.59"></a>
-<FONT color="green">060</FONT>            for (int i = 0; i &lt; dim; i++) {<a name="line.60"></a>
-<FONT color="green">061</FONT>                for (int j = 0; j &lt; dim; j++) {<a name="line.61"></a>
-<FONT color="green">062</FONT>                    Assert.assertEquals(sigma[i][j], s.getEntry(i, j), 0);<a name="line.62"></a>
-<FONT color="green">063</FONT>                }<a name="line.63"></a>
-<FONT color="green">064</FONT>            }<a name="line.64"></a>
-<FONT color="green">065</FONT>        }<a name="line.65"></a>
-<FONT color="green">066</FONT>    <a name="line.66"></a>
-<FONT color="green">067</FONT>        /**<a name="line.67"></a>
-<FONT color="green">068</FONT>         * Test the accuracy of sampling from the distribution.<a name="line.68"></a>
-<FONT color="green">069</FONT>         */<a name="line.69"></a>
-<FONT color="green">070</FONT>        @Test<a name="line.70"></a>
-<FONT color="green">071</FONT>        public void testSampling() {<a name="line.71"></a>
-<FONT color="green">072</FONT>            final double[] mu = { -1.5, 2 };<a name="line.72"></a>
-<FONT color="green">073</FONT>            final double[][] sigma = { { 2, -1.1 },<a name="line.73"></a>
-<FONT color="green">074</FONT>                                       { -1.1, 2 } };<a name="line.74"></a>
-<FONT color="green">075</FONT>            final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);<a name="line.75"></a>
-<FONT color="green">076</FONT>            d.reseedRandomGenerator(50);<a name="line.76"></a>
-<FONT color="green">077</FONT>    <a name="line.77"></a>
-<FONT color="green">078</FONT>            final int n = 500000;<a name="line.78"></a>
-<FONT color="green">079</FONT>    <a name="line.79"></a>
-<FONT color="green">080</FONT>            final double[][] samples = d.sample(n);<a name="line.80"></a>
-<FONT color="green">081</FONT>            final int dim = d.getDimension();<a name="line.81"></a>
-<FONT color="green">082</FONT>            final double[] sampleMeans = new double[dim];<a name="line.82"></a>
-<FONT color="green">083</FONT>    <a name="line.83"></a>
-<FONT color="green">084</FONT>            for (int i = 0; i &lt; samples.length; i++) {<a name="line.84"></a>
-<FONT color="green">085</FONT>                for (int j = 0; j &lt; dim; j++) {<a name="line.85"></a>
-<FONT color="green">086</FONT>                    sampleMeans[j] += samples[i][j];<a name="line.86"></a>
-<FONT color="green">087</FONT>                }<a name="line.87"></a>
-<FONT color="green">088</FONT>            }<a name="line.88"></a>
-<FONT color="green">089</FONT>    <a name="line.89"></a>
-<FONT color="green">090</FONT>            final double sampledValueTolerance = 1e-2;<a name="line.90"></a>
-<FONT color="green">091</FONT>            for (int j = 0; j &lt; dim; j++) {<a name="line.91"></a>
-<FONT color="green">092</FONT>                sampleMeans[j] /= samples.length;<a name="line.92"></a>
-<FONT color="green">093</FONT>                Assert.assertEquals(mu[j], sampleMeans[j], sampledValueTolerance);<a name="line.93"></a>
-<FONT color="green">094</FONT>            }<a name="line.94"></a>
-<FONT color="green">095</FONT>    <a name="line.95"></a>
-<FONT color="green">096</FONT>            final double[][] sampleSigma = new Covariance(samples).getCovarianceMatrix().getData();<a name="line.96"></a>
-<FONT color="green">097</FONT>            for (int i = 0; i &lt; dim; i++) {<a name="line.97"></a>
-<FONT color="green">098</FONT>                for (int j = 0; j &lt; dim; j++) {<a name="line.98"></a>
-<FONT color="green">099</FONT>                    Assert.assertEquals(sigma[i][j], sampleSigma[i][j], sampledValueTolerance);<a name="line.99"></a>
-<FONT color="green">100</FONT>                }<a name="line.100"></a>
-<FONT color="green">101</FONT>            }<a name="line.101"></a>
-<FONT color="green">102</FONT>        }<a name="line.102"></a>
-<FONT color="green">103</FONT>    <a name="line.103"></a>
-<FONT color="green">104</FONT>        /**<a name="line.104"></a>
-<FONT color="green">105</FONT>         * Test the accuracy of the distribution when calculating densities.<a name="line.105"></a>
-<FONT color="green">106</FONT>         */<a name="line.106"></a>
-<FONT color="green">107</FONT>        @Test<a name="line.107"></a>
-<FONT color="green">108</FONT>        public void testDensities() {<a name="line.108"></a>
-<FONT color="green">109</FONT>            final double[] mu = { -1.5, 2 };<a name="line.109"></a>
-<FONT color="green">110</FONT>            final double[][] sigma = { { 2, -1.1 },<a name="line.110"></a>
-<FONT color="green">111</FONT>                                       { -1.1, 2 } };<a name="line.111"></a>
-<FONT color="green">112</FONT>            final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);<a name="line.112"></a>
-<FONT color="green">113</FONT>    <a name="line.113"></a>
-<FONT color="green">114</FONT>            final double[][] testValues = { { -1.5, 2 },<a name="line.114"></a>
-<FONT color="green">115</FONT>                                            { 4, 4 },<a name="line.115"></a>
-<FONT color="green">116</FONT>                                            { 1.5, -2 },<a name="line.116"></a>
-<FONT color="green">117</FONT>                                            { 0, 0 } };<a name="line.117"></a>
-<FONT color="green">118</FONT>            final double[] densities = new double[testValues.length];<a name="line.118"></a>
-<FONT color="green">119</FONT>            for (int i = 0; i &lt; densities.length; i++) {<a name="line.119"></a>
-<FONT color="green">120</FONT>                densities[i] = d.density(testValues[i]);<a name="line.120"></a>
-<FONT color="green">121</FONT>            }<a name="line.121"></a>
-<FONT color="green">122</FONT>    <a name="line.122"></a>
-<FONT color="green">123</FONT>            // From dmvnorm function in R 2.15 CRAN package Mixtools v0.4.5<a name="line.123"></a>
-<FONT color="green">124</FONT>            final double[] correctDensities = { 0.09528357207691344,<a name="line.124"></a>
-<FONT color="green">125</FONT>                                                5.80932710124009e-09,<a name="line.125"></a>
-<FONT color="green">126</FONT>                                                0.001387448895173267,<a name="line.126"></a>
-<FONT color="green">127</FONT>                                                0.03309922090210541 };<a name="line.127"></a>
-<FONT color="green">128</FONT>    <a name="line.128"></a>
-<FONT color="green">129</FONT>            for (int i = 0; i &lt; testValues.length; i++) {<a name="line.129"></a>
-<FONT color="green">130</FONT>                Assert.assertEquals(correctDensities[i], densities[i], 1e-16);<a name="line.130"></a>
-<FONT color="green">131</FONT>            }<a name="line.131"></a>
-<FONT color="green">132</FONT>        }<a name="line.132"></a>
-<FONT color="green">133</FONT>    }<a name="line.133"></a>
+<FONT color="green">023</FONT>    import java.util.Random;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.junit.After;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.junit.Assert;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.junit.Before;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.junit.Test;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Test cases for {@link MultivariateNormalDistribution}.<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class MultivariateNormalDistributionTest {<a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Test the ability of the distribution to report its mean value parameter.<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        @Test<a name="line.36"></a>
+<FONT color="green">037</FONT>        public void testGetMean() {<a name="line.37"></a>
+<FONT color="green">038</FONT>            final double[] mu = { -1.5, 2 };<a name="line.38"></a>
+<FONT color="green">039</FONT>            final double[][] sigma = { { 2, -1.1 },<a name="line.39"></a>
+<FONT color="green">040</FONT>                                       { -1.1, 2 } };<a name="line.40"></a>
+<FONT color="green">041</FONT>            final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>            final double[] m = d.getMeans();<a name="line.43"></a>
+<FONT color="green">044</FONT>            for (int i = 0; i &lt; m.length; i++) {<a name="line.44"></a>
+<FONT color="green">045</FONT>                Assert.assertEquals(mu[i], m[i], 0);<a name="line.45"></a>
+<FONT color="green">046</FONT>            }<a name="line.46"></a>
+<FONT color="green">047</FONT>        }<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Test the ability of the distribution to report its covariance matrix parameter.<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        @Test<a name="line.52"></a>
+<FONT color="green">053</FONT>        public void testGetCovarianceMatrix() {<a name="line.53"></a>
+<FONT color="green">054</FONT>            final double[] mu = { -1.5, 2 };<a name="line.54"></a>
+<FONT color="green">055</FONT>            final double[][] sigma = { { 2, -1.1 },<a name="line.55"></a>
+<FONT color="green">056</FONT>                                       { -1.1, 2 } };<a name="line.56"></a>
+<FONT color="green">057</FONT>            final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>            final RealMatrix s = d.getCovariances();<a name="line.59"></a>
+<FONT color="green">060</FONT>            final int dim = d.getDimension();<a name="line.60"></a>
+<FONT color="green">061</FONT>            for (int i = 0; i &lt; dim; i++) {<a name="line.61"></a>
+<FONT color="green">062</FONT>                for (int j = 0; j &lt; dim; j++) {<a name="line.62"></a>
+<FONT color="green">063</FONT>                    Assert.assertEquals(sigma[i][j], s.getEntry(i, j), 0);<a name="line.63"></a>
+<FONT color="green">064</FONT>                }<a name="line.64"></a>
+<FONT color="green">065</FONT>            }<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Test the accuracy of sampling from the distribution.<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        @Test<a name="line.71"></a>
+<FONT color="green">072</FONT>        public void testSampling() {<a name="line.72"></a>
+<FONT color="green">073</FONT>            final double[] mu = { -1.5, 2 };<a name="line.73"></a>
+<FONT color="green">074</FONT>            final double[][] sigma = { { 2, -1.1 },<a name="line.74"></a>
+<FONT color="green">075</FONT>                                       { -1.1, 2 } };<a name="line.75"></a>
+<FONT color="green">076</FONT>            final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);<a name="line.76"></a>
+<FONT color="green">077</FONT>            d.reseedRandomGenerator(50);<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>            final int n = 500000;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>            final double[][] samples = d.sample(n);<a name="line.81"></a>
+<FONT color="green">082</FONT>            final int dim = d.getDimension();<a name="line.82"></a>
+<FONT color="green">083</FONT>            final double[] sampleMeans = new double[dim];<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>            for (int i = 0; i &lt; samples.length; i++) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                for (int j = 0; j &lt; dim; j++) {<a name="line.86"></a>
+<FONT color="green">087</FONT>                    sampleMeans[j] += samples[i][j];<a name="line.87"></a>
+<FONT color="green">088</FONT>                }<a name="line.88"></a>
+<FONT color="green">089</FONT>            }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>            final double sampledValueTolerance = 1e-2;<a name="line.91"></a>
+<FONT color="green">092</FONT>            for (int j = 0; j &lt; dim; j++) {<a name="line.92"></a>
+<FONT color="green">093</FONT>                sampleMeans[j] /= samples.length;<a name="line.93"></a>
+<FONT color="green">094</FONT>                Assert.assertEquals(mu[j], sampleMeans[j], sampledValueTolerance);<a name="line.94"></a>
+<FONT color="green">095</FONT>            }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>            final double[][] sampleSigma = new Covariance(samples).getCovarianceMatrix().getData();<a name="line.97"></a>
+<FONT color="green">098</FONT>            for (int i = 0; i &lt; dim; i++) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                for (int j = 0; j &lt; dim; j++) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                    Assert.assertEquals(sigma[i][j], sampleSigma[i][j], sampledValueTolerance);<a name="line.100"></a>
+<FONT color="green">101</FONT>                }<a name="line.101"></a>
+<FONT color="green">102</FONT>            }<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Test the accuracy of the distribution when calculating densities.<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        @Test<a name="line.108"></a>
+<FONT color="green">109</FONT>        public void testDensities() {<a name="line.109"></a>
+<FONT color="green">110</FONT>            final double[] mu = { -1.5, 2 };<a name="line.110"></a>
+<FONT color="green">111</FONT>            final double[][] sigma = { { 2, -1.1 },<a name="line.111"></a>
+<FONT color="green">112</FONT>                                       { -1.1, 2 } };<a name="line.112"></a>
+<FONT color="green">113</FONT>            final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>            final double[][] testValues = { { -1.5, 2 },<a name="line.115"></a>
+<FONT color="green">116</FONT>                                            { 4, 4 },<a name="line.116"></a>
+<FONT color="green">117</FONT>                                            { 1.5, -2 },<a name="line.117"></a>
+<FONT color="green">118</FONT>                                            { 0, 0 } };<a name="line.118"></a>
+<FONT color="green">119</FONT>            final double[] densities = new double[testValues.length];<a name="line.119"></a>
+<FONT color="green">120</FONT>            for (int i = 0; i &lt; densities.length; i++) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                densities[i] = d.density(testValues[i]);<a name="line.121"></a>
+<FONT color="green">122</FONT>            }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>            // From dmvnorm function in R 2.15 CRAN package Mixtools v0.4.5<a name="line.124"></a>
+<FONT color="green">125</FONT>            final double[] correctDensities = { 0.09528357207691344,<a name="line.125"></a>
+<FONT color="green">126</FONT>                                                5.80932710124009e-09,<a name="line.126"></a>
+<FONT color="green">127</FONT>                                                0.001387448895173267,<a name="line.127"></a>
+<FONT color="green">128</FONT>                                                0.03309922090210541 };<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>            for (int i = 0; i &lt; testValues.length; i++) {<a name="line.130"></a>
+<FONT color="green">131</FONT>                Assert.assertEquals(correctDensities[i], densities[i], 1e-16);<a name="line.131"></a>
+<FONT color="green">132</FONT>            }<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /**<a name="line.135"></a>
+<FONT color="green">136</FONT>         * Test the accuracy of the distribution when calculating densities.<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        @Test<a name="line.138"></a>
+<FONT color="green">139</FONT>        public void testUnivariateDistribution() {<a name="line.139"></a>
+<FONT color="green">140</FONT>            final double[] mu = { -1.5 };<a name="line.140"></a>
+<FONT color="green">141</FONT>            final double[][] sigma = { { 1 } };<a name="line.141"></a>
+<FONT color="green">142</FONT>     <a name="line.142"></a>
+<FONT color="green">143</FONT>            final MultivariateNormalDistribution multi = new MultivariateNormalDistribution(mu, sigma);<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>            final NormalDistribution uni = new NormalDistribution(mu[0], sigma[0][0]);<a name="line.145"></a>
+<FONT color="green">146</FONT>            final Random rng = new Random();<a name="line.146"></a>
+<FONT color="green">147</FONT>            final int numCases = 100;<a name="line.147"></a>
+<FONT color="green">148</FONT>            final double tol = Math.ulp(1d);<a name="line.148"></a>
+<FONT color="green">149</FONT>            for (int i = 0; i &lt; numCases; i++) {<a name="line.149"></a>
+<FONT color="green">150</FONT>                final double v = rng.nextDouble() * 10 - 5;<a name="line.150"></a>
+<FONT color="green">151</FONT>                Assert.assertEquals(uni.density(v), multi.density(new double[] { v }), tol);<a name="line.151"></a>
+<FONT color="green">152</FONT>            }<a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    }<a name="line.154"></a>
 
 
 

Modified: websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/UniformRealDistributionTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/UniformRealDistributionTest.html (original)
+++ websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/UniformRealDistributionTest.html Sat Apr  6 23:42:01 2013
@@ -113,7 +113,18 @@
 <FONT color="green">110</FONT>            Assert.assertEquals(dist.getNumericalMean(), 0.375, 0);<a name="line.110"></a>
 <FONT color="green">111</FONT>            Assert.assertEquals(dist.getNumericalVariance(), 0.2552083333333333, 0);<a name="line.111"></a>
 <FONT color="green">112</FONT>        }<a name="line.112"></a>
-<FONT color="green">113</FONT>    }<a name="line.113"></a>
+<FONT color="green">113</FONT>        <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** <a name="line.114"></a>
+<FONT color="green">115</FONT>         * Check accuracy of analytical inverse CDF. Fails if a solver is used <a name="line.115"></a>
+<FONT color="green">116</FONT>         * with the default accuracy. <a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        @Test<a name="line.118"></a>
+<FONT color="green">119</FONT>        public void testInverseCumulativeDistribution() {<a name="line.119"></a>
+<FONT color="green">120</FONT>            UniformRealDistribution dist = new UniformRealDistribution(0, 1e-9);<a name="line.120"></a>
+<FONT color="green">121</FONT>            <a name="line.121"></a>
+<FONT color="green">122</FONT>            Assert.assertEquals(2.5e-10, dist.inverseCumulativeProbability(0.25), 0);<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    }<a name="line.124"></a>
 
 
 

Added: websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.html (added)
+++ websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.html Sat Apr  6 23:42:01 2013
@@ -0,0 +1,415 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements. See the NOTICE file distributed with this<a name="line.3"></a>
+<FONT color="green">004</FONT>     * work for additional information regarding copyright ownership. The ASF<a name="line.4"></a>
+<FONT color="green">005</FONT>     * licenses this file to You under the Apache License, Version 2.0 (the<a name="line.5"></a>
+<FONT color="green">006</FONT>     * "License"); you may not use this file except in compliance with the License.<a name="line.6"></a>
+<FONT color="green">007</FONT>     * You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     * http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the<a name="line.13"></a>
+<FONT color="green">014</FONT>     * License for the specific language governing permissions and limitations under<a name="line.14"></a>
+<FONT color="green">015</FONT>     * the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math3.distribution.fitting;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.List;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math3.distribution.MixtureMultivariateNormalDistribution;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math3.distribution.MultivariateNormalDistribution;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math3.exception.ConvergenceException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math3.exception.DimensionMismatchException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math3.exception.NotStrictlyPositiveException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math3.exception.NumberIsTooSmallException;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math3.linear.Array2DRowRealMatrix;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math3.linear.RealMatrix;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math3.util.Pair;<a name="line.31"></a>
+<FONT color="green">032</FONT>    import org.junit.Assert;<a name="line.32"></a>
+<FONT color="green">033</FONT>    import org.junit.Test;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    /**<a name="line.35"></a>
+<FONT color="green">036</FONT>     * Test that demonstrates the use of<a name="line.36"></a>
+<FONT color="green">037</FONT>     * {@link MultivariateNormalMixtureExpectationMaximization}.<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public class MultivariateNormalMixtureExpectationMaximizationTest {<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        @Test(expected = NotStrictlyPositiveException.class)<a name="line.41"></a>
+<FONT color="green">042</FONT>        public void testNonEmptyData() {<a name="line.42"></a>
+<FONT color="green">043</FONT>            // Should not accept empty data<a name="line.43"></a>
+<FONT color="green">044</FONT>            new MultivariateNormalMixtureExpectationMaximization(new double[][] {});<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        @Test(expected = DimensionMismatchException.class)<a name="line.47"></a>
+<FONT color="green">048</FONT>        public void testNonJaggedData() {<a name="line.48"></a>
+<FONT color="green">049</FONT>            // Reject data with nonconstant numbers of columns<a name="line.49"></a>
+<FONT color="green">050</FONT>            double[][] data = new double[][] {<a name="line.50"></a>
+<FONT color="green">051</FONT>                    { 1, 2, 3 },<a name="line.51"></a>
+<FONT color="green">052</FONT>                    { 4, 5, 6, 7 },<a name="line.52"></a>
+<FONT color="green">053</FONT>            };<a name="line.53"></a>
+<FONT color="green">054</FONT>            new MultivariateNormalMixtureExpectationMaximization(data);<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        @Test(expected = NumberIsTooSmallException.class)<a name="line.57"></a>
+<FONT color="green">058</FONT>        public void testMultipleColumnsRequired() {<a name="line.58"></a>
+<FONT color="green">059</FONT>            // Data should have at least 2 columns<a name="line.59"></a>
+<FONT color="green">060</FONT>            double[][] data = new double[][] {<a name="line.60"></a>
+<FONT color="green">061</FONT>                    { 1 }, { 2 }<a name="line.61"></a>
+<FONT color="green">062</FONT>            };<a name="line.62"></a>
+<FONT color="green">063</FONT>            new MultivariateNormalMixtureExpectationMaximization(data);<a name="line.63"></a>
+<FONT color="green">064</FONT>        }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        @Test(expected = NotStrictlyPositiveException.class)<a name="line.66"></a>
+<FONT color="green">067</FONT>        public void testMaxIterationsPositive() {<a name="line.67"></a>
+<FONT color="green">068</FONT>            // Maximum iterations for fit must be positive integer<a name="line.68"></a>
+<FONT color="green">069</FONT>            double[][] data = getTestSamples();<a name="line.69"></a>
+<FONT color="green">070</FONT>            MultivariateNormalMixtureExpectationMaximization fitter =<a name="line.70"></a>
+<FONT color="green">071</FONT>                    new MultivariateNormalMixtureExpectationMaximization(data);<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>            MixtureMultivariateNormalDistribution<a name="line.73"></a>
+<FONT color="green">074</FONT>                initialMix = MultivariateNormalMixtureExpectationMaximization.estimate(data, 2);<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>            fitter.fit(initialMix, 0, 1E-5);<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        @Test(expected = NotStrictlyPositiveException.class)<a name="line.79"></a>
+<FONT color="green">080</FONT>        public void testThresholdPositive() {<a name="line.80"></a>
+<FONT color="green">081</FONT>            // Maximum iterations for fit must be positive<a name="line.81"></a>
+<FONT color="green">082</FONT>            double[][] data = getTestSamples();<a name="line.82"></a>
+<FONT color="green">083</FONT>            MultivariateNormalMixtureExpectationMaximization fitter =<a name="line.83"></a>
+<FONT color="green">084</FONT>                    new MultivariateNormalMixtureExpectationMaximization(<a name="line.84"></a>
+<FONT color="green">085</FONT>                        data);<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>            MixtureMultivariateNormalDistribution<a name="line.87"></a>
+<FONT color="green">088</FONT>                initialMix = MultivariateNormalMixtureExpectationMaximization.estimate(data, 2);<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>            fitter.fit(initialMix, 1000, 0);<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        @Test(expected = ConvergenceException.class)<a name="line.93"></a>
+<FONT color="green">094</FONT>        public void testConvergenceException() {<a name="line.94"></a>
+<FONT color="green">095</FONT>            // ConvergenceException thrown if fit terminates before threshold met<a name="line.95"></a>
+<FONT color="green">096</FONT>            double[][] data = getTestSamples();<a name="line.96"></a>
+<FONT color="green">097</FONT>            MultivariateNormalMixtureExpectationMaximization fitter<a name="line.97"></a>
+<FONT color="green">098</FONT>                = new MultivariateNormalMixtureExpectationMaximization(data);<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>            MixtureMultivariateNormalDistribution<a name="line.100"></a>
+<FONT color="green">101</FONT>                initialMix = MultivariateNormalMixtureExpectationMaximization.estimate(data, 2);<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>            // 5 iterations not enough to meet convergence threshold<a name="line.103"></a>
+<FONT color="green">104</FONT>            fitter.fit(initialMix, 5, 1E-5);<a name="line.104"></a>
+<FONT color="green">105</FONT>        }<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>        @Test(expected = DimensionMismatchException.class)<a name="line.107"></a>
+<FONT color="green">108</FONT>        public void testIncompatibleIntialMixture() {<a name="line.108"></a>
+<FONT color="green">109</FONT>            // Data has 3 columns<a name="line.109"></a>
+<FONT color="green">110</FONT>            double[][] data = new double[][] {<a name="line.110"></a>
+<FONT color="green">111</FONT>                    { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }<a name="line.111"></a>
+<FONT color="green">112</FONT>            };<a name="line.112"></a>
+<FONT color="green">113</FONT>            double[] weights = new double[] { 0.5, 0.5 };<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>            // These distributions are compatible with 2-column data, not 3-column<a name="line.115"></a>
+<FONT color="green">116</FONT>            // data<a name="line.116"></a>
+<FONT color="green">117</FONT>            MultivariateNormalDistribution[] mvns = new MultivariateNormalDistribution[2];<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>            mvns[0] = new MultivariateNormalDistribution(new double[] {<a name="line.119"></a>
+<FONT color="green">120</FONT>                            -0.0021722935000328823, 3.5432892936887908 },<a name="line.120"></a>
+<FONT color="green">121</FONT>                            new double[][] {<a name="line.121"></a>
+<FONT color="green">122</FONT>                                    { 4.537422569229048, 3.5266152281729304 },<a name="line.122"></a>
+<FONT color="green">123</FONT>                                    { 3.5266152281729304, 6.175448814169779 } });<a name="line.123"></a>
+<FONT color="green">124</FONT>            mvns[1] = new MultivariateNormalDistribution(new double[] {<a name="line.124"></a>
+<FONT color="green">125</FONT>                            5.090902706507635, 8.68540656355283 }, new double[][] {<a name="line.125"></a>
+<FONT color="green">126</FONT>                            { 2.886778573963039, 1.5257474543463154 },<a name="line.126"></a>
+<FONT color="green">127</FONT>                            { 1.5257474543463154, 3.3794567673616918 } });<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>            // Create components and mixture<a name="line.129"></a>
+<FONT color="green">130</FONT>            List&lt;Pair&lt;Double, MultivariateNormalDistribution&gt;&gt; components =<a name="line.130"></a>
+<FONT color="green">131</FONT>                    new ArrayList&lt;Pair&lt;Double, MultivariateNormalDistribution&gt;&gt;();<a name="line.131"></a>
+<FONT color="green">132</FONT>            components.add(new Pair&lt;Double, MultivariateNormalDistribution&gt;(<a name="line.132"></a>
+<FONT color="green">133</FONT>                    weights[0], mvns[0]));<a name="line.133"></a>
+<FONT color="green">134</FONT>            components.add(new Pair&lt;Double, MultivariateNormalDistribution&gt;(<a name="line.134"></a>
+<FONT color="green">135</FONT>                    weights[1], mvns[1]));<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>            MixtureMultivariateNormalDistribution badInitialMix<a name="line.137"></a>
+<FONT color="green">138</FONT>                = new MixtureMultivariateNormalDistribution(components);<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>            MultivariateNormalMixtureExpectationMaximization fitter<a name="line.140"></a>
+<FONT color="green">141</FONT>                = new MultivariateNormalMixtureExpectationMaximization(data);<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            fitter.fit(badInitialMix);<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        @Test<a name="line.146"></a>
+<FONT color="green">147</FONT>        public void testInitialMixture() {<a name="line.147"></a>
+<FONT color="green">148</FONT>            // Testing initial mixture estimated from data<a name="line.148"></a>
+<FONT color="green">149</FONT>            final double[] correctWeights = new double[] { 0.5, 0.5 };<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>            final double[][] correctMeans = new double[][] {<a name="line.151"></a>
+<FONT color="green">152</FONT>                {-0.0021722935000328823, 3.5432892936887908},<a name="line.152"></a>
+<FONT color="green">153</FONT>                {5.090902706507635, 8.68540656355283},<a name="line.153"></a>
+<FONT color="green">154</FONT>            };<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            final RealMatrix[] correctCovMats = new Array2DRowRealMatrix[2];<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>            correctCovMats[0] = new Array2DRowRealMatrix(new double[][] {<a name="line.158"></a>
+<FONT color="green">159</FONT>                    { 4.537422569229048, 3.5266152281729304 },<a name="line.159"></a>
+<FONT color="green">160</FONT>                    { 3.5266152281729304, 6.175448814169779 } });<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>            correctCovMats[1] = new Array2DRowRealMatrix( new double[][] {<a name="line.162"></a>
+<FONT color="green">163</FONT>                    { 2.886778573963039, 1.5257474543463154 },<a name="line.163"></a>
+<FONT color="green">164</FONT>                    { 1.5257474543463154, 3.3794567673616918 } });<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            final MultivariateNormalDistribution[] correctMVNs = new<a name="line.166"></a>
+<FONT color="green">167</FONT>                    MultivariateNormalDistribution[2];<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>            correctMVNs[0] = new MultivariateNormalDistribution(correctMeans[0],<a name="line.169"></a>
+<FONT color="green">170</FONT>                    correctCovMats[0].getData());<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>            correctMVNs[1] = new MultivariateNormalDistribution(correctMeans[1],<a name="line.172"></a>
+<FONT color="green">173</FONT>                    correctCovMats[1].getData());<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>            final MixtureMultivariateNormalDistribution initialMix<a name="line.175"></a>
+<FONT color="green">176</FONT>                = MultivariateNormalMixtureExpectationMaximization.estimate(getTestSamples(), 2);<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>            int i = 0;<a name="line.178"></a>
+<FONT color="green">179</FONT>            for (Pair&lt;Double, MultivariateNormalDistribution&gt; component : initialMix<a name="line.179"></a>
+<FONT color="green">180</FONT>                    .getComponents()) {<a name="line.180"></a>
+<FONT color="green">181</FONT>                Assert.assertEquals(correctWeights[i], component.getFirst(),<a name="line.181"></a>
+<FONT color="green">182</FONT>                        Math.ulp(1d));<a name="line.182"></a>
+<FONT color="green">183</FONT>                <a name="line.183"></a>
+<FONT color="green">184</FONT>                final double[] means = component.getValue().getMeans();<a name="line.184"></a>
+<FONT color="green">185</FONT>                Assert.assertTrue(Arrays.equals(correctMeans[i], means));<a name="line.185"></a>
+<FONT color="green">186</FONT>                <a name="line.186"></a>
+<FONT color="green">187</FONT>                final RealMatrix covMat = component.getValue().getCovariances();<a name="line.187"></a>
+<FONT color="green">188</FONT>                Assert.assertEquals(correctCovMats[i], covMat);<a name="line.188"></a>
+<FONT color="green">189</FONT>                i++;<a name="line.189"></a>
+<FONT color="green">190</FONT>            }<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        @Test<a name="line.193"></a>
+<FONT color="green">194</FONT>        public void testFit() {<a name="line.194"></a>
+<FONT color="green">195</FONT>            // Test that the loglikelihood, weights, and models are determined and<a name="line.195"></a>
+<FONT color="green">196</FONT>            // fitted correctly<a name="line.196"></a>
+<FONT color="green">197</FONT>            final double[][] data = getTestSamples();<a name="line.197"></a>
+<FONT color="green">198</FONT>            final double correctLogLikelihood = -4.292431006791994;<a name="line.198"></a>
+<FONT color="green">199</FONT>            final double[] correctWeights = new double[] { 0.2962324189652912, 0.7037675810347089 };<a name="line.199"></a>
+<FONT color="green">200</FONT>            <a name="line.200"></a>
+<FONT color="green">201</FONT>            final double[][] correctMeans = new double[][]{<a name="line.201"></a>
+<FONT color="green">202</FONT>                {-1.4213112715121132, 1.6924690505757753},<a name="line.202"></a>
+<FONT color="green">203</FONT>                {4.213612224374709, 7.975621325853645}<a name="line.203"></a>
+<FONT color="green">204</FONT>            };<a name="line.204"></a>
+<FONT color="green">205</FONT>            <a name="line.205"></a>
+<FONT color="green">206</FONT>            final RealMatrix[] correctCovMats = new Array2DRowRealMatrix[2];<a name="line.206"></a>
+<FONT color="green">207</FONT>            correctCovMats[0] = new Array2DRowRealMatrix(new double[][] {<a name="line.207"></a>
+<FONT color="green">208</FONT>                { 1.739356907285747, -0.5867644251487614 },<a name="line.208"></a>
+<FONT color="green">209</FONT>                { -0.5867644251487614, 1.0232932029324642 } }<a name="line.209"></a>
+<FONT color="green">210</FONT>                    );<a name="line.210"></a>
+<FONT color="green">211</FONT>            correctCovMats[1] = new Array2DRowRealMatrix(new double[][] {<a name="line.211"></a>
+<FONT color="green">212</FONT>                { 4.245384898007161, 2.5797798966382155 },<a name="line.212"></a>
+<FONT color="green">213</FONT>                { 2.5797798966382155, 3.9200272522448367 } });<a name="line.213"></a>
+<FONT color="green">214</FONT>            <a name="line.214"></a>
+<FONT color="green">215</FONT>            final MultivariateNormalDistribution[] correctMVNs = new MultivariateNormalDistribution[2];<a name="line.215"></a>
+<FONT color="green">216</FONT>            correctMVNs[0] = new MultivariateNormalDistribution(correctMeans[0], correctCovMats[0].getData());<a name="line.216"></a>
+<FONT color="green">217</FONT>            correctMVNs[1] = new MultivariateNormalDistribution(correctMeans[1], correctCovMats[1].getData());<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>            MultivariateNormalMixtureExpectationMaximization fitter<a name="line.219"></a>
+<FONT color="green">220</FONT>                = new MultivariateNormalMixtureExpectationMaximization(data);<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>            MixtureMultivariateNormalDistribution initialMix<a name="line.222"></a>
+<FONT color="green">223</FONT>                = MultivariateNormalMixtureExpectationMaximization.estimate(data, 2);<a name="line.223"></a>
+<FONT color="green">224</FONT>            fitter.fit(initialMix);<a name="line.224"></a>
+<FONT color="green">225</FONT>            MixtureMultivariateNormalDistribution fittedMix = fitter.getFittedModel();<a name="line.225"></a>
+<FONT color="green">226</FONT>            List&lt;Pair&lt;Double, MultivariateNormalDistribution&gt;&gt; components = fittedMix.getComponents();<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>            Assert.assertEquals(correctLogLikelihood,<a name="line.228"></a>
+<FONT color="green">229</FONT>                                fitter.getLogLikelihood(),<a name="line.229"></a>
+<FONT color="green">230</FONT>                                Math.ulp(1d));<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>            int i = 0;<a name="line.232"></a>
+<FONT color="green">233</FONT>            for (Pair&lt;Double, MultivariateNormalDistribution&gt; component : components) {<a name="line.233"></a>
+<FONT color="green">234</FONT>                final double weight = component.getFirst();<a name="line.234"></a>
+<FONT color="green">235</FONT>                final MultivariateNormalDistribution mvn = component.getSecond();<a name="line.235"></a>
+<FONT color="green">236</FONT>                final double[] mean = mvn.getMeans();<a name="line.236"></a>
+<FONT color="green">237</FONT>                final RealMatrix covMat = mvn.getCovariances();<a name="line.237"></a>
+<FONT color="green">238</FONT>                Assert.assertEquals(correctWeights[i], weight, Math.ulp(1d));<a name="line.238"></a>
+<FONT color="green">239</FONT>                Assert.assertTrue(Arrays.equals(correctMeans[i], mean));<a name="line.239"></a>
+<FONT color="green">240</FONT>                Assert.assertEquals(correctCovMats[i], covMat);<a name="line.240"></a>
+<FONT color="green">241</FONT>                i++;<a name="line.241"></a>
+<FONT color="green">242</FONT>            }<a name="line.242"></a>
+<FONT color="green">243</FONT>        }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>        private double[][] getTestSamples() {<a name="line.245"></a>
+<FONT color="green">246</FONT>            // generated using R Mixtools rmvnorm with mean vectors [-1.5, 2] and<a name="line.246"></a>
+<FONT color="green">247</FONT>            // [4, 8.2]<a name="line.247"></a>
+<FONT color="green">248</FONT>            return new double[][] { { 7.358553610469948, 11.31260831446758 },<a name="line.248"></a>
+<FONT color="green">249</FONT>                    { 7.175770420124739, 8.988812210204454 },<a name="line.249"></a>
+<FONT color="green">250</FONT>                    { 4.324151905768422, 6.837727899051482 },<a name="line.250"></a>
+<FONT color="green">251</FONT>                    { 2.157832219173036, 6.317444585521968 },<a name="line.251"></a>
+<FONT color="green">252</FONT>                    { -1.890157421896651, 1.74271202875498 },<a name="line.252"></a>
+<FONT color="green">253</FONT>                    { 0.8922409354455803, 1.999119343923781 },<a name="line.253"></a>
+<FONT color="green">254</FONT>                    { 3.396949764787055, 6.813170372579068 },<a name="line.254"></a>
+<FONT color="green">255</FONT>                    { -2.057498232686068, -0.002522983830852255 },<a name="line.255"></a>
+<FONT color="green">256</FONT>                    { 6.359932157365045, 8.343600029975851 },<a name="line.256"></a>
+<FONT color="green">257</FONT>                    { 3.353102234276168, 7.087541882898689 },<a name="line.257"></a>
+<FONT color="green">258</FONT>                    { -1.763877221595639, 0.9688890460330644 },<a name="line.258"></a>
+<FONT color="green">259</FONT>                    { 6.151457185125111, 9.075011757431174 },<a name="line.259"></a>
+<FONT color="green">260</FONT>                    { 4.281597398048899, 5.953270070976117 },<a name="line.260"></a>
+<FONT color="green">261</FONT>                    { 3.549576703974894, 8.616038155992861 },<a name="line.261"></a>
+<FONT color="green">262</FONT>                    { 6.004706732349854, 8.959423391087469 },<a name="line.262"></a>
+<FONT color="green">263</FONT>                    { 2.802915014676262, 6.285676742173564 },<a name="line.263"></a>
+<FONT color="green">264</FONT>                    { -0.6029879029880616, 1.083332958357485 },<a name="line.264"></a>
+<FONT color="green">265</FONT>                    { 3.631827105398369, 6.743428504049444 },<a name="line.265"></a>
+<FONT color="green">266</FONT>                    { 6.161125014007315, 9.60920569689001 },<a name="line.266"></a>
+<FONT color="green">267</FONT>                    { -1.049582894255342, 0.2020017892080281 },<a name="line.267"></a>
+<FONT color="green">268</FONT>                    { 3.910573022688315, 8.19609909534937 },<a name="line.268"></a>
+<FONT color="green">269</FONT>                    { 8.180454017634863, 7.861055769719962 },<a name="line.269"></a>
+<FONT color="green">270</FONT>                    { 1.488945440439716, 8.02699903761247 },<a name="line.270"></a>
+<FONT color="green">271</FONT>                    { 4.813750847823778, 12.34416881332515 },<a name="line.271"></a>
+<FONT color="green">272</FONT>                    { 0.0443208501259158, 5.901148093240691 },<a name="line.272"></a>
+<FONT color="green">273</FONT>                    { 4.416417235068346, 4.465243084006094 },<a name="line.273"></a>
+<FONT color="green">274</FONT>                    { 4.0002433603072, 6.721937850166174 },<a name="line.274"></a>
+<FONT color="green">275</FONT>                    { 3.190113818788205, 10.51648348411058 },<a name="line.275"></a>
+<FONT color="green">276</FONT>                    { 4.493600914967883, 7.938224231022314 },<a name="line.276"></a>
+<FONT color="green">277</FONT>                    { -3.675669533266189, 4.472845076673303 },<a name="line.277"></a>
+<FONT color="green">278</FONT>                    { 6.648645511703989, 12.03544085965724 },<a name="line.278"></a>
+<FONT color="green">279</FONT>                    { -1.330031331404445, 1.33931042964811 },<a name="line.279"></a>
+<FONT color="green">280</FONT>                    { -3.812111460708707, 2.50534195568356 },<a name="line.280"></a>
+<FONT color="green">281</FONT>                    { 5.669339356648331, 6.214488981177026 },<a name="line.281"></a>
+<FONT color="green">282</FONT>                    { 1.006596727153816, 1.51165463112716 },<a name="line.282"></a>
+<FONT color="green">283</FONT>                    { 5.039466365033024, 7.476532610478689 },<a name="line.283"></a>
+<FONT color="green">284</FONT>                    { 4.349091929968925, 7.446356406259756 },<a name="line.284"></a>
+<FONT color="green">285</FONT>                    { -1.220289665119069, 3.403926955951437 },<a name="line.285"></a>
+<FONT color="green">286</FONT>                    { 5.553003979122395, 6.886518211202239 },<a name="line.286"></a>
+<FONT color="green">287</FONT>                    { 2.274487732222856, 7.009541508533196 },<a name="line.287"></a>
+<FONT color="green">288</FONT>                    { 4.147567059965864, 7.34025244349202 },<a name="line.288"></a>
+<FONT color="green">289</FONT>                    { 4.083882618965819, 6.362852861075623 },<a name="line.289"></a>
+<FONT color="green">290</FONT>                    { 2.203122344647599, 7.260295257904624 },<a name="line.290"></a>
+<FONT color="green">291</FONT>                    { -2.147497550770442, 1.262293431529498 },<a name="line.291"></a>
+<FONT color="green">292</FONT>                    { 2.473700950426512, 6.558900135505638 },<a name="line.292"></a>
+<FONT color="green">293</FONT>                    { 8.267081298847554, 12.10214104577748 },<a name="line.293"></a>
+<FONT color="green">294</FONT>                    { 6.91977329776865, 9.91998488301285 },<a name="line.294"></a>
+<FONT color="green">295</FONT>                    { 0.1680479852730894, 6.28286034168897 },<a name="line.295"></a>
+<FONT color="green">296</FONT>                    { -1.268578659195158, 2.326711221485755 },<a name="line.296"></a>
+<FONT color="green">297</FONT>                    { 1.829966451374701, 6.254187605304518 },<a name="line.297"></a>
+<FONT color="green">298</FONT>                    { 5.648849025754848, 9.330002040750291 },<a name="line.298"></a>
+<FONT color="green">299</FONT>                    { -2.302874793257666, 3.585545172776065 },<a name="line.299"></a>
+<FONT color="green">300</FONT>                    { -2.629218791709046, 2.156215538500288 },<a name="line.300"></a>
+<FONT color="green">301</FONT>                    { 4.036618140700114, 10.2962785719958 },<a name="line.301"></a>
+<FONT color="green">302</FONT>                    { 0.4616386422783874, 0.6782756325806778 },<a name="line.302"></a>
+<FONT color="green">303</FONT>                    { -0.3447896073408363, 0.4999834691645118 },<a name="line.303"></a>
+<FONT color="green">304</FONT>                    { -0.475281453118318, 1.931470384180492 },<a name="line.304"></a>
+<FONT color="green">305</FONT>                    { 2.382509690609731, 6.071782429815853 },<a name="line.305"></a>
+<FONT color="green">306</FONT>                    { -3.203934441889096, 2.572079552602468 },<a name="line.306"></a>
+<FONT color="green">307</FONT>                    { 8.465636032165087, 13.96462998683518 },<a name="line.307"></a>
+<FONT color="green">308</FONT>                    { 2.36755660870416, 5.7844595007273 },<a name="line.308"></a>
+<FONT color="green">309</FONT>                    { 0.5935496528993371, 1.374615871358943 },<a name="line.309"></a>
+<FONT color="green">310</FONT>                    { -2.467481505748694, 2.097224634713005 },<a name="line.310"></a>
+<FONT color="green">311</FONT>                    { 4.27867444328542, 10.24772361238549 },<a name="line.311"></a>
+<FONT color="green">312</FONT>                    { -2.013791907543137, 2.013799426047639 },<a name="line.312"></a>
+<FONT color="green">313</FONT>                    { 6.424588084404173, 9.185334939684516 },<a name="line.313"></a>
+<FONT color="green">314</FONT>                    { -0.8448238876802175, 0.5447382022282812 },<a name="line.314"></a>
+<FONT color="green">315</FONT>                    { 1.342955703473923, 8.645456317633556 },<a name="line.315"></a>
+<FONT color="green">316</FONT>                    { 3.108712208751979, 8.512156853800064 },<a name="line.316"></a>
+<FONT color="green">317</FONT>                    { 4.343205178315472, 8.056869549234374 },<a name="line.317"></a>
+<FONT color="green">318</FONT>                    { -2.971767642212396, 3.201180146824761 },<a name="line.318"></a>
+<FONT color="green">319</FONT>                    { 2.583820931523672, 5.459873414473854 },<a name="line.319"></a>
+<FONT color="green">320</FONT>                    { 4.209139115268925, 8.171098193546225 },<a name="line.320"></a>
+<FONT color="green">321</FONT>                    { 0.4064909057902746, 1.454390775518743 },<a name="line.321"></a>
+<FONT color="green">322</FONT>                    { 3.068642411145223, 6.959485153620035 },<a name="line.322"></a>
+<FONT color="green">323</FONT>                    { 6.085968972900461, 7.391429799500965 },<a name="line.323"></a>
+<FONT color="green">324</FONT>                    { -1.342265795764202, 1.454550012997143 },<a name="line.324"></a>
+<FONT color="green">325</FONT>                    { 6.249773274516883, 6.290269880772023 },<a name="line.325"></a>
+<FONT color="green">326</FONT>                    { 4.986225847822566, 7.75266344868907 },<a name="line.326"></a>
+<FONT color="green">327</FONT>                    { 7.642443254378944, 10.19914817500263 },<a name="line.327"></a>
+<FONT color="green">328</FONT>                    { 6.438181159163673, 8.464396764810347 },<a name="line.328"></a>
+<FONT color="green">329</FONT>                    { 2.520859761025108, 7.68222425260111 },<a name="line.329"></a>
+<FONT color="green">330</FONT>                    { 2.883699944257541, 6.777960331348503 },<a name="line.330"></a>
+<FONT color="green">331</FONT>                    { 2.788004550956599, 6.634735386652733 },<a name="line.331"></a>
+<FONT color="green">332</FONT>                    { 3.331661231995638, 5.794191300046592 },<a name="line.332"></a>
+<FONT color="green">333</FONT>                    { 3.526172276645504, 6.710802266815884 },<a name="line.333"></a>
+<FONT color="green">334</FONT>                    { 3.188298528138741, 10.34495528210205 },<a name="line.334"></a>
+<FONT color="green">335</FONT>                    { 0.7345539486114623, 5.807604004180681 },<a name="line.335"></a>
+<FONT color="green">336</FONT>                    { 1.165044595880125, 7.830121829295257 },<a name="line.336"></a>
+<FONT color="green">337</FONT>                    { 7.146962523500671, 11.62995162065415 },<a name="line.337"></a>
+<FONT color="green">338</FONT>                    { 7.813872137162087, 10.62827008714735 },<a name="line.338"></a>
+<FONT color="green">339</FONT>                    { 3.118099164870063, 8.286003148186371 },<a name="line.339"></a>
+<FONT color="green">340</FONT>                    { -1.708739286262571, 1.561026755374264 },<a name="line.340"></a>
+<FONT color="green">341</FONT>                    { 1.786163047580084, 4.172394388214604 },<a name="line.341"></a>
+<FONT color="green">342</FONT>                    { 3.718506403232386, 7.807752990130349 },<a name="line.342"></a>
+<FONT color="green">343</FONT>                    { 6.167414046828899, 10.01104941031293 },<a name="line.343"></a>
+<FONT color="green">344</FONT>                    { -1.063477247689196, 1.61176085846339 },<a name="line.344"></a>
+<FONT color="green">345</FONT>                    { -3.396739609433642, 0.7127911050002151 },<a name="line.345"></a>
+<FONT color="green">346</FONT>                    { 2.438885945896797, 7.353011138689225 },<a name="line.346"></a>
+<FONT color="green">347</FONT>                    { -0.2073204144780931, 0.850771146627012 }, };<a name="line.347"></a>
+<FONT color="green">348</FONT>        }<a name="line.348"></a>
+<FONT color="green">349</FONT>    }<a name="line.349"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>

Propchange: websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.html
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/exception/util/LocalizedFormatsTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/exception/util/LocalizedFormatsTest.html (original)
+++ websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/exception/util/LocalizedFormatsTest.html Sat Apr  6 23:42:01 2013
@@ -25,7 +25,7 @@
 <FONT color="green">022</FONT>    import java.util.Locale;<a name="line.22"></a>
 <FONT color="green">023</FONT>    import java.util.ResourceBundle;<a name="line.23"></a>
 <FONT color="green">024</FONT>    <a name="line.24"></a>
-<FONT color="green">025</FONT>    import junit.framework.Assert;<a name="line.25"></a>
+<FONT color="green">025</FONT>    import org.junit.Assert;<a name="line.25"></a>
 <FONT color="green">026</FONT>    <a name="line.26"></a>
 <FONT color="green">027</FONT>    import org.junit.Test;<a name="line.27"></a>
 <FONT color="green">028</FONT>    <a name="line.28"></a>
@@ -33,7 +33,7 @@
 <FONT color="green">030</FONT>    <a name="line.30"></a>
 <FONT color="green">031</FONT>        @Test<a name="line.31"></a>
 <FONT color="green">032</FONT>        public void testMessageNumber() {<a name="line.32"></a>
-<FONT color="green">033</FONT>            Assert.assertEquals(312, LocalizedFormats.values().length);<a name="line.33"></a>
+<FONT color="green">033</FONT>            Assert.assertEquals(313, LocalizedFormats.values().length);<a name="line.33"></a>
 <FONT color="green">034</FONT>        }<a name="line.34"></a>
 <FONT color="green">035</FONT>    <a name="line.35"></a>
 <FONT color="green">036</FONT>        @Test<a name="line.36"></a>

Modified: websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/genetics/UniformCrossoverTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/genetics/UniformCrossoverTest.html (original)
+++ websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/genetics/UniformCrossoverTest.html Sat Apr  6 23:42:01 2013
@@ -22,7 +22,7 @@
 <FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
 <FONT color="green">020</FONT>    import java.util.List;<a name="line.20"></a>
 <FONT color="green">021</FONT>    <a name="line.21"></a>
-<FONT color="green">022</FONT>    import junit.framework.Assert;<a name="line.22"></a>
+<FONT color="green">022</FONT>    import org.junit.Assert;<a name="line.22"></a>
 <FONT color="green">023</FONT>    <a name="line.23"></a>
 <FONT color="green">024</FONT>    import org.apache.commons.math3.exception.DimensionMismatchException;<a name="line.24"></a>
 <FONT color="green">025</FONT>    import org.apache.commons.math3.exception.MathIllegalArgumentException;<a name="line.25"></a>



Mime
View raw message