Skip to main content

Implementación de Red de Bayes sin utilizar librerias externas

Project description

Red de Byaes

Implementación de Red de Bayes en python sin utilizar librerias externas. Angel Higueros - 20460

Ejemplo de uso

from Nodo, RedBayes import redbayes_higuerps

def main():

    cloudy = Nodo("Cloudy", [], {(True,): 0.5, (False,): 0.5})
    sprinkler = Nodo("Sprinkler", [cloudy], {(True, True): 0.1, (True, False): 0.5, (False, True): 0.9, (False, False): 0.5})
    rain = Nodo("Rain", [cloudy], {(True, True): 0.8, (True, False): 0.2, (False, True): 0.2, (False, False): 0.8})
    wet = Nodo("Wet grass", [rain, sprinkler], {
        (True, True, True): 0.99, (True, True, False): 0.9, (True, False, True): 0.9, (True, False, False): 0, 
        (False, True, True): 0.01, (False, True, False): 0.1, (False, False, True): 0.01, (False, False, False): 1})

   
    red = RedBayesiana([cloudy, sprinkler, rain, wet])
    evidencias = {"Sprinkler": True, "Cloudy": False, "Rain": True, "Wet grass": True}

    p_sintomas = red.calcular_probabilidad(evidencias)
    print("Probabilidad conjunta: ", p_sintomas)

    p_marginal = red.obtener_probabilidad_marginal(sprinkler, evidencias)
    print("Probabilidad marginal de sprinkler: ", p_marginal)

    p_condicional = red.obtener_probabilidad_condicional(wet, evidencias)
    print("Probabilidad condicional de Wet Grass dado Sprinkler: ", p_condicional) 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redbayes_higueros-1.0.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

redbayes_higueros-1.0.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file redbayes_higueros-1.0.0.tar.gz.

File metadata

  • Download URL: redbayes_higueros-1.0.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for redbayes_higueros-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3e4be32b14b4e699810e68698d1d9b8e78be7d83bf08be7b4c0414855a06622c
MD5 586b2765305c61570e2708752e7e1af1
BLAKE2b-256 57ed0d419dfc758f5f4e2169a1855cff0de08c59ebbebb3449dc2b23b2c5a400

See more details on using hashes here.

File details

Details for the file redbayes_higueros-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for redbayes_higueros-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b7126a78c22dd31215fbe8ba99111407be371a38440aa675f4e829da0b64be1
MD5 064089d9a84d598b59c10b1cae353e9f
BLAKE2b-256 e19a4782d823385e57abed1b7119150f3c50a8ebbe8e45abd7a00aba53632185

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page