Badges
Certifications
Certificate: Python (Basic)
Certificate: Python (Intermediate)
Certificate: Problem Solving (Basic)
Certificate: SQL (Basic)
Certificate: C (Basic)
Certificate: C (Intermediate)
Certificate: C (Advanced)
Certificate: Java (Basic)
Certificate: JavaScript (Basic)
Certificate: React (Basic)
Certificate: Frontend Developer (React)
Certificate: Software Engineer Intern
Certificate: JavaScript (Intermediate)
Work Experience
Software Engineer
TCS•  November 2021 - January 2024
Education
Government Engineering College
Information Technology, B.Tech•  July 2017 - July 2021•  CGPA: 7
user_song_matrix = train_data.pivot_table(index='user_id', columns='song_id', values='listen_count', fill_value=0) from sklearn.metrics.pairwise import cosine_similarity # Compute user similarity user_similarity = cosine_similarity(user_song_matrix) # Create a DataFrame for similarity scores user_similarity_df = pd.DataFrame(user_similarity, index=user_song_matrix.index, columns=user_song_matrix.index) # Function to recommend songs def recommend_songs(user_id, num_recommendations=10): similar_users = user_similarity_df[user_id].sort_values(ascending=False).index[1:] # Exclude the user recommendations = [] for similar_user in similar_users: songs = train_data[train_data['user_id'] == similar_user]['song_id'].tolist() recommendations.extend(songs) if len(recommendations) >= num_recommendations: break return list(set(recommendations)[:num_recommendations]) recommendations = [] # For each user in the test set, generate recommendations for user_id in train_data['user_id'].unique(): recommended_songs = recommend_songs(user_id) recommendations.append([user_id] + recommended_songs) # Save recommendations to a CSV file with open('recommendations.csv', 'w', newline='') as file: writer = csv.writer(file) writer.writerows(recommendations)