public class TimeSeriesRegressionPredictorImpl extends TimeSeriesBase implements ITimeSeriesRegressionPredictor
Modifier and Type | Field and Description |
---|---|
protected LinkedHashMap<String,Class> |
features |
protected Map<String,Integer> |
featuresIndexes |
protected String |
modelId |
protected Map<String,String> |
modelInfo |
protected int |
numDoubles |
protected int |
numStrings |
protected ConcurrentHashMap<String,String> |
sanitizedFeaturesCache |
protected com.datarobot.prediction.PredictorBase.GenericEvent<ScoreEventT> |
scoreEvent |
protected String |
targetName |
dateColumnName, dateFormat, fdw, fw, seriesIdColumnName, timeStep
Modifier | Constructor and Description |
---|---|
protected |
TimeSeriesRegressionPredictorImpl(TimeSeriesPredictor predictor) |
Modifier and Type | Method and Description |
---|---|
protected Row |
extractFeatures(Iterable<?> row) |
protected Row |
extractFeatures(Map<String,?> row)
Extracts features that are needed from initial row.
|
protected Map<String,?> |
extractFeaturesMap(Iterable<?> row) |
String |
getDateColumnName()
Getter for Date Column Name.
|
String |
getDateFormat()
Expected date format for the input dates.
|
protected String |
getDefaultEmptyCollumnName()
Return label for empty column.
|
protected ExplanationParams |
getDefaultParams() |
ExplanationParams |
getDefaultPredictionExplanationParams()
Retrieves default prediction explanation parameters.
|
protected Set<String> |
getDoubleMissingValuesLabels()
Returns the set of null labels.
|
protected Double |
getDoubleValue(String featureName,
Object value)
Replaces double missing value with NaN.
|
Map.Entry<Integer,Integer> |
getFeatureDerivationWindow()
Getter for Feature Derivation Interval (FDW).
|
LinkedHashMap<String,Class> |
getFeatures()
Model specific features that are required for scoring.
|
protected Field |
getField(Class clazz,
String fieldName) |
Map.Entry<Integer,Integer> |
getForecastWindow()
Getter for Forecast Interval.
|
String |
getModelId()
DataRobot Model ID.
|
Map<String,String> |
getModelInfo()
Map with different model information.
|
Class<?> |
getPredictorClass()
What the type of the model
|
protected Method |
getPredictorMethod(String methodName,
Class<?>... signature) |
Event<TimeSeriesRegressionScoreEventInfo> |
getScoreEvent()
Returns the event that is invoked for each of the score calculated by the model.
|
String |
getSeriesIdColumnName()
Getter for Series ID Column Name.
|
Map.Entry<Integer,String> |
getTimeStep()
Getter for Time Step.
|
protected Map<String,String> |
initializeModelInfo(PredictorT predictor) |
protected String |
sanitize(String name)
Some pre-processing for feature name.
|
List<TimeSeriesScore<Double>> |
score(ArrayList<Map<String,?>> rows)
Calculates score for the Time-Series
rows . |
List<TimeSeriesScore<Double>> |
score(ArrayList<Map<String,?>> rows,
String forecastPoint)
Calculates score for the Time-Series
rows . |
List<TimeSeriesScore<Double>> |
score(ArrayList<Map<String,?>> rows,
String startDate,
String endDate)
Calculates historical scores for the Time-Series
rows . |
List<TimeSeriesScore<Double>> |
scoreWithExplanations(ArrayList<Map<String,?>> rows)
Scoring with the default prediction explanations parameters.
|
List<TimeSeriesScore<Double>> |
scoreWithExplanations(ArrayList<Map<String,?>> rows,
ExplanationParams predictionExplanationParams)
Scoring with some overriden prediction explanation parameters.
|
List<TimeSeriesScore<Double>> |
scoreWithExplanations(ArrayList<Map<String,?>> rows,
String forecastPoint)
Scoring with the default prediction explanations parameters.
|
List<TimeSeriesScore<Double>> |
scoreWithExplanations(ArrayList<Map<String,?>> rows,
String forecastPoint,
ExplanationParams predictionExplanationParams)
Scoring with some overriden prediction explanation parameters.
|
List<TimeSeriesScore<Double>> |
scoreWithExplanations(ArrayList<Map<String,?>> rows,
String start,
String end)
Scoring with the default prediction explanations parameters.
|
List<TimeSeriesScore<Double>> |
scoreWithExplanations(ArrayList<Map<String,?>> rows,
String start,
String end,
ExplanationParams predictionExplanationParams)
Scoring with some overriden prediction explanation parameters.
|
protected void |
sendScoreInfo(ScoreEventT eventInfo) |
extractRows
protected int numDoubles
protected int numStrings
protected LinkedHashMap<String,Class> features
protected ConcurrentHashMap<String,String> sanitizedFeaturesCache
protected String modelId
protected String targetName
protected final com.datarobot.prediction.PredictorBase.GenericEvent<ScoreEventT extends EventInfo> scoreEvent
protected TimeSeriesRegressionPredictorImpl(TimeSeriesPredictor predictor)
public List<TimeSeriesScore<Double>> score(ArrayList<Map<String,?>> rows)
ITimeSeriesRegressionPredictor
rows
. NOTE: rows
will be sorted lexicographical order by series_id then by date so
adds linear overhead if all data is already sorted and historic data is extracted from the rows to predict by the setted/unsetted to
not NaN target values.score
in interface ITimeSeriesRegressionPredictor
rows
- time-series that contains both historic data and points to predict.public List<TimeSeriesScore<Double>> score(ArrayList<Map<String,?>> rows, String forecastPoint)
ITimeSeriesRegressionPredictor
rows
. NOTE: rows
will be sorted lexicographical order by series_id then by date so
adds linear overhead if all data is already sorted. Historic data is extracted from the rows to predict by the forecastPoint
.score
in interface ITimeSeriesRegressionPredictor
rows
- time-series that contains both historic data and points to predict.forecastPoint
- date from which to start predictions.public List<TimeSeriesScore<Double>> score(ArrayList<Map<String,?>> rows, String startDate, String endDate)
ITimeSeriesRegressionPredictor
rows
. NOTE: rows
is expected to be sorted by the date, and contains
only historic data.score
in interface ITimeSeriesRegressionPredictor
rows
- history time-series.startDate
- start date for historical predictions.endDate
- end date for historical predictions.startDate
and endDate
.public List<TimeSeriesScore<Double>> scoreWithExplanations(ArrayList<Map<String,?>> rows)
ITimeSeriesRegressionPredictor
scoreWithExplanations
in interface ITimeSeriesRegressionPredictor
rows
- time series for which to compute predictions.public List<TimeSeriesScore<Double>> scoreWithExplanations(ArrayList<Map<String,?>> rows, ExplanationParams predictionExplanationParams)
ITimeSeriesRegressionPredictor
scoreWithExplanations
in interface ITimeSeriesRegressionPredictor
rows
- time series for which to compute predictions.predictionExplanationParams
- prediction explanations parameters to override.public List<TimeSeriesScore<Double>> scoreWithExplanations(ArrayList<Map<String,?>> rows, String forecastPoint)
ITimeSeriesRegressionPredictor
scoreWithExplanations
in interface ITimeSeriesRegressionPredictor
rows
- time series for which to compute predictions.forecastPoint
- formatted timestamp from which to compute predictions.public List<TimeSeriesScore<Double>> scoreWithExplanations(ArrayList<Map<String,?>> rows, String forecastPoint, ExplanationParams predictionExplanationParams)
ITimeSeriesRegressionPredictor
scoreWithExplanations
in interface ITimeSeriesRegressionPredictor
rows
- time series for which to compute predictions.forecastPoint
- formatted timestamp from which to compute predictions.predictionExplanationParams
- prediction explanations parameters to override.public List<TimeSeriesScore<Double>> scoreWithExplanations(ArrayList<Map<String,?>> rows, String start, String end)
ITimeSeriesRegressionPredictor
scoreWithExplanations
in interface ITimeSeriesRegressionPredictor
rows
- time series for which to compute predictions.start
- formatted timestamp from which to start computing predictions.end
- formatted timestamp till what we need to compute predictions.public List<TimeSeriesScore<Double>> scoreWithExplanations(ArrayList<Map<String,?>> rows, String start, String end, ExplanationParams predictionExplanationParams)
ITimeSeriesRegressionPredictor
scoreWithExplanations
in interface ITimeSeriesRegressionPredictor
rows
- time series for which to compute predictions.start
- formatted timestamp from which to start computing predictions.end
- formatted timestamp till what we need to compute predictions.predictionExplanationParams
- prediction explanations parameters to override.public String getSeriesIdColumnName()
ITimeSeriesModelInfo
getSeriesIdColumnName
in interface ITimeSeriesModelInfo
public String getDateColumnName()
ITimeSeriesModelInfo
getDateColumnName
in interface ITimeSeriesModelInfo
public Map.Entry<Integer,String> getTimeStep()
ITimeSeriesModelInfo
getTimeStep
in interface ITimeSeriesModelInfo
public Map.Entry<Integer,Integer> getFeatureDerivationWindow()
ITimeSeriesModelInfo
getFeatureDerivationWindow
in interface ITimeSeriesModelInfo
public Map.Entry<Integer,Integer> getForecastWindow()
ITimeSeriesModelInfo
getForecastWindow
in interface ITimeSeriesModelInfo
public String getDateFormat()
ITimeSeriesModelInfo
getDateFormat
in interface ITimeSeriesModelInfo
public String getModelId()
IPredictorInfo
getModelId
in interface IPredictorInfo
public LinkedHashMap<String,Class> getFeatures()
IPredictorInfo
getFeatures
in interface IPredictorInfo
public Class<?> getPredictorClass()
IPredictorInfo
getPredictorClass
in interface IPredictorInfo
public ExplanationParams getDefaultPredictionExplanationParams()
IPredictorInfo
getDefaultPredictionExplanationParams
in interface IPredictorInfo
public Map<String,String> getModelInfo()
IPredictorInfo
getModelInfo
in interface IPredictorInfo
public Event<TimeSeriesRegressionScoreEventInfo> getScoreEvent()
IEventProvider
getScoreEvent
in interface IEventProvider<TimeSeriesRegressionScoreEventInfo>
protected Row extractFeatures(Map<String,?> row)
row
- - Map of initial feature name to its value.protected String sanitize(String name)
name
- - original feature name.protected Double getDoubleValue(String featureName, Object value)
featureName
- - name of the feature.value
- - object feature value.protected String getDefaultEmptyCollumnName()
protected Set<String> getDoubleMissingValuesLabels()
protected void sendScoreInfo(ScoreEventT eventInfo)
protected ExplanationParams getDefaultParams()
Copyright © 2021. All rights reserved.