From e2724d9ee1308ac09398de3fede485076f3bfbd9 Mon Sep 17 00:00:00 2001 From: Yevhenii Poliakov Date: Sun, 14 May 2023 21:57:25 +0200 Subject: [PATCH] upd51 --- script5_1.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script5_1.py b/script5_1.py index a815cb3..7c85cf6 100644 --- a/script5_1.py +++ b/script5_1.py @@ -22,6 +22,8 @@ y = data['Rating'].astype('float64') print("Unique values in 'Rating' column:", data['Rating'].unique()) print("Data type of 'Rating' column:", y.dtype) +mean_rating = data['Rating'].mean() +data['Rating'].fillna(mean_rating, inplace=True) # Preprocess the data # Convert the categorical columns into numerical representations @@ -40,6 +42,12 @@ X = pd.concat([X, X_genres, X_keywords, X_casts], axis=1) # Split the data into training and testing sets X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) +# Convert the modified 'Rating' column to a numpy array +y_train_updated = data['Rating'].to_numpy() + +# Update the 'y_train' array with the modified values +y_train = y_train_updated + # Create the neural network model model = Sequential() model.add(Dense(32, activation='relu', input_dim=X.shape[1]))