Spaces:
Sleeping
Sleeping
File size: 909 Bytes
e57f927 4207871 e57f927 4207871 e57f927 4207871 |
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 |
import streamlit as st
import os
# Need to install PySR in separate python instance:
os.system(
"""
if [ ! -d "$HOME/.julia/environments/pysr-0.9.1" ]; then
python -c 'import pysr; pysr.install()'
fi
"""
)
import pysr
from pysr import PySRRegressor
import numpy as np
import pandas as pd
st.title("Interactive PySR")
file_name = st.file_uploader(
"Upload a data file, with your output column labeled 'y'", type=["csv"]
)
if file_name is not None:
col1, col2 = st.columns(2)
df = pd.read_csv(file_name)
y = np.array(df["y"])
X = df.drop(["y"], axis=1)
model = PySRRegressor(update=False)
model.fit(X, y)
col1.header("Equation")
col2.header("Loss")
for i, row in model.equations_.iterrows():
col1.subheader(str(row["equation"]))
col2.subheader(str(row["loss"]))
model = None
Main = None
pysr.sr.Main = None
pysr.sr.already_ran = False
|