upd51
This commit is contained in:
parent
f5693b54cc
commit
e2724d9ee1
@ -22,6 +22,8 @@ y = data['Rating'].astype('float64')
|
|||||||
print("Unique values in 'Rating' column:", data['Rating'].unique())
|
print("Unique values in 'Rating' column:", data['Rating'].unique())
|
||||||
print("Data type of 'Rating' column:", y.dtype)
|
print("Data type of 'Rating' column:", y.dtype)
|
||||||
|
|
||||||
|
mean_rating = data['Rating'].mean()
|
||||||
|
data['Rating'].fillna(mean_rating, inplace=True)
|
||||||
|
|
||||||
# Preprocess the data
|
# Preprocess the data
|
||||||
# Convert the categorical columns into numerical representations
|
# 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
|
# 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)
|
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
|
# Create the neural network model
|
||||||
model = Sequential()
|
model = Sequential()
|
||||||
model.add(Dense(32, activation='relu', input_dim=X.shape[1]))
|
model.add(Dense(32, activation='relu', input_dim=X.shape[1]))
|
||||||
|
Loading…
Reference in New Issue
Block a user