LazStats: Add tests.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7925 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-12-05 19:03:07 +00:00
parent 7800484f54
commit 21484fc4bd
29 changed files with 1767 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<Title Value="Project1"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<Units>
<Unit>
<Filename Value="Project1.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="Project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions>
<Item>
<Name Value="EAbort"/>
</Item>
<Item>
<Name Value="ECodetoolError"/>
</Item>
<Item>
<Name Value="EFOpenError"/>
</Item>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,43 @@
program Project1;
{$mode objfpc}{$H+}
uses
Math, SysUtils;
const
v1Min = 1.0;
v1Max = 3.0;
dv1 = 0.5;
v2Min = 1.0;
v2Max = 5.0;
dv2 = 0.5;
a = 1.0;
b = -2.0;
c = 100;
EPS = 1E-3;
REL_ERROR = 0.02;
var
v1, v2, res, dres: Double;
F: TextFile;
begin
AssignFile(F, 'linear_regression_2vars.csv');
Rewrite(F);
WriteLn(F, 'Var1,Var2,Result,Weights');
v1 := v1Min;
while v1 <= v1Max + EPS do
begin
v2 := v2min;
while v2 <= v2Max + EPS do
begin
res := a * v1 + b * v2 + c;
dres := res * REL_ERROR;
res := res + RandG(0, dres);
WriteLn(F, v1:0:3, ',', v2:0:3, ',', res:0:3, ',', dres:0:3);
v2 := v2 + dv2;
end;
v1 := v1 + dv1;
end;
CloseFile(F);
end.

View File

@@ -0,0 +1,46 @@
Var1,Var2,Result,Weights
1.000,1.000,101.303,1.980
1.000,1.500,98.948,1.960
1.000,2.000,97.581,1.940
1.000,2.500,96.294,1.920
1.000,3.000,92.779,1.900
1.000,3.500,96.929,1.880
1.000,4.000,91.985,1.860
1.000,4.500,87.666,1.840
1.000,5.000,91.985,1.820
1.500,1.000,104.830,1.990
1.500,1.500,100.972,1.970
1.500,2.000,96.430,1.950
1.500,2.500,95.186,1.930
1.500,3.000,95.242,1.910
1.500,3.500,95.213,1.890
1.500,4.000,94.267,1.870
1.500,4.500,93.557,1.850
1.500,5.000,86.453,1.830
2.000,1.000,102.153,2.000
2.000,1.500,97.784,1.980
2.000,2.000,101.588,1.960
2.000,2.500,94.775,1.940
2.000,3.000,96.103,1.920
2.000,3.500,90.236,1.900
2.000,4.000,92.888,1.880
2.000,4.500,94.597,1.860
2.000,5.000,91.581,1.840
2.500,1.000,100.905,2.010
2.500,1.500,100.197,1.990
2.500,2.000,99.556,1.970
2.500,2.500,100.463,1.950
2.500,3.000,100.175,1.930
2.500,3.500,92.495,1.910
2.500,4.000,94.235,1.890
2.500,4.500,94.055,1.870
2.500,5.000,94.926,1.850
3.000,1.000,102.017,2.020
3.000,1.500,97.621,2.000
3.000,2.000,97.911,1.980
3.000,2.500,94.880,1.960
3.000,3.000,94.850,1.940
3.000,3.500,96.151,1.920
3.000,4.000,93.255,1.900
3.000,4.500,92.598,1.880
3.000,5.000,90.753,1.860
1 Var1 Var2 Result Weights
2 1.000 1.000 101.303 1.980
3 1.000 1.500 98.948 1.960
4 1.000 2.000 97.581 1.940
5 1.000 2.500 96.294 1.920
6 1.000 3.000 92.779 1.900
7 1.000 3.500 96.929 1.880
8 1.000 4.000 91.985 1.860
9 1.000 4.500 87.666 1.840
10 1.000 5.000 91.985 1.820
11 1.500 1.000 104.830 1.990
12 1.500 1.500 100.972 1.970
13 1.500 2.000 96.430 1.950
14 1.500 2.500 95.186 1.930
15 1.500 3.000 95.242 1.910
16 1.500 3.500 95.213 1.890
17 1.500 4.000 94.267 1.870
18 1.500 4.500 93.557 1.850
19 1.500 5.000 86.453 1.830
20 2.000 1.000 102.153 2.000
21 2.000 1.500 97.784 1.980
22 2.000 2.000 101.588 1.960
23 2.000 2.500 94.775 1.940
24 2.000 3.000 96.103 1.920
25 2.000 3.500 90.236 1.900
26 2.000 4.000 92.888 1.880
27 2.000 4.500 94.597 1.860
28 2.000 5.000 91.581 1.840
29 2.500 1.000 100.905 2.010
30 2.500 1.500 100.197 1.990
31 2.500 2.000 99.556 1.970
32 2.500 2.500 100.463 1.950
33 2.500 3.000 100.175 1.930
34 2.500 3.500 92.495 1.910
35 2.500 4.000 94.235 1.890
36 2.500 4.500 94.055 1.870
37 2.500 5.000 94.926 1.850
38 3.000 1.000 102.017 2.020
39 3.000 1.500 97.621 2.000
40 3.000 2.000 97.911 1.980
41 3.000 2.500 94.880 1.960
42 3.000 3.000 94.850 1.940
43 3.000 3.500 96.151 1.920
44 3.000 4.000 93.255 1.900
45 3.000 4.500 92.598 1.880
46 3.000 5.000 90.753 1.860