---
title: Tabular Classification
slug: mVtL-tabular-classification
docTags: 
createdAt: 2023-05-23T05:20:48.000Z
---

The below input parameters are for different attack types. To start working with the APIs view the [Tabular Classification](docId\:v08LzX7yC3id62W3z63yg).

## File upload format

- **Data**: Data should be in a CSV file with a header as all the features (Columns) name and the last column as the target variable.

[Downloa sample data](https://aisdocs.blob.core.windows.net/reference/upload/Tabular/TabularClassification/data_evasion.zip)

- **Minmax**: Data should be in a CSV file with a header as all the feature (Columns) names and the last column as the target variable. The first row of the CSV file should contain the minimum value for each column (feature), and the second row should contain the max value.&#x20;

[Downloa sample minmax](https://aisdocs.blob.core.windows.net/reference/upload/Tabular/TabularClassification/minmax_evasion.zip)

- **Model**: The model should be saved in either .pkl, .h5 or TensorFlow format. Full architecture is needed when loading the model to the platofrm for assessment either in encrypted or unencrypted. This can be ignored when model is hosted as an API.

[Downloa sample model](https://aisdocs.blob.core.windows.net/reference/upload/Tabular/TabularClassification/model.zip)

:::hint{type="warning"}
All files uploaded should be in zipped format. The above files are sample data.
:::

## Common parameters

The below table parameters are common for all attact types.

:::hint{type="warning"}
To see the additional parameter specific to attact type refer to the below sections.&#x20;
:::

| Parameter                      | Data type | Descrption                                                                                                                                                                        | Remark                                                                                                                                                                                             |
| ------------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| model\_id                      | String    | Model\_id received during model registration. We need to provide this model\_id  in query parameter in URL.                                                                       | you have to do model registration only once for a model and you can perform many analysis. This will help you to track how many api call has been made, how many has successed.                    |
| **Request Body (Json format)** |           |                                                                                                                                                                                   |                                                                                                                                                                                                    |
| normalize\_data                | String    | Model trained on Normalized data.                                                                                                                                                 | if model is trained on normalized data, then set this parameter as "yes" else "no".                                                                                                                |
| input\_dimensions              | String    | length of dataset \* features                                                                                                                                                     | the parameter should be string in the format "(height, weight, channel)" For example 100,18                                                                                                        |
| number\_of\_classes            | String    | Number of prediction classes.                                                                                                                                                     | the parameter should be string. Example  : Banking Marketing<br />Campaign classification dataset 2 (Range >0 & \<=200)                                                                            |
| model\_api\_details            | String    | If use\_model\_api is Yes, then provide API details of hosted model as<br />encrypted JSON string is mandatory                                                                    | provide this only if use\_model\_api is "yes".                                                                                                                                                     |
| use\_model\_api                | String    | If use\_model\_api is Yes, then provide API details of hosted model as encrypted JSON<br />string is mandatory                                                                    | when this parameter is yes, you don't have to upload model as zip. You can pass api url along with other verification credential in json file.                                                     |
| model\_framework               | String    | Original model is built with scikit-learn framework. (Option:\[scikit learn])                                                                                                     | curretly supported framework are: tensorflow, scikit-learn, keras                                                                                                                                  |
| defense\_bestonly              | String    | Highly optimized defense model will be returned.                                                                                                                                  | when selected **"yes"**, it will train N number of model and select best model. Ofcourse this will take longer time. If **"no"**, then once defense model accuracy reached above 95% It will stop  |
| encryption\_strategy           | Int       | Choose a encryption strategy for you model. if model is uploaded directly as a zip pick 0, 1 if model is encryted as .pyc and uploaded as a zip. Ignore if use\_model\_api is Yes | select 0: pass tensorflow model as it is, select 1: pass encrypted model. It could be .pyc file                                                                                                    |
| is\_category\_columns          | String    | If any categorical column presents in dataset provide 'yes' otherwise<br />'no'                                                                                                   |                                                                                                                                                                                                    |
| categorical\_columns\_info     | String    | If is\_category\_columns is yes, then provide the column names of the categorical. (Provide these columns name as comma separated)                                                |                                                                                                                                                                                                    |



:::ExpandableHeading
## Extraction parameters

| Parameter                         | Data type | Descrption                                                                    | Remark                                                                                                                                                                                                                                                                                    |
| --------------------------------- | --------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Request Body (Json format)**    |           |                                                                               |                                                                                                                                                                                                                                                                                           |
| attack\_type                      | String    | You can select the attack type either Blackbox or Greybox.                    | **Blackbox**: for performing model analysis, no information about model or data will be used.                                              **Greybox**: information about data will be leverage for creation of attack data              **Note:&#x20;**&#x6F;nly 2-5 % of data is needed |
| number\_of\_attack\_queries<br /> | String    | Number of attack sample to use for analysis.                                  | Generally heigher the number of attack queries , better would be the analysis. Accepted range: (0-400000)                                                                                                                                                                                 |
| vulnerability\_threshold          | String    | Stolen model accuracy threshold at which defense model should get generated.  | Parameter value Range: (0.0 - 1.0).                                                                                                                                                                                                                                                       |
:::

::::ExpandableHeading
## Evasion parameters&#x20;

:::hint{type="info"}
**Note**: use [Common parameters](./#common-parameters)  only, no extra parameters is needed.&#x20;
:::


::::

:::ExpandableHeading
## Experimentation with values

To improve the accuracy, you can experiment with the following values for your attack input parameters. In our example we have used an BFSI dataset in our model and the below table reflects the parameters suitable for it. For more information, please refer to the [reference implementation](https://github.com/bosch-aisecurity-aishield/Reference-Implementations/tree/main/Product_Taskpair_wise/Tabular_Classification/extraction).

| Task Pair/Analysis Type | Model under analysis | Type of Attack Strategy  | No of queries  | Outcome                               |
| ----------------------- | -------------------- | ------------------------ | -------------- | ------------------------------------- |
| TC - MEA                | BFSI                 | Blackbox                 | 10000          | Stolen model accuracy between 75%-85% |
| TC - MEA                | BFSI                 | Greybox                  | 20000          | Stolen model accuracy between 80%-90% |
| TC - EVA                | BFSI                 | N/A                      | N/A            | Evasion Report                        |
:::

:::hint{type="info"}
To access all sample artifacts, please visit [Artifacts](docId\:iJNEOCXoStabvvrsq11fa).&#x20;

- For specific artifact details,  refer&#x20;
  - Vulnerability Report : [Vulnerability Report](docId\:hL0uT2MWlCBkt8F97fr-W)    &#x20;
  - Sample Attacks : [Sample Attacks](docId:4G1mjM5lQjfm8t5WBVwpr)
  - Defense Report: [Defense Report](docId\:VtzlTtpja2VSF2j0STLSQ)                   &#x20;
  - Defense Model: [Defense Model](docId\:xSbxmZXW4vv14-8NmBF8M)
:::

:::hint{type="info"}
**Note**: For Tabular classification, supported attack types are - Extraction
:::

