Spaces:
Runtime error
Runtime error
Commit
•
0a68ad0
1
Parent(s):
7f56a81
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,10 @@
|
|
1 |
-
|
2 |
-
!pip install pyngrok
|
3 |
-
!pip install tensorflow
|
4 |
-
!pip install scikit-learn
|
5 |
|
6 |
import streamlit as st
|
7 |
import pandas as pd
|
8 |
from sklearn.linear_model import LinearRegression, LogisticRegression
|
9 |
from sklearn.impute import SimpleImputer
|
10 |
from sklearn.preprocessing import LabelEncoder
|
11 |
-
import numpy as np
|
12 |
|
13 |
# Streamlit başlığı
|
14 |
st.title("Data Corrector with AI")
|
@@ -64,8 +60,8 @@ if train_file and test_file:
|
|
64 |
|
65 |
# Eksik değerleri doldurma
|
66 |
imputer = SimpleImputer(strategy='mean' if model_type == "numeric" else 'most_frequent')
|
67 |
-
X_train = imputer.fit_transform(X_train)
|
68 |
-
X_test = imputer.transform(X_test)
|
69 |
|
70 |
# Modeli eğitme ve tahmin yapma
|
71 |
model.fit(X_train, y_train)
|
@@ -84,7 +80,7 @@ if train_file and test_file:
|
|
84 |
|
85 |
X_test = pd.get_dummies(X_test, drop_first=True)
|
86 |
X_test = X_test.reindex(columns=X_train.columns, fill_value=0)
|
87 |
-
X_test = imputer.transform(X_test)
|
88 |
predictions = model.predict(X_test)
|
89 |
|
90 |
if model_type == "categorical":
|
|
|
1 |
+
|
|
|
|
|
|
|
2 |
|
3 |
import streamlit as st
|
4 |
import pandas as pd
|
5 |
from sklearn.linear_model import LinearRegression, LogisticRegression
|
6 |
from sklearn.impute import SimpleImputer
|
7 |
from sklearn.preprocessing import LabelEncoder
|
|
|
8 |
|
9 |
# Streamlit başlığı
|
10 |
st.title("Data Corrector with AI")
|
|
|
60 |
|
61 |
# Eksik değerleri doldurma
|
62 |
imputer = SimpleImputer(strategy='mean' if model_type == "numeric" else 'most_frequent')
|
63 |
+
X_train = pd.DataFrame(imputer.fit_transform(X_train), columns=X_train.columns)
|
64 |
+
X_test = pd.DataFrame(imputer.transform(X_test), columns=X_test.columns)
|
65 |
|
66 |
# Modeli eğitme ve tahmin yapma
|
67 |
model.fit(X_train, y_train)
|
|
|
80 |
|
81 |
X_test = pd.get_dummies(X_test, drop_first=True)
|
82 |
X_test = X_test.reindex(columns=X_train.columns, fill_value=0)
|
83 |
+
X_test = pd.DataFrame(imputer.transform(X_test), columns=X_test.columns)
|
84 |
predictions = model.predict(X_test)
|
85 |
|
86 |
if model_type == "categorical":
|