Update app.py
Browse files
app.py
CHANGED
|
@@ -5,9 +5,12 @@ from datasets import Dataset
|
|
| 5 |
|
| 6 |
df=pd.read_csv("https://huggingface.co/spaces/Ralmao/Cart/blob/main/cart_data.csv", on_bad_lines='skip')
|
| 7 |
dataset= Dataset.from_pandas(df)
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
y = df['Cart_Abandoned']
|
| 10 |
|
|
|
|
| 11 |
#Importamos las librerias necesarias para la creacion del modelo
|
| 12 |
from sklearn.model_selection import train_test_split
|
| 13 |
|
|
@@ -18,7 +21,7 @@ X_train, X_test, y_train, y_test = train_test_split(X,y, test_size=0.50, random_
|
|
| 18 |
from sklearn.ensemble import RandomForestClassifier
|
| 19 |
|
| 20 |
#Creacion del modelo
|
| 21 |
-
random_forest = RandomForestClassifier(n_estimators=10
|
| 22 |
|
| 23 |
#Entrenamiento
|
| 24 |
random_forest.fit(X_train,y_train)
|
|
|
|
| 5 |
|
| 6 |
df=pd.read_csv("https://huggingface.co/spaces/Ralmao/Cart/blob/main/cart_data.csv", on_bad_lines='skip')
|
| 7 |
dataset= Dataset.from_pandas(df)
|
| 8 |
+
# Select features (columns) for X
|
| 9 |
+
X = df[['No_Checkout_Confirmed', 'No_Checkout_Initiated ', 'No_Customer_Login', 'Session_Activity_Count']]
|
| 10 |
+
# Select target variable (column) for y
|
| 11 |
y = df['Cart_Abandoned']
|
| 12 |
|
| 13 |
+
|
| 14 |
#Importamos las librerias necesarias para la creacion del modelo
|
| 15 |
from sklearn.model_selection import train_test_split
|
| 16 |
|
|
|
|
| 21 |
from sklearn.ensemble import RandomForestClassifier
|
| 22 |
|
| 23 |
#Creacion del modelo
|
| 24 |
+
random_forest = RandomForestClassifier(n_estimators=10)
|
| 25 |
|
| 26 |
#Entrenamiento
|
| 27 |
random_forest.fit(X_train,y_train)
|