en license:apache-2.0 region:us
---
license: apache-2.0
language:
- en
metrics:
- accuracy
---
# BDMobileNumberModelV3

- **Developed by:** Ariful Ambia
- **Funded by:** Walton Hi-Tech Industries PLC.
- **Website:** https://www.waltonhil.com/
- **Model type:** Probabilistic Model
- **License:** [apache-2.0]

## Overview

Model BDMobileNumberModelV3 is a probabilistic model built using pgmpy Bayesian Network. It is trained on a large dataset of active mobile phone numbers in Bangladesh over the last 5 years. This model predicts the accuracy/State of a given mobile number, providing a probability as output. The model has been tested against known datasets, and it is observed that a probability less than 0.0000001 indicates that the number is likely inactive, wrong, or not currently in service.

## How to Use

### Installation

Install the required libraries:
``` bash
pip install pgmpy pandas
```

### Load the Model
``` python
from pgmpy.models import BayesianNetwork
# Load the model
model3 = BayesianNetwork.load('BDMobileNumberModelV3.bif', filetype='bif')
```

### Example Usage
``` python
# Test phone number: +8801716312XXX
# Remove +8801 and the last 3 digits, resulting in '716312'
phone_number = {'D1': '7', 'D2': '1', 'D3': '6', 'D4': '3', 'D5': '1', 'D6': '2'}

# Get the state probability
probability = model3.get_state_probability(phone_number)

# Display the result
print(f"Result: {probability}")

# Interpretation
if probability > 0.0000001:
    print("The phone number +8801716312XXX is most likely in active service.")
else:
    print("The phone number +8801716312XXX is likely inactive or incorrect.")

```

### Adjusting Phone Number Digits
``` python
# Test phone number: +8801716312XXX
# Remove +8801 and try with fewer digits, e.g., '71631'
shortened_phone_number = {'D1': '7', 'D2': '1', 'D3': '6', 'D4': '3', 'D5': '1'}

# Get the state probability
shortened_probability = model3.get_state_probability(shortened_phone_number)

# Display the result
print(f"Result: {shortened_probability}")

```

