-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from tharoosha/dev_rate
Dev rate
- Loading branch information
Showing
11 changed files
with
1,002,041 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ npm-debug.log* | |
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
myenv | ||
|
Binary file removed
BIN
-5.24 KB
backend/ml_models/recommanded_system/__pycache__/mood_TO_video.cpython-311.pyc
Binary file not shown.
Binary file removed
BIN
-1.67 KB
backend/ml_models/recommanded_system/__pycache__/youtube_search.cpython-311.pyc
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
1,000,001 changes: 1,000,001 additions & 0 deletions
1,000,001
backend/ml_models/recommanded_system/sample_dataset.csv
Large diffs are not rendered by default.
Oops, something went wrong.
632 changes: 632 additions & 0 deletions
632
backend/ml_models/recommanded_system/title_category.csv
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,266 @@ | ||
video_title,video_description,video_category,video_rating | ||
Video 1,Description for Video 1,Trailers,4.5 | ||
Video 2,Description for Video 2,Comedy,4.5 | ||
Video 3,Description for Video 3,Thriller,4.1 | ||
Video 4,Description for Video 4,People & Blogs,4.7 | ||
Video 5,Description for Video 5,Sci-Fi/Fantasy,3.0 | ||
Video 6,Description for Video 6,Gaming,3.8 | ||
Video 7,Description for Video 7,Shorts,3.6 | ||
Video 8,Description for Video 8,People & Blogs,4.7 | ||
Video 9,Description for Video 9,Shows,2.3 | ||
Video 10,Description for Video 10,Videoblogging,3.2 | ||
Video 11,Description for Video 11,Sports,2.7 | ||
Video 12,Description for Video 12,Nonprofits & Activism,4.2 | ||
Video 13,Description for Video 13,Film & Animation,4.7 | ||
Video 14,Description for Video 14,Thriller,3.4 | ||
Video 15,Description for Video 15,Comedy,3.5 | ||
Video 16,Description for Video 16,Thriller,3.9 | ||
Video 17,Description for Video 17,Music,2.4 | ||
Video 18,Description for Video 18,Foreign,2.6 | ||
Video 19,Description for Video 19,Horror,4.0 | ||
Video 20,Description for Video 20,People & Blogs,2.5 | ||
Video 21,Description for Video 21,Drama,4.0 | ||
Video 22,Description for Video 22,Education,3.6 | ||
Video 23,Description for Video 23,Nonprofits & Activism,3.3 | ||
Video 24,Description for Video 24,Science & Technology,4.2 | ||
Video 25,Description for Video 25,Movies,3.5 | ||
Video 26,Description for Video 26,Action/Adventure,4.5 | ||
Video 27,Description for Video 27,Music,3.6 | ||
Video 28,Description for Video 28,Comedy,3.5 | ||
Video 29,Description for Video 29,Documentary,2.7 | ||
Video 30,Description for Video 30,Movies,3.9 | ||
Video 31,Description for Video 31,Movies,3.2 | ||
Video 32,Description for Video 32,Gaming,4.9 | ||
Video 33,Description for Video 33,Science & Technology,2.5 | ||
Video 34,Description for Video 34,Comedy,3.4 | ||
Video 35,Description for Video 35,Howto & Style,4.9 | ||
Video 36,Description for Video 36,Howto & Style,2.6 | ||
Video 37,Description for Video 37,Autos & Vehicles,2.4 | ||
Video 38,Description for Video 38,Documentary,3.2 | ||
Video 39,Description for Video 39,Classics,3.9 | ||
Video 40,Description for Video 40,Music,4.9 | ||
Video 41,Description for Video 41,Education,4.2 | ||
Video 42,Description for Video 42,News & Politics,4.6 | ||
Video 43,Description for Video 43,Autos & Vehicles,2.9 | ||
Video 44,Description for Video 44,Action/Adventure,2.9 | ||
Video 45,Description for Video 45,Anime/Animation,4.5 | ||
Video 46,Description for Video 46,Sci-Fi/Fantasy,4.9 | ||
Video 47,Description for Video 47,Gaming,4.3 | ||
Video 48,Description for Video 48,Family,3.9 | ||
Video 49,Description for Video 49,Classics,4.2 | ||
Video 50,Description for Video 50,Nonprofits & Activism,4.2 | ||
Video 51,Description for Video 51,Sci-Fi/Fantasy,3.0 | ||
Video 52,Description for Video 52,Anime/Animation,4.8 | ||
Video 53,Description for Video 53,People & Blogs,2.9 | ||
Video 54,Description for Video 54,Horror,3.6 | ||
Video 55,Description for Video 55,Entertainment,3.3 | ||
Video 56,Description for Video 56,Family,4.6 | ||
Video 57,Description for Video 57,Movies,3.0 | ||
Video 58,Description for Video 58,Movies,2.2 | ||
Video 59,Description for Video 59,Comedy,3.2 | ||
Video 60,Description for Video 60,Comedy,3.7 | ||
Video 61,Description for Video 61,Shorts,3.8 | ||
Video 62,Description for Video 62,Anime/Animation,2.5 | ||
Video 63,Description for Video 63,Sci-Fi/Fantasy,2.8 | ||
Video 64,Description for Video 64,Family,4.2 | ||
Video 65,Description for Video 65,Travel & Events,3.4 | ||
Video 66,Description for Video 66,Family,3.2 | ||
Video 67,Description for Video 67,Shows,2.1 | ||
Video 68,Description for Video 68,Music,3.2 | ||
Video 69,Description for Video 69,Entertainment,2.2 | ||
Video 70,Description for Video 70,Comedy,3.5 | ||
Video 71,Description for Video 71,News & Politics,3.7 | ||
Video 72,Description for Video 72,Trailers,2.6 | ||
Video 73,Description for Video 73,Entertainment,4.7 | ||
Video 74,Description for Video 74,Anime/Animation,2.7 | ||
Video 75,Description for Video 75,News & Politics,3.9 | ||
Video 76,Description for Video 76,News & Politics,4.4 | ||
Video 77,Description for Video 77,Sci-Fi/Fantasy,3.2 | ||
Video 78,Description for Video 78,Howto & Style,3.0 | ||
Video 79,Description for Video 79,Gaming,3.0 | ||
Video 80,Description for Video 80,People & Blogs,4.7 | ||
Video 81,Description for Video 81,Gaming,2.0 | ||
Video 82,Description for Video 82,Nonprofits & Activism,2.0 | ||
Video 83,Description for Video 83,Film & Animation,4.6 | ||
Video 84,Description for Video 84,Pets & Animals,2.7 | ||
Video 85,Description for Video 85,Travel & Events,3.8 | ||
Video 86,Description for Video 86,Travel & Events,3.9 | ||
Video 87,Description for Video 87,Education,2.4 | ||
Video 88,Description for Video 88,Drama,2.1 | ||
Video 89,Description for Video 89,Education,2.4 | ||
Video 90,Description for Video 90,Comedy,2.3 | ||
Video 91,Description for Video 91,Shorts,3.4 | ||
Video 92,Description for Video 92,Nonprofits & Activism,4.3 | ||
Video 93,Description for Video 93,Anime/Animation,4.0 | ||
Video 94,Description for Video 94,Howto & Style,4.3 | ||
Video 95,Description for Video 95,Film & Animation,2.2 | ||
Video 96,Description for Video 96,Videoblogging,3.9 | ||
Video 97,Description for Video 97,Nonprofits & Activism,3.4 | ||
Video 98,Description for Video 98,Howto & Style,4.6 | ||
Video 99,Description for Video 99,Science & Technology,3.1 | ||
Video 100,Description for Video 100,Trailers,3.5 | ||
Video 101,Description for Video 101,Gaming,3.7 | ||
Video 102,Description for Video 102,Science & Technology,2.7 | ||
Video 103,Description for Video 103,Anime/Animation,2.1 | ||
Video 104,Description for Video 104,Movies,3.8 | ||
Video 105,Description for Video 105,Shorts,2.1 | ||
Video 106,Description for Video 106,Sports,5.0 | ||
Video 107,Description for Video 107,Anime/Animation,4.9 | ||
Video 108,Description for Video 108,Thriller,2.6 | ||
Video 109,Description for Video 109,Documentary,2.8 | ||
Video 110,Description for Video 110,Howto & Style,2.3 | ||
Video 111,Description for Video 111,Education,3.6 | ||
Video 112,Description for Video 112,Drama,3.1 | ||
Video 113,Description for Video 113,Anime/Animation,4.0 | ||
Video 114,Description for Video 114,Foreign,3.0 | ||
Video 115,Description for Video 115,Classics,2.4 | ||
Video 116,Description for Video 116,Shorts,4.8 | ||
Video 117,Description for Video 117,Comedy,3.4 | ||
Video 118,Description for Video 118,Drama,4.9 | ||
Video 119,Description for Video 119,Foreign,3.1 | ||
Video 120,Description for Video 120,Howto & Style,4.6 | ||
Video 121,Description for Video 121,Sci-Fi/Fantasy,2.1 | ||
Video 122,Description for Video 122,Education,2.1 | ||
Video 123,Description for Video 123,Movies,3.5 | ||
Video 124,Description for Video 124,Science & Technology,2.2 | ||
Video 125,Description for Video 125,People & Blogs,4.5 | ||
Video 126,Description for Video 126,Travel & Events,3.3 | ||
Video 127,Description for Video 127,Entertainment,4.2 | ||
Video 128,Description for Video 128,People & Blogs,2.3 | ||
Video 129,Description for Video 129,Drama,3.6 | ||
Video 130,Description for Video 130,Classics,2.6 | ||
Video 131,Description for Video 131,Trailers,2.7 | ||
Video 132,Description for Video 132,Autos & Vehicles,3.4 | ||
Video 133,Description for Video 133,Horror,4.2 | ||
Video 134,Description for Video 134,Nonprofits & Activism,4.4 | ||
Video 135,Description for Video 135,Sci-Fi/Fantasy,4.1 | ||
Video 136,Description for Video 136,Gaming,2.9 | ||
Video 137,Description for Video 137,Autos & Vehicles,3.7 | ||
Video 138,Description for Video 138,Family,4.1 | ||
Video 139,Description for Video 139,Howto & Style,4.0 | ||
Video 140,Description for Video 140,Gaming,2.7 | ||
Video 141,Description for Video 141,Foreign,3.0 | ||
Video 142,Description for Video 142,Drama,2.9 | ||
Video 143,Description for Video 143,Gaming,3.1 | ||
Video 144,Description for Video 144,Horror,3.0 | ||
Video 145,Description for Video 145,News & Politics,3.7 | ||
Video 146,Description for Video 146,Drama,2.5 | ||
Video 147,Description for Video 147,Sci-Fi/Fantasy,2.8 | ||
Video 148,Description for Video 148,Family,3.2 | ||
Video 149,Description for Video 149,Foreign,3.5 | ||
Video 150,Description for Video 150,Music,4.9 | ||
Video 151,Description for Video 151,Thriller,2.7 | ||
Video 152,Description for Video 152,Entertainment,2.4 | ||
Video 153,Description for Video 153,Music,2.5 | ||
Video 154,Description for Video 154,News & Politics,3.5 | ||
Video 155,Description for Video 155,Science & Technology,3.1 | ||
Video 156,Description for Video 156,News & Politics,2.5 | ||
Video 157,Description for Video 157,Music,3.1 | ||
Video 158,Description for Video 158,Comedy,3.8 | ||
Video 159,Description for Video 159,Pets & Animals,2.7 | ||
Video 160,Description for Video 160,Nonprofits & Activism,3.4 | ||
Video 161,Description for Video 161,Anime/Animation,4.8 | ||
Video 162,Description for Video 162,Videoblogging,5.0 | ||
Video 163,Description for Video 163,Action/Adventure,3.1 | ||
Video 164,Description for Video 164,Foreign,2.3 | ||
Video 165,Description for Video 165,Sports,3.1 | ||
Video 166,Description for Video 166,Documentary,4.3 | ||
Video 167,Description for Video 167,Thriller,4.0 | ||
Video 168,Description for Video 168,Horror,4.6 | ||
Video 169,Description for Video 169,Thriller,2.2 | ||
Video 170,Description for Video 170,Film & Animation,2.5 | ||
Video 171,Description for Video 171,Shorts,2.2 | ||
Video 172,Description for Video 172,Videoblogging,2.1 | ||
Video 173,Description for Video 173,Documentary,4.5 | ||
Video 174,Description for Video 174,Comedy,3.1 | ||
Video 175,Description for Video 175,Education,2.4 | ||
Video 176,Description for Video 176,Trailers,3.6 | ||
Video 177,Description for Video 177,Drama,3.5 | ||
Video 178,Description for Video 178,Shows,3.1 | ||
Video 179,Description for Video 179,Shorts,3.7 | ||
Video 180,Description for Video 180,Videoblogging,3.9 | ||
Video 181,Description for Video 181,Sports,4.0 | ||
Video 182,Description for Video 182,Action/Adventure,3.6 | ||
Video 183,Description for Video 183,Sports,4.9 | ||
Video 184,Description for Video 184,Autos & Vehicles,3.7 | ||
Video 185,Description for Video 185,Shorts,2.1 | ||
Video 186,Description for Video 186,Comedy,2.8 | ||
Video 187,Description for Video 187,Travel & Events,2.1 | ||
Video 188,Description for Video 188,News & Politics,4.1 | ||
Video 189,Description for Video 189,Film & Animation,2.2 | ||
Video 190,Description for Video 190,Shorts,5.0 | ||
Video 191,Description for Video 191,Trailers,3.6 | ||
Video 192,Description for Video 192,Gaming,2.8 | ||
Video 193,Description for Video 193,Videoblogging,2.7 | ||
Video 194,Description for Video 194,Horror,4.6 | ||
Video 195,Description for Video 195,Trailers,2.6 | ||
Video 196,Description for Video 196,Shows,4.8 | ||
Video 197,Description for Video 197,Foreign,3.6 | ||
Video 198,Description for Video 198,Family,3.5 | ||
Video 199,Description for Video 199,Music,4.3 | ||
Video 200,Description for Video 200,Sci-Fi/Fantasy,4.8 | ||
Video 201,Description for Video 201,Shorts,3.6 | ||
Video 202,Description for Video 202,Comedy,4.1 | ||
Video 203,Description for Video 203,Comedy,2.1 | ||
Video 204,Description for Video 204,Anime/Animation,4.0 | ||
Video 205,Description for Video 205,Comedy,2.7 | ||
Video 206,Description for Video 206,News & Politics,2.7 | ||
Video 207,Description for Video 207,Howto & Style,3.5 | ||
Video 208,Description for Video 208,Documentary,5.0 | ||
Video 209,Description for Video 209,Sports,4.5 | ||
Video 210,Description for Video 210,Howto & Style,3.4 | ||
Video 211,Description for Video 211,Comedy,2.8 | ||
Video 212,Description for Video 212,Science & Technology,2.3 | ||
Video 213,Description for Video 213,Family,2.1 | ||
Video 214,Description for Video 214,Science & Technology,2.5 | ||
Video 215,Description for Video 215,Gaming,4.1 | ||
Video 216,Description for Video 216,People & Blogs,2.3 | ||
Video 217,Description for Video 217,Documentary,3.7 | ||
Video 218,Description for Video 218,Shows,2.7 | ||
Video 219,Description for Video 219,Drama,3.4 | ||
Video 220,Description for Video 220,Movies,3.8 | ||
Video 221,Description for Video 221,Autos & Vehicles,2.3 | ||
Video 222,Description for Video 222,Family,4.3 | ||
Video 223,Description for Video 223,Nonprofits & Activism,3.7 | ||
Video 224,Description for Video 224,Education,2.2 | ||
Video 225,Description for Video 225,Science & Technology,3.3 | ||
Video 226,Description for Video 226,Entertainment,2.7 | ||
Video 227,Description for Video 227,Documentary,2.9 | ||
Video 228,Description for Video 228,Entertainment,3.7 | ||
Video 229,Description for Video 229,Pets & Animals,4.6 | ||
Video 230,Description for Video 230,Howto & Style,2.9 | ||
Video 231,Description for Video 231,Autos & Vehicles,5.0 | ||
Video 232,Description for Video 232,Gaming,4.4 | ||
Video 233,Description for Video 233,Education,4.8 | ||
Video 234,Description for Video 234,Foreign,3.6 | ||
Video 235,Description for Video 235,Trailers,4.0 | ||
Video 236,Description for Video 236,Science & Technology,4.1 | ||
Video 237,Description for Video 237,Travel & Events,4.6 | ||
Video 238,Description for Video 238,Documentary,3.6 | ||
Video 239,Description for Video 239,Videoblogging,4.9 | ||
Video 240,Description for Video 240,Classics,4.8 | ||
Video 241,Description for Video 241,Travel & Events,3.5 | ||
Video 242,Description for Video 242,Nonprofits & Activism,4.6 | ||
Video 243,Description for Video 243,Movies,2.8 | ||
Video 244,Description for Video 244,Foreign,4.8 | ||
Video 245,Description for Video 245,Travel & Events,4.3 | ||
Video 246,Description for Video 246,Film & Animation,3.7 | ||
Video 247,Description for Video 247,Shorts,3.7 | ||
Video 248,Description for Video 248,Pets & Animals,3.1 | ||
Video 249,Description for Video 249,Nonprofits & Activism,3.5 | ||
Video 250,Description for Video 250,Thriller,3.2 | ||
Video 251,Description for Video 251,Comedy,4.6 | ||
Video 252,Description for Video 252,Shorts,2.0 | ||
Video 253,Description for Video 253,Nonprofits & Activism,4.2 | ||
Video 254,Description for Video 254,Shorts,4.8 | ||
Video 255,Description for Video 255,Comedy,3.8 | ||
Video 256,Description for Video 256,Anime/Animation,4.3 | ||
Video 257,Description for Video 257,People & Blogs,4.4 | ||
Video 258,Description for Video 258,Shows,3.9 | ||
Video 259,Description for Video 259,Music,3.1 | ||
Video 260,Description for Video 260,Nonprofits & Activism,5.0 | ||
Video 261,Description for Video 261,Gaming,3.3 | ||
Video 262,Description for Video 262,Classics,2.8 | ||
Video 263,Description for Video 263,Autos & Vehicles,2.3 | ||
Video 264,Description for Video 264,Comedy,3.9 | ||
Video 265,Description for Video 265,Pets & Animals,2.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# import pandas as pd | ||
# from sklearn.model_selection import train_test_split | ||
# from sklearn.linear_model import LinearRegression | ||
# from sklearn.metrics import mean_squared_error | ||
# from sklearn.feature_extraction.text import TfidfVectorizer | ||
# from sklearn.compose import ColumnTransformer | ||
# from sklearn.pipeline import Pipeline | ||
# from sklearn.preprocessing import OneHotEncoder | ||
# from sklearn.neighbors import NearestNeighbors | ||
|
||
# # Read the data from the CSV file | ||
# df = pd.read_csv('sample_dataset.csv') | ||
|
||
# # Define the features (text and categorical) | ||
# text_features = ['video_description'] | ||
# categorical_features = ['video_category'] | ||
|
||
# # Create a ColumnTransformer to preprocess text and categorical features | ||
# preprocessor = ColumnTransformer( | ||
# transformers=[ | ||
# ('text', TfidfVectorizer(), text_features), | ||
# ('cat', OneHotEncoder(), categorical_features) | ||
# ]) | ||
|
||
# # Create a Linear Regression model | ||
# model = Pipeline([ | ||
# ('preprocessor', preprocessor), | ||
# ('regressor', LinearRegression()) | ||
# ]) | ||
|
||
# # Define the target variable | ||
# y = df['video_rating'] | ||
|
||
|
||
# # Split the data into training and testing sets | ||
# X_train, X_test, y_train, y_test = train_test_split(df.drop('video_rating', axis=1), y, test_size=0.2, random_state=42) | ||
|
||
|
||
# # Convert column names to strings | ||
# X_train.columns = X_train.columns.astype(str) | ||
|
||
|
||
# # Train the model | ||
# model.fit(X_train, y_train) | ||
|
||
# # Make predictions | ||
# y_pred = model.predict(X_test) | ||
|
||
# # Calculate the Mean Squared Error | ||
# mse = mean_squared_error(y_test, y_pred) | ||
# print("Mean Squared Error:", mse) | ||
|
||
# # Now, you can use this model to recommend videos to a user based on their mood and rating preferences. | ||
# # To recommend videos for a user with mood "Shorts" and ratings between 3.5 and 4.0, you can use k-Nearest Neighbors (k-NN) to find the most similar videos. | ||
|
||
# # First, transform the user's mood and rating into the feature space used by the model | ||
# user_features = tfidf_vectorizer.transform(["Shorts"]).toarray() | ||
# user_rating = 3.75 # Average of 3.5 and 4.0 | ||
|
||
# # Combine the user's features with their rating | ||
# user_input = pd.concat([pd.DataFrame(user_features), df[category_feature_names].iloc[0, :], pd.DataFrame({'user_rating': [user_rating]})], axis=1) | ||
|
||
# # Fit a k-NN model to find similar videos | ||
# knn = NearestNeighbors(n_neighbors=10) | ||
# knn.fit(X) | ||
|
||
# # Find the indices of the most similar videos | ||
# distances, indices = knn.kneighbors(user_input, n_neighbors=10) | ||
|
||
# # Get the recommended video titles | ||
# recommended_video_titles = df['video_title'].iloc[indices[0]] | ||
|
||
# print("Recommended videos:") | ||
# print(recommended_video_titles) | ||
|
||
|
||
import pandas as pd | ||
from sklearn.feature_extraction.text import TfidfVectorizer | ||
from sklearn.metrics.pairwise import linear_kernel | ||
|
||
# Step 1: Load the dataset | ||
df = pd.read_csv('train.csv') | ||
|
||
|
||
tfidf_vectorizer = TfidfVectorizer() | ||
tfidf_matrix = tfidf_vectorizer.fit_transform(df['video_description']) | ||
|
||
cosine_sim = linear_kernel(tfidf_matrix, tfidf_matrix) | ||
|
||
|
||
# Step 6: Make Predictions | ||
def get_recommendations(category, rating): | ||
# Find the index of the video matching the user's input | ||
user_input_index = df[(df['video_category'] == category) & (df['video_rating'] == rating)].index[0] | ||
|
||
# Compute the cosine similarity scores for all videos | ||
sim_scores = list(enumerate(cosine_sim[user_input_index])) | ||
|
||
# Sort the videos based on similarity scores | ||
sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True) | ||
|
||
# Get the top recommendations | ||
top_recommendations = sim_scores[1:6] # Exclude the user's input video | ||
recommended_indices = [rec[0] for rec in top_recommendations] | ||
|
||
# Return the video titles of the recommended videos | ||
recommended_titles = df['video_title'].iloc[recommended_indices] | ||
return recommended_titles | ||
|
||
# Example usage | ||
user_category = "Comedy" | ||
user_rating = 3.4 | ||
recommendations = get_recommendations(user_category, user_rating) | ||
print("Recommended Video Titles:") | ||
print(recommendations) |
Oops, something went wrong.