Analytics & Forecasting

JForecast Making Forecasting Simpler & Better.

JForecast is a Java-based forecasting SDK built on Weka, designed to simplify both time series and correlation forecasting, offering the kind of correlational forecasting support rarely found outside Python.

Built with
  • Java
  • JavaFX
  • WekaWeka
JForecast – Making Forecasting Simpler & Better
Project TypeSDK & Desktop Application
CategoryMachine Learning
Forecasting ModesTime Series & Correlational
Evaluation MetricsMAPE & RMSE

Overview

JForecast is a Java SDK and desktop application built on the power of Weka, providing a robust set of forecasting capabilities for both time series and correlational forecasting, without wrestling with complex pipelines.

What sets JForecast apart is its position as the exclusive Java SDK with state-of-the-art support for correlational forecasting. This capability significantly extends beyond what traditional time series tools offer. It handles predictor-target relationships, missing value imputation, data transformation, and feature engineering in a single, cohesive pipeline.

What Makes It Distinct

Unlike traditional forecasting libraries that model each variable independently, JForecast comprehends the relationships between variables. This enables more realistic predictions for problems where one variable is influenced by others, such as commodity prices, demand forecasting, sales, or financial indicators.

Features

JForecast is designed around a small set of well-considered capabilities, each one designed to remove friction at a specific point in the forecasting workflow.

Built-in evaluators

Automatic dataset splitting based on a specified percentage, with built-in support for MAPE and RMSE evaluation metrics. No separate evaluation step is needed.

Flexible prediction modes

Define what and how to predict in two steps:

- By variable name.

- By units ahead or end date (based on the defined periodicity).

Simple Syntax

An intuitive, concise API where the forecasting intent is clear from the code itself, with no boilerplate configuration.

Data format support

Accepts both ARFF and CSV formats, with automatic ascending sort based on the defined dateTime column. No preprocessing is required before loading.

Correlational Forecasting

This is JForecast’s most sophisticated capability, distinguishing it from other tools. Forecasting things like commodity prices or demand rarely deals with one clean, isolated series. For example, corn prices move with wheat and rice. Demand for one product can shift based on the supply of another.

Correlational forecasting operates on the assumption that a target variable is influenced by one or more predictor variables. Consider a simple example: three variables i.e., chicken, fish and beef. The objective is to forecast the price of chicken, assuming it is influenced by the prices of fish and beef.

The pipeline is a four-stage process that prepares data, handles inconsistencies, transforms distributions, and then performs prediction using the relationships between variables, not just within a single time series.

01Automatic data preprocessing

Prepares the dataset based on specified predictor and target variables. Sorts by date, aligns predictor and target columns, and structures the instances for the stages ahead.

02Imputation

Handles missing values with a robust approach; addressing the inconsistency challenge where one predictor has a full dataset but others do not cover the same period.

03Data transformation

Offers four approaches: Yeo-Johnson, Box-Cox, Log Transformation, and Standardization, to reduce skewed distributions and improve model accuracy.

04Feature engineering & prediction

Captures complex relationships between variables, condenses information and performs correlated predictions with the specified algorithms.

On Data Transformation

The four transformation approaches are not interchangeable, each targets a different distributional problem. If your data is additive in nature (which forecasting data generally is), start with Box-Cox or Yeo-Johnson: both handle linear and non-linear data well, and if one works on the original dataset, test the other as well.

Log Transformation is suited for exponential growth patterns. Standardization is best when your data has different scales that need to be comparable, or when the specified algorithm is sensitive to feature scale. Choosing correctly is crucial for improving data normality and model accuracy.

CorrelationForecastingDemo.java
123456789101112131415161718192021222324252627282930313233343536373839
CorrelationForecaster forecaster =
    new CorrelationForecaster(
      new FileInputStream("correlation_rand.csv"), 2, "dd/MM/yyyy"); 
 
forecaster.setVariableColumn(1);
forecaster.setForecastColumn(3);
 
forecaster.setVariableToBeForecasted("Corn");
forecaster.setCorrelatedVariables("Rice,Wheat");
 
// Step 1: Preprocess Instances
forecaster.preprocess();
 
// Step 2: Imputation
KNNImputationStrategy imputation = new KNNImputationStrategy();
imputation.setK(5);
forecaster.impute(imputation);
 
// Step 3: Transformation
forecaster.transform(new StandardizeTransformationApproach());
 
// Step 4: Calc. Weights
forecaster.calcWeights(new TimeSeriesCorrelationWeightStrategy(12));
 
Forecaster.ForecastBuilder forecastBuilder =
    Forecaster.builder()
        .roundedOff(false)
        .decimalPlaces(2)
        .debug(true)
        .minLag(1)
        .maxLag(3)
        .baseForecaster(new LinearRegression())
        .addMonthOfYear(true)
        .addQuarterOfYear(true);
 
forecaster.evaluate(WeightingMethod.WEIGHTED_SUM,
                   forcastBuilder,
                   95, Evaluator.MAPE);

Sample Evaluation

A run against a 1085-instance randomized dataset simulating corn, wheat, and rice price relationships; split ratio 95:5 train-to-test.

Actual vs Predicted – Corn

Forecasting model performance over 54 time periods.

170 157 145 133 120 T1 T6 T11 T16 T21 T26 T31 T36 T41 T46 T51 T54 Time Period Price ($)
Actual
Predicted
Train Instances1031
Test Instances54
Train / Test Split95:5
Target VariableCorn
Predictor VariableRice,Wheat
MAPE5.72%
Corr. After Imputation 0.9193 (rice)
Corr. After Imputation 0.6878 (wheat)

Bottom Line

  • The only Java SDK with SOTA support for correlation forecasting, filling a genuine gap in the Java ML ecosystem.

  • A four-stage correlational pipeline (preprocessing, imputation, transformation, and feature engineering) in a single coherent tool, not four separate libraries.

  • Built-in evaluators with MAPE and RMSE, means the feedback loop is immediate: train, evaluate, and iterate.