> For the complete documentation index, see [llms.txt](https://mugdha-thanawala.gitbook.io/tkmt_package/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mugdha-thanawala.gitbook.io/tkmt_package/guides/ensemble-learning-techniques/weighted-averaging.md).

# Weighted Averaging

**All the models are assigned different weights defining the importance of each model for prediction and then the predictions are made for each data point and the average of predictions from all the models are used to make the final prediction.**

{% hint style="info" %}
`from tkmt_package.ensemble import weighted_Averaging`
{% endhint %}

Weighted Averaging

{% hint style="info" %}
`weighted_Averaging.get_Averaging_technique(base_model, train_X, train_y, test_X, weights)`
{% endhint %}

```python
Parameters
----------
base_model: models set as the base models for averaging.
train_X: input train data.
train_y: output train data.
test_X: input test data.
weights: weights obtained from the models.

Example
-------
>>> from tkmt_package.ensemble import weighted_Averaging
>>> wt = weighted_Averaging()
>>> summary.weights.values
>>> ypred_test = wt.get_weighted_Avg_technique(base_model= base_models,
                               train_X=x_train,
                               train_y= y_train,
                               test_X=x_test,
                               weights= weights1)
```
