signaflo / java-timeseries

Time series analysis in Java
MIT License
195 stars 49 forks source link

Here is how to use this library - Quickstart Tutorial #42

Open osmankhalid2005 opened 4 years ago

osmankhalid2005 commented 4 years ago
  1. Download the latest version of eclipse for java.
  2. Download the zip file of project, unzip, import in eclipse as gradle project. It will download many jar files, and after the process finishes, there will be approx 25 errors. To fix those errors follow the next step.
  3. Download the library lombok.jar from the URL: https://projectlombok.org/download and place it in the eclipse folder.
  4. Go to command, navigate to the eclipse directory, and give the following command: Drive:\eclipse>java -jar lombok-x.xx.jar (mention exact name of lombok jar file)
  5. Click on install/update button. Exit.
  6. Exit and Restart eclipse.
  7. Select the project folder and click on clean. This will rebuild the project and errors will be gone.
  8. To use the library, create a new java project in eclipse, and go the java build path of project, and select the tab "Projects". Click on add, and select the three existing projects: The project of this library, the project with name "math" and the project with name "time-series"
  9. To test the new project, create a new java class with Main function and use the following code in it:

`package testProj;

import com.github.signaflo.timeseries.TestData; import com.github.signaflo.timeseries.TimeSeries; import com.github.signaflo.timeseries.forecast.Forecast; import com.github.signaflo.timeseries.model.Model; import com.github.signaflo.timeseries.model.arima.Arima; import com.github.signaflo.timeseries.model.arima.ArimaOrder;

public class MainFile {

public static void main(String[] args) 
{
    // TODO Auto-generated method stub

            TimeSeries timeSeries = TestData.debitcards;
            ArimaOrder modelOrder = ArimaOrder.order(0, 1, 1, 0, 1, 1); // Note that intercept fitting will automatically be turned off
            Arima model = Arima.model(timeSeries, modelOrder);
            Forecast forecast = model.forecast(1); // To specify the alpha significance level, add it as a second argument.

            System.out.println(forecast);

            System.out.println(forecast.pointEstimates().mean());

}

} `