Spaces:
Sleeping
Sleeping
File size: 4,678 Bytes
1cdcb16 d83af08 0bba6fc 2190885 0bba6fc 77c868c a457444 077e216 a457444 6db6f95 a457444 0325592 2190885 077e216 2190885 8378530 2190885 cb7de09 2190885 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import random
st.markdown("""
<style>
/* Set a soft background color */
body {
background-color: #eef2f7;
}
/* Style for main title */
h1 {
color: #00FFFF;
font-family: 'Roboto', sans-serif;
font-weight: 700;
text-align: center;
margin-bottom: 25px;
}
/* Style for headers */
h2 {
color: #FFFACD;
font-family: 'Roboto', sans-serif;
font-weight: 600;
margin-top: 30px;
}
/* Style for subheaders */
h3 {
color: #ba95b0;
font-family: 'Roboto', sans-serif;
font-weight: 500;
margin-top: 20px;
}
.custom-subheader {
color: #00FFFF;
font-family: 'Roboto', sans-serif;
font-weight: 600;
margin-bottom: 15px;
}
/* Paragraph styling */
p {
font-family: 'Georgia', serif;
line-height: 1.8;
color: #FFFFFF; /* Darker text color for better visibility */
margin-bottom: 20px;
}
/* List styling with checkmark bullets */
.icon-bullet {
list-style-type: none;
padding-left: 20px;
}
.icon-bullet li {
font-family: 'Georgia', serif;
font-size: 1.1em;
margin-bottom: 10px;
color: #FFFFF0; /* Darker text color for better visibility */
}
.icon-bullet li::before {
content: "✔️";
padding-right: 10px;
color: #b3b3ff;
}
/* Sidebar styling */
.sidebar .sidebar-content {
background-color: #ffffff;
border-radius: 10px;
padding: 15px;
}
.sidebar h2 {
color: #495057;
}
</style>
""", unsafe_allow_html=True)
st.title('PROBABILITY')
st.markdown("""Probability is a measure of how likely an event is to occur and is expressed as a number between 0 and 1, where:
<ul class="icon-bullet">
<li> 0 means the event will definitely not happen.</li>
<li> 1 means the event will definitely happen.</li>
</ul>
""",unsafe_allow_html=True)
st.latex(r"""
P(E) = \frac{\text{Number of favorable outcomes}}{\text{Total number of possible outcomes}}
""")
st.markdown("""Probability is classifed into 2 types:
<ul class="icon-bullet">
<li>Empirical probability</li>
<li>Theoretical probability</li>
</ul>
""",unsafe_allow_html=True)
st.subheader("Empirical probability")
st.markdown("""Empirical Probability is a type of probability that is determined based on Trails rather than theoretical calculations""",unsafe_allow_html=True)
st.latex(r"""
P(E) = \frac{\text{Number of Favorable Outcomes}}{\text{Total Number of Trials}}
""")
st.markdown("""At infinity Empirical probability will become Theoretical probability""",unsafe_allow_html=True)
st.title("Empirical probability_Caluculation")
st.write("""
This simple experiment will tell you Empirical probability when you click button
""")
Trail_3 = st.number_input("Number of Trials:", min_value=1, max_value=100, value=7,key="Trail_3")
if st.button('Start the Experiment: Will it Rain or Not?',key="start_experiment_2"):
st.write(f"Running {Trail_3} trials...")
list1=[]
for i in range(1, Trail_3 + 1):
result = random.choice(['Rain', 'No Rain'])
list1+=[result]
rain=np.sum(np.array(list1)=='Rain')
no_rain=np.sum(np.array(list1)=='No Rain')
p_rain=round(rain/Trail_3,2)
p_no_rain=round(no_rain/Trail_3,2)
st.write(f"Event_1:Probability of having rain:{p_rain}")
st.write(f"Event_1:Probability of having no_rain:{p_no_rain}")
st.subheader("Theoretical probability")
st.markdown("""
Theoretical probability is a type of probability that is calculated based on the possible outcomes and the best part of Theoretical probability is it is independent of Trails.""",unsafe_allow_html=True)
st.latex(r"P(E) = \frac{\text{Number of favorable outcomes}}{\text{Total number of possible outcomes}}")
st.title("Theoretical probability_Caluculation")
st.write("""
This simple experiment will tell you Theoretical probability when you click button
""")
Trail_4 = st.number_input("Number of Trials:", min_value=1, max_value=100, value=7,key="Trail_4")
if st.button('Start the Experiment: Will it Rain or Not?',key="start_experiment_3"):
st.write(f"Running {Trail_4} trials...")
list1=[]
for i in range(1, Trail_4 + 1):
result = random.choice(['Rain', 'No Rain'])
list1+=[result]
p_rain_1=1/len(np.unique(list1))
p_no_rain_1=1/len(np.unique(list1))
st.write(f"Event_1:Probability of having rain:{p_rain_1}")
st.write(f"Event_1:Probability of having no_rain:{p_no_rain_1}") |