# AutoML

After exploring your data, you can use AutoML module to perform your machine learning task, using the following three steps :

**Step 1 : Build**

Before you start training your model, you can set the execution time to default or custom, in default option the app will do all the processing needed and build the best model for you, but it will take time depending on the size of your data, if you choose custom, then you need to specify the time that the app needs to build your model, minimum 3 minutes, please note that in this option you may or you may not get the best model, since the app will get you the best model that was built in the period of time you specified.

When you click 'build your model' button a progressing bar will pop up, and indicates the processing steps of training the model, and when done, the model will be saved under the file name machine learning task\__Model\_sessionID.pkl , (exp Clustering\_Model\_1.pkl), now_ you can start evaluating it.&#x20;

{% hint style="info" %}
* In custom mode, the app will go through a lot of processing, and it may take time depending on the size of your data, so be patient and wait until all the processing is complete to get the best possible model.
* Change the seesion ID, each time you want to retrain your model within the same experiment
{% endhint %}

**Step 2 : Evaluate**

In this step, you have a list of evaluation metrics to choose from.&#x20;

Available metrics for Classification:

* Accuracy
* AUC (Area Under the Curve for estimators that does not support ‘predict\_proba’ is shown as 0.0000.)
* Recall
* Precision
* F1
* Kappa

Available metrics for Regression:

* R2
* MAE
* MSE
* RMSE
* RMSLE
* MAPE

For better understanding of each metrics and how it works, please refer to this [tutorial](https://towardsdatascience.com/metrics-to-evaluate-your-machine-learning-algorithm-f10ba6e38234) .

Select the proper evaluation metric and click 'Evaluate your model' button, you will get a dataframe table showing the score of each metric, and a value hilighted in yellow for the metric that you chose.

You can also use visualization metrics to evaluate your model using:

* For Classification : auc, confusion matrix, threshold,precision\_recall.
* For Regression : residuals, error, cooks, learning
* For Clustering : cluster, tsne
* For Anomaly\_Detection : tsne, umap

![3d TSNE Plot for clustering](https://1577378233-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MT0DqusrMJSGtXvrnXz%2F-MVG-Ri7fL38NlbaUX8K%2F-MVGJ8dP65mxJIjRR2zg%2Fimage.png?alt=media\&token=b85aac65-43f2-4ff9-8a62-e340a3b23019)

**Step 3 : Predict**

After the evaluation stepid done, and you are satisfied with the outcome, you can process to step 3 to make predictions. the app will let you choose between the model you just built, or a pre-existing model which was built before, in this case you need to enter the name of your pre-existing model without the extention .pkl and must be saved in the same location as your working directory.

Now you either choose to make prediction for a single observation, which means you have one instance and you want to predict the target, in this case you need to fill manually all the features of that instance, check your entries if they are correct, and click predict, or if you want to predict multiple observations, in this case you need to drag and drop your file that contains observations you want to predict, the file must be a csv or exel file.

{% hint style="info" %}
* In both cases, the target column must be removed from your data, before predicting for Classification and Regression.
* Your entries must have the same original data dtype.
* &#x20;You must respect the order of the 3 steps. (step1 then step2 then step3 )


{% endhint %}

When you click predict, the app will process the prediction, and show a dataframe table with the predicted label and the probabilty score.

**Single observation**

![Prediction for single observation](https://1577378233-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MT0DqusrMJSGtXvrnXz%2F-MVG-Ri7fL38NlbaUX8K%2F-MVGgivB9XYGxbs5ixku%2Fimage.png?alt=media\&token=9ba9817e-3e65-47fc-9fd9-f898f673fefa)

**Multiple observations**

![Prediction for multiple observations](https://1577378233-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MT0DqusrMJSGtXvrnXz%2F-MVG-Ri7fL38NlbaUX8K%2F-MVGhELf879cDAAn_cUU%2Fimage.png?alt=media\&token=a938ed00-13a0-4d5c-abd5-eb1ee5fe8d26)

When performing prediction for Anomaly\_Detection, for single observation, if yes then it s an anomaly, if NO then it s not.

![Anomaly prediction  for a single observation](https://1577378233-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MT0DqusrMJSGtXvrnXz%2F-MVGuVzKaxftccjrexRM%2F-MVGxAmftdia6ILOjfHm%2Fimage.png?alt=media\&token=6a8a2c2e-42b7-446e-bf45-93c714b09a28)

When performing prediction for Clustering , for single observation, then the predictions is the category of the cluster, according to the number of clusters you specified or the number that was generated automatically.&#x20;

![Clustering prediction for a single observation](https://1577378233-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MT0DqusrMJSGtXvrnXz%2F-MVGuVzKaxftccjrexRM%2F-MVGzRJM7gfgRF2wJjJd%2Fimage.png?alt=media\&token=cecb552f-d4bf-4622-9b06-aa75b16e9fc0)

In case of multiple observations, you will get the same outcome, except that now you will have a data frame table and a prediction for all and each instance.

&#x20;Predicted data will be saved in your working directory with the name predicted\__data_\_sessionID.csv .

