# memory_advice::IPredictor

**This is an abstract class.**   

`#include <predictor.h>`

A class to help predict memory limits using tensorflow lite models.

## Summary

### Inheritance

Direct Known Subclasses:[memory_advice::DefaultPredictor](https://developer.android.com/reference/games/memory-advice/classmemory/advice-1-1-default-predictor)

| ### Constructors and Destructors ||
|---|---|
| `https://developer.android.com/reference/games/memory-advice/classmemory/advice-1-1-i-predictor#classmemory__advice_1_1_i_predictor_1a7da88bb44a0de0d98529b36ec35a46fc()` ||

| ### Public functions ||
|---|---|
| `https://developer.android.com/reference/games/memory-advice/classmemory/advice-1-1-i-predictor#classmemory__advice_1_1_i_predictor_1a987ff04e3399141caf372022911dd928(std::string model_file, std::string features_file)=0` | `virtual https://developer.android.com/reference/games/memory-advice/group/memory-advice#group__memory__advice_1ga7061497339a50e977d400a58b8fb9f82` Initializes the predictor with the given model. |
| `https://developer.android.com/reference/games/memory-advice/classmemory/advice-1-1-i-predictor#classmemory__advice_1_1_i_predictor_1ae0c8896d3a5a971ae240159ef0f76e61(Json::object data)=0` | `virtual float` Runs the tensorflow model with the provided data. |

| ### Protected functions ||
|---|---|
| `https://developer.android.com/reference/games/memory-advice/classmemory/advice-1-1-i-predictor#classmemory__advice_1_1_i_predictor_1ad7543efaf3747f970db8b4fc676bd05b(std::string feature, Json::object data)` | `float` |

## Public functions

### Init

```
virtual MemoryAdvice_ErrorCode Init(
  std::string model_file,
  std::string features_file
)=0
```
Initializes the predictor with the given model.

<br />

Details Parameters `model_file` the location of the asset containing a predictor model file `features_file` the location of the asset containing the feature list matching the model **Returns** MEMORYADVICE_ERROR_TFLITE_MODEL_INVALID if the provided model was invalid, or MEMORYADVICE_ERROR_OK if there are no errors.

### Predict

```
virtual float Predict(
  Json::object data
)=0
```
Runs the tensorflow model with the provided data.

<br />

Details Parameters `data` the memory data from the device. **Returns** the result from the model.

### \~IPredictor

```
virtual  ~IPredictor()
```

## Protected functions

### GetFromPath

```
float GetFromPath(
  std::string feature,
  Json::object data
)
```