Output file format of inventory forecasts - Optimization Software

Output file format of inventory forecasts












Home » Resources » Here

Update May 2016: Envision is now the favored way to obtain forecasts from the forecasting engine. Our last generation of forecasting engine provides more capabilities and better accuracy.

The inventory forecasting produced by Lokad are exported as TSV files pushed into the file storage associated to your Lokad account. Those files can then be retrieved by FTP or SFTP. This feature offers the possibility of an end-to-end automation of the inventory optimization process. This page documents the output file format of the inventory forecasts of Lokad, that is, the format of the files made available at the end of a project run.


Lokad outputs a certain list of files into the output folder configured for the project. In the future, Lokad is likely to introduce more files containing data for scenarios that are not covered yet by Lokad. Thus, we suggest to make sure that your implementation ignore those files.

Exporting results as TSV

Lokad produces a Microsoft Excel report and a couple of flat files:

  • Lokad_OptimizedItems.tsv - which contains a copy of the columns found in the items file. When the project is configured to Quantile or to Classic+Quantile then the quantile forecasts are also present in this file.
  • Lokad_Forecasts.tsv - classic periodic forecasts, per day or week or month. This file is only produced if the project is configured with Classic or with Classic+Quantile.
  • Lokad_Grid.tsv - quantile grids. This file is only produced if the project is configured with Quantile Grid.
  • Completed.txt - text file that is uploaded at the end of the process to serve as an additional indication of completion, which can be used for automation purposes.

By default, those files are exported into the input folder used by the Lokad project; however, a distinct output folder can be configured. In particular, the output folder offers the possibility to support the use case where the same input folder (same data) is used by multiple Lokad projects - each project being assigned to a distinct output folder.

Project files will be overwritten with the latest data on every new sync. You will need to back them up, in case history preservation is desired.

Compression

If Lokad_Items.tsv file is compressed then Lokad will compress export files, too. It will use Deflate compression and append .gz extension to file names.

Format of Lokad_Forecasts

This file contains the classic forecasts returned by Lokad. This file is only produced if the project is configured for Classic or Classic+Quantile modes. The fields are present in the TSV file as ordered in the table below.

Lokad_Forecasts.tsv
Idstring always present Matches the Id field of the Lokad_Items.tsv files (foreign key).
ForecastDatedate always present The date of the forecast.
Quantityfloat always present The numerical value of the forecast.
Accuracyfloat always present Equals to 1 - MAPE (mean absolute percentage error). The expected accuracy of the forecast.

Format of Lokad_OptimizedItems

This file contains a mix of the classic and quantile forecasts returned by Lokad. This file is always present. The file starts with fields originally present in the Lokad_Items file (as originally ordered), and then the optimization fields (inferred from the forecasts) are added as the last columns.

Lokad_OptimizedItems.tsv
Idstring always present Matches the Id field of the Lokad_Items files (foreign key).
LabelFoostring depends of input All label fields present in the original Lokad_Items file are inserted.
TagFoostring depends of input All tag fields present in the original Lokad_Items file are inserted.
TagLabelFoostring depends of input All tag+label fields present in the original Lokad_Items file are inserted.
ServiceLevelfloat depends of input A copy of the same field from Lokad_Items.
LeadTimeinteger depends of input A copy of the same field from Lokad_Items.
StockOnHandinteger depends of input A copy of the same field from Lokad_Items if present.
StockOnOrderinteger depends of input A copy of the same field from Lokad_Items if present.
LotMultiplierinteger depends of input A copy of the same field from Lokad_Items if present.
LeadDemandinteger depends of input The lead demand as computed based on classic forecasts by leveraging the lead time. The field is included only if the lead time is present in the original Lokad_Items file.
StockCoverinteger depends of input The stock cover (expressed in days) as computed based on classic forecasts by leveraging the stock on hand. This field is included only if the stock on hand is present in the original Lokad_Items file.
ReorderPointinteger depends of input The quantile forecast reflecting the given lead time and service level. This field is included only if both lead time and service level are provided either though the Lokad_Items file or through the project settings.
OrderQuantityinteger depends of input The suggested quantity to be reordered now in order to maintain the target service level. This field is included only if the lead time, the service level and the stock on hand are provided either though the Lokad_Items file or through the project settings.

Format of Lokad_Grid

This file contains the quantile grid(s) returned by Lokad. This file is produced only if the forecasting mode of the project is set to Quantile Grid. This file contains up to three probability distributions for each item identifier. The fields are present in the TSV file as ordered in the table below.

Lokad_Grid.tsv
Idstring always present Matches the Id field of the Lokad_Items files (foreign key).
Mininteger always present The inclusive lower bound of the integral range.
Maxinteger always present The inclusive higher bound of the integral range.
Probabilityfloat always present The probability that the future demand falls into the Min-Max range expressed as a value between zero and one. The applicable horizon for this probability is the LeadTime value found in the Lokad_Items file.
Probability2float optional Same as Probability except that the applicable horizon is the field LeadTime2 also found in the Lokad_Items file. This column is not present if the LeadTime2 column is not found.
Probability3float optional Same as Probability except that the applicable horizon is the field LeadTime3 also found in the Lokad_Items file. This column is not present if the LeadTime3 column is not found.

For any item, the sum of the probabilities is always lower or equal to 1. Technically, Lokad is computing the output of a discrete probability mass function. It can be noted that, for any item, if the probabilities as cumulatively summed (ordering by the Min values), the resulting sum gives a total that can be interpreted as the service level from the quantile forecasting perspective.

If you look at a typical grid produced by Lokad, you will notice that usually, the grid grows with simple +1 increments, and we have Min equal to Max for every line. This notion of segment is introduced because if a merchant happens to sell a product in batch of 5000 units, a full step-wise grid would be extremely large while containing very little actual information. Thus, Lokad ensures that no more than 1000 lines are produced for very single item, and the segments are dynamically adjusted to cover all the relevant demand levels. In any case, for any item, the grid is always starting at zero, that is Min = 0 for the first line. Also, for any item, the segments are always strictly contiguous with Max+1 equal to the Min value of the next line.

Notes on Tab-separated Values (TSV)

TSV stands for Tab-separated Values. While the TSV format is old, it works surprisingly well for large datasets. The TSV format generated by Lokad is defined by:
  • A text file that consists of lines encoded in UTF8.
  • Each line contains fields separated from each other by TAB characters (horizontal tab, HT, ASCII control code 9).
  • Each line return is encoded either with \r\n (control code 13 the carriage return, then line feed, control code 10).
  • Field means here just any string of characters, excluding TABs. Indeed, each TABs divides the line into distinct field values.
  • Each line contain the same number of fields.
  • The first line contains the names for the fields (on all lines), i.e. column headers.

Numbers and dates

Floating numbers are formatted using . (dot) as decimal separator. No other digit separators are used. Dates are formatted using yyyy-MM-dd pattern, where:

  • yyyy - 4 year digits
  • MM - 2 month digits
  • dd - 2 day digits