This commit is contained in:
Yevhenii Poliakov 2023-05-14 21:57:25 +02:00
parent f5693b54cc
commit e2724d9ee1

View File

@ -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]))