File size: 939 Bytes
c5301d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

from page_config import APP_PAGE_HEADER
from ml_algorithms.linear_regression_gradient_descent import app as lrgd_app

APP_PAGE_HEADER()

with st.expander("Linear Regression using Gradient Descent"):
    lrgd_app()


def app2():
    import streamlit as st
    import numpy as np
    import matplotlib.pyplot as plt

    st.write("*** Program Started ***")

    n = 50
    x = np.arange(-n / 2, n / 2, 1, dtype=np.float64)

    m = np.random.uniform(0.3, 0.5, (n,))
    b = np.random.uniform(5, 10, (n,))

    y = x * m + b
    print("x", x, type(x[0]))
    print("y", y, type(y[0]))

    plt.scatter(
        x,
        y,
        s=None,
        marker="o",
        color="g",
        edgecolors="g",
        alpha=0.9,
        label="Linear Relation",
    )
    plt.grid(color="black", linestyle="--", linewidth=0.5, markevery=int)
    plt.legend(loc=2)
    plt.axis("scaled")
    st.pyplot(plt.show())


# app2()