> For the complete documentation index, see [llms.txt](https://pybanking.gitbook.io/pybanking-shorthillstech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pybanking.gitbook.io/pybanking-shorthillstech/readme/transaction_prediction.md).

# Transaction Prediction

## Transaction Prediction Model

**Function** get\_data():

| Input            | Type          | Description                |
| ---------------- | ------------- | -------------------------- |
| training dataset | url<*string*> | URL of a training CSV file |
| testing dataset  | url<*string*> | URL of a testing CSV file  |

**Returns** *pandas.dataframe*, *pandas.dataframe*

### Usage

```python
    data_train, data_test = get_data(train = 'https://raw.githubusercontent.com/../transaction_dataset_train.csv', test = 'https://raw.githubusercontent.com/../transaction_dataset_test.csv')
```

***

<br>

**Function** preprocess\_inputs():

| Input            | Type                 | Description                                                       |                                                                                                                                               |
| ---------------- | -------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| training dataset | \*pandas.dataframe\* | Model training dataset in dataframe                               |                                                                                                                                               |
| testing dataset  | \*pandas.dataframe\* | Model testing dataset in dataframe                                |                                                                                                                                               |
| model\_name      | *string*             | <p>Model name as a string<br><em>Default = "Logistic\_Regression" | </em><br>"Support\_Vector\_Machine"<br>"Support\_Vector\_Machine\_Optimized"<br>"Decision\_Tree"<br>"Neural\_Network"<br>"Random\_Forest"</p> |

**Returns** *pandas.dataframe*, *pandas.dataframe*

### Usage

```python
    X, y = preprocess_inputs(data_train, data_test, "Random_Forest")
```

***

<br>

**Function** pretrained():

| Input       | Type     | Description                                                       |                                                                                                                                               |
| ----------- | -------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| model\_name | *string* | <p>Model name as a string<br><em>Default = "Logistic\_Regression" | </em><br>"Support\_Vector\_Machine"<br>"Support\_Vector\_Machine\_Optimized"<br>"Decision\_Tree"<br>"Neural\_Network"<br>"Random\_Forest"</p> |

**Returns** model

### Usage

```python
    model = pretrained("Random_Forest")
```

***

<br>

**Function** train():

| Input            | Type                 | Description                                                       |                                                                                                                                               |
| ---------------- | -------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| training dataset | \*pandas.dataframe\* | Model training dataset in dataframe                               |                                                                                                                                               |
| testing dataset  | \*pandas.dataframe\* | Model testing dataset in dataframe                                |                                                                                                                                               |
| model\_name      | *string*             | <p>Model name as a string<br><em>Default = "Logistic\_Regression" | </em><br>"Support\_Vector\_Machine"<br>"Support\_Vector\_Machine\_Optimized"<br>"Decision\_Tree"<br>"Neural\_Network"<br>"Random\_Forest"</p> |

**Returns** model

### Usage

```python
    model = train(data_train, data_test, "Random_Forest")
```

***

<br>

**Function** predict():

| Input           | Type                 | Description                            |
| --------------- | -------------------- | -------------------------------------- |
| testing dataset | \*pandas.dataframe\* | Model testing dataset in dataframe     |
| model           | function()           | Model function from pretrained / train |

**Returns** *array*

### Usage

```python
    print(predict(data_test, model))
```

***

<br>
