Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
charphi committed Jul 12, 2024
2 parents 126f0e4 + ef55cc5 commit e0ab30f
Show file tree
Hide file tree
Showing 21 changed files with 229 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:
fetch-depth: 0

- name: Restore lychee cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

- name: Check links
id: lychee
uses: lycheeverse/lychee-action@v1.8.0
uses: lycheeverse/lychee-action@v1.10.0
with:
fail: true
args: --max-concurrency 1 --cache --no-progress --exclude-all-private './**/*.md'
33 changes: 33 additions & 0 deletions .github/workflows/heylogs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Heylogs

on: [ push ]

jobs:
badge-job:
if: startsWith(github.repository, 'jdemetra/') && startsWith(github.ref, 'refs/heads/develop')
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'maven'

- name: Scan changelog
run: mvn -B -ntp -U com.github.nbbrd.heylogs:heylogs-maven-plugin::scan -Dheylogs.output.file=scan.json -Dheylogs.format.id=json

- name: Create badges endpoint json
run: |
mkdir heylogs
jq '{schemaVersion: 1, label: "unreleased changes", message: "#\(.[0].summary.unreleasedChanges)", color: "E05735", logoColor: "white", namedLogo: "keepachangelog"}' scan.json > heylogs/unreleased-changes.json
- name: Deploy badges endpoint json
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: badges
publish_dir: ./heylogs
4 changes: 2 additions & 2 deletions .github/workflows/java-ea-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
java: [ 21 ]
os: [ ubuntu-latest ]
os: [ ubuntu-latest, macos-latest ]

name: JDK${{ matrix.java }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -34,4 +34,4 @@ jobs:
- name: Build and (headless) test with Maven
uses: smithki/xvfb-action@v1.1.2
with:
run: mvn -U -B -ntp package
run: mvn -U -B -ntp verify
14 changes: 7 additions & 7 deletions .github/workflows/java-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ 17 ]
os: [ ubuntu-latest, macOS-latest, windows-latest ]
java: [ 21 ]
os: [ ubuntu-latest, macos-13, windows-latest ]

name: JDK${{ matrix.java }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Build and (headless) test with Maven
uses: smithki/xvfb-action@v1.1.2
with:
run: mvn -U -B -ntp package
run: mvn -U -B -ntp verify

auto-merge-job:
needs: build-and-test-job
Expand All @@ -58,7 +58,7 @@ jobs:
if: startsWith(github.repository, 'jdemetra/') && startsWith(github.ref, 'refs/heads/develop')
strategy:
matrix:
java: [ 17 ]
java: [ 21 ]
os: [ ubuntu-latest ]

name: Snapshot on develop
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:

- name: Upload JReleaser output
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: assets-snapshot-log
path: |
Expand All @@ -108,7 +108,7 @@ jobs:
if: startsWith(github.repository, 'jdemetra/') && startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
java: [ 17 ]
java: [ 21 ]
os: [ ubuntu-latest ]

name: Release on tag
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:

- name: Upload JReleaser output
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: assets-release-log
path: |
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

[Unreleased]: https://github.com/jdemetra/jd3-benchmarking/compare/3beebc91b34f5933677d8d0e45522e7b02190b5a...HEAD
## [1.1.1] - 2024-07-12

## [1.1.0] - 2023-12-12

## [1.0.0] - 2023-12-12

[Unreleased]: https://github.com/jdemetra/jdplus-benchmarking/compare/v1.1.1...HEAD
[1.1.1]: https://github.com/jdemetra/jdplus-benchmarking/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/jdemetra/jdplus-benchmarking/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/jdemetra/jdplus-benchmarking/releases/tag/v1.0.0

[STAT]: https://img.shields.io/badge/-STAT-068C09
[OTHER]: https://img.shields.io/badge/-OTHER-e4e669
[IO]: https://img.shields.io/badge/-IO-F813F7
[UI]: https://img.shields.io/badge/-UI-5319E7
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# JDemetra+ v3 - benchmarking extensions


[![Download](https://img.shields.io/github/release/jdemetra/jdplus-benchmarking.svg)](https://github.com/jdemetra/jdplus-benchmarking/releases/latest)
[![Changes](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fjdemetra%2Fjdplus-benchmarking%2Fbadges%2Funreleased-changes.json)](https://github.com/jdemetra/jdplus-benchmarking/blob/develop/CHANGELOG.md)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>jdplus-benchmarking-base-parent</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>

<artifactId>jdplus-benchmarking-base-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>jdplus-benchmarking-base-parent</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>

<artifactId>jdplus-benchmarking-base-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@
public class TemporalDisaggregationExtractor extends InformationMapping<TemporalDisaggregationResults> {

public TemporalDisaggregationExtractor() {
set(TemporalDisaggregationDictionaries.DISAGG, TsData.class,
set(TemporalDisaggregationDictionaries.DISAGG, TsData.class,
source -> source.getDisaggregatedSeries());
set(TemporalDisaggregationDictionaries.EDISAGG, TsData.class,
set(TemporalDisaggregationDictionaries.EDISAGG, TsData.class,
source -> source.getStdevDisaggregatedSeries());
set(TemporalDisaggregationDictionaries.LDISAGG, TsData.class,
set(TemporalDisaggregationDictionaries.LDISAGG, TsData.class,
source -> source.getDisaggregatedSeries()
.fn(source.getStdevDisaggregatedSeries(), (a, b) -> a - 2 * b));
set(TemporalDisaggregationDictionaries.UDISAGG, TsData.class,
set(TemporalDisaggregationDictionaries.UDISAGG, TsData.class,
source -> source.getDisaggregatedSeries().fn(source.getStdevDisaggregatedSeries(), (a, b) -> a + 2 * b));
set(TemporalDisaggregationDictionaries.REGEFFECT, TsData.class,
set(TemporalDisaggregationDictionaries.REGEFFECT, TsData.class,
source -> source.getRegressionEffects());
set(TemporalDisaggregationDictionaries.SMOOTHINGEFFECT, TsData.class,
set(TemporalDisaggregationDictionaries.SMOOTHINGEFFECT, TsData.class,
source -> TsData.subtract(source.getDisaggregatedSeries(), source.getRegressionEffects()));
set(TemporalDisaggregationDictionaries.COEFF, double[].class,
set(TemporalDisaggregationDictionaries.COEFF, double[].class,
source -> source.getCoefficients().toArray());
set(TemporalDisaggregationDictionaries.COVAR, Matrix.class,
set(TemporalDisaggregationDictionaries.COVAR, Matrix.class,
source -> source.getCoefficientsCovariance());
set(TemporalDisaggregationDictionaries.REGNAMES, String[].class, source -> {
Variable[] vars = source.getIndicators();
Expand All @@ -78,7 +78,8 @@ public TemporalDisaggregationExtractor() {
return Double.NaN;
}
Matrix H = source.getMaximum().getHessian();
return (H == null || H.isEmpty()) ? Double.NaN : Math.sqrt(1 / source.getMaximum().getHessian().get(0, 0));
int n = source.getLikelihood().degreesOfFreedom() - 1;
return (H == null || H.isEmpty()) ? Double.NaN : Math.sqrt(-1 / (n * H.get(0, 0)));
});
set(TemporalDisaggregationDictionaries.SPART, Double.class, source -> {
TsData re = source.getRegressionEffects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import jdplus.toolkit.base.api.data.AggregationType;
import jdplus.toolkit.base.api.timeseries.TsUnit;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -67,7 +69,7 @@ public void testTable() {

TemporalConstraint c4 = TemporalConstraint.parse("S22=sum(s22)");
MultivariateCholetteSpec.Builder builder = MultivariateCholetteSpec.builder()
.lambda(1)
.lambda(0.9)
.rho(1)
.contemporaneousConstraint(c1)
.contemporaneousConstraint(c2)
Expand Down Expand Up @@ -106,8 +108,8 @@ public void testTable() {
assertTrue(distance(s2_, TsData.add(rslt2.get("s21"), rslt2.get("s22"))) < 1e-9);
}

@Test
@Disabled
// @Test
// @Disabled
public void testOldTable() {
TsMultiBenchmarking bench = new TsMultiBenchmarking();
ec.tstoolkit.timeseries.simplets.TsData s11 = oldRandomM(120, 0);
Expand All @@ -126,7 +128,7 @@ public void testOldTable() {
ec.tstoolkit.timeseries.simplets.TsData s2_ = oldRandomM(120, 6);
bench.addInput("s2_", s2_);

bench.setLambda(0.5);
bench.setLambda(0.9);
bench.setRho(1);
ec.benchmarking.simplets.TsMultiBenchmarking.ContemporaneousConstraintDescriptor c1 = ec.benchmarking.simplets.TsMultiBenchmarking.ContemporaneousConstraintDescriptor.parse("s_1=s11+s21");
bench.addContemporaneousConstraint(c1);
Expand Down Expand Up @@ -183,4 +185,107 @@ private ec.tstoolkit.timeseries.simplets.TsData oldRandomY(int len, int seed) {
return new ec.tstoolkit.timeseries.simplets.TsData(ec.tstoolkit.timeseries.simplets.TsFrequency.Yearly, 1980, 0, data, false);
}

// The following test works...
@Test
public void testTableFictiveData() {

Map<String, TsData> input = new HashMap<>();

double[] s1 = {7,7.2,8.1,7.5,8.5,7.8,8.1,8.4};
input.put("s1", TsData.ofInternal(TsPeriod.quarterly(2021, 1), s1));

double[] s2 = {18,19.5,19.0,19.7,18.5,19.0,20.3,20.0};
input.put("s2", TsData.ofInternal(TsPeriod.quarterly(2021, 1), s2));

double[] s3 = {1.5,1.8,2,2.5,2.0,1.5,1.7,2.0};
input.put("s3", TsData.ofInternal(TsPeriod.quarterly(2021, 1), s3));

double[] a = {27.1,29.8,29.9,31.2,29.3,27.9,30.9,31.7};
input.put("a", TsData.ofInternal(TsPeriod.quarterly(2021, 1), a));

double[] y1 = {30.0,30.5};
input.put("y1", TsData.ofInternal(TsPeriod.yearly(2021), y1));

double[] y2 = {80.0,81.2};
input.put("y2", TsData.ofInternal(TsPeriod.yearly(2021), y2));

double[] y3 = {8.0,8.1};
input.put("y3", TsData.ofInternal(TsPeriod.yearly(2021), y3));

ContemporaneousConstraint c1 = ContemporaneousConstraint.parse("a=s1+s2+s3");

TemporalConstraint c2 = TemporalConstraint.parse("y1=sum(s1)");
TemporalConstraint c3 = TemporalConstraint.parse("y2=sum(s2)");
TemporalConstraint c4 = TemporalConstraint.parse("y3=sum(s3)");

MultivariateCholetteSpec spec = MultivariateCholetteSpec.builder()
.lambda(.5)
.rho(1)
.contemporaneousConstraint(c1)
.temporalConstraint(c2)
.temporalConstraint(c3)
.temporalConstraint(c4)
.build();

Map<String, TsData> rslt = MultivariateCholette.benchmark(input, spec);
}

// The following test does not work... (the only difference is that I added 2 more decimals to the second figure of s1)
// Note that if I change the decimal, it works again...
@Test
public void testTableFictiveData2() {

Map<String, TsData> input = new HashMap<>();

double[] s1 = {7,7.228,8.1,7.5,8.5,7.8,8.1,8.4};
TsData S1=TsData.ofInternal(TsPeriod.quarterly(2021, 1), s1);
input.put("s1", S1);

double[] s2 = {18,19.5,19.0,19.7,18.5,19.0,20.3,20.0};
TsData S2=TsData.ofInternal(TsPeriod.quarterly(2021, 1), s2);
input.put("s2", S2);

double[] s3 = {1.5,1.8,2,2.5,2.0,1.5,1.7,2.0};
TsData S3=TsData.ofInternal(TsPeriod.quarterly(2021, 1), s3);
input.put("s3", S3);

double[] a = {27.1,29.8,29.9,31.2,29.3,27.9,30.9,31.7};
TsData A=TsData.ofInternal(TsPeriod.quarterly(2021, 1), a);
input.put("a", A);

double[] y1 = {30.0,30.5};
TsData Y1=TsData.ofInternal(TsPeriod.yearly(2021), y1);
input.put("y1", Y1);

double[] y2 = {80.0,81.2};
TsData Y2=TsData.ofInternal(TsPeriod.yearly(2021), y2);
input.put("y2", Y2);

double[] y3 = {8.0,8.1};
TsData Y3=TsData.ofInternal(TsPeriod.yearly(2021), y3);
input.put("y3", Y3);

ContemporaneousConstraint c1 = ContemporaneousConstraint.parse("a=s1+s2+s3");

TemporalConstraint c2 = TemporalConstraint.parse("y1=sum(s1)");
TemporalConstraint c3 = TemporalConstraint.parse("y2=sum(s2)");
TemporalConstraint c4 = TemporalConstraint.parse("y3=sum(s3)");

MultivariateCholetteSpec spec = MultivariateCholetteSpec.builder()
.lambda(0.5)
.rho(1)
.contemporaneousConstraint(c1)
.temporalConstraint(c2)
.temporalConstraint(c3)
.temporalConstraint(c4)
.build();

Map<String, TsData> rslt = MultivariateCholette.benchmark(input, spec);
assertTrue(distance(A, TsData.add(rslt.get("s1"), rslt.get("s2"), rslt.get("s3"))) < 1e-9);
assertTrue(distance(Y1, rslt.get("s1").aggregate(TsUnit.YEAR, AggregationType.Sum, true))< 1e-9);
assertTrue(distance(Y2, rslt.get("s2").aggregate(TsUnit.YEAR, AggregationType.Sum, true))< 1e-9);
assertTrue(distance(Y3, rslt.get("s3").aggregate(TsUnit.YEAR, AggregationType.Sum, true))< 1e-9);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import jdplus.benchmarking.base.api.univariate.TemporalDisaggregationSpec;
import jdplus.toolkit.base.api.data.DoubleSeq;
import jdplus.toolkit.base.api.data.Parameter;

/**
Expand Down Expand Up @@ -73,6 +74,7 @@ public void testChowLin() {
System.out.println(rslt2.getDisaggregatedSeries().getValues());
// System.out.println(rslt2.getStdevDisaggregatedSeries().getValues());
System.out.println(rslt2.getCoefficients());
System.out.println(rslt1.getMaximum().getHessian());
// System.out.println(rslt2.getConcentratedLikelihood().e());
// System.out.println(rslt2.getConcentratedLikelihood().logLikelihood());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>jdplus-benchmarking-base-parent</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>

<artifactId>jdplus-benchmarking-base-information</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>jdplus-benchmarking-base-parent</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>

<artifactId>jdplus-benchmarking-base-protobuf</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.europa.ec.joinup.sat</groupId>
<artifactId>jdplus-benchmarking-base-parent</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>

<artifactId>jdplus-benchmarking-base-r</artifactId>
Expand Down
Loading

0 comments on commit e0ab30f

Please sign in to comment.