This file contains hidden or 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
package main | |
import ( | |
"log" | |
"os" | |
"github.com/gdamore/tcell" | |
) | |
func main() { |
This file contains hidden or 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
package main | |
import ( | |
"time" | |
"github.com/gdamore/tcell" | |
) | |
type Game struct { | |
Screen tcell.Screen |
This file contains hidden or 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
package main | |
type SnakePart struct { | |
X int | |
Y int | |
} | |
type SnakeBody struct { | |
Parts []SnakePart | |
Xspeed int |
This file contains hidden or 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
package main | |
type SnakeBody struct { | |
X int | |
Y int | |
Xspeed int | |
Yspeed int | |
} | |
func (sb *SnakeBody) ChangeDir(vertical int, horizontal int) { |
This file contains hidden or 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
package main | |
import ( | |
"time" | |
"github.com/gdamore/tcell" | |
) | |
type Game struct { | |
Screen tcell.Screen |
This file contains hidden or 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
package main | |
import ( | |
"log" | |
"os" | |
"github.com/gdamore/tcell" | |
) | |
func main() { |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
This file contains hidden or 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
bucketized_user_age,movie_genres,movie_id,movie_length,movie_title,movie_title_text,timestamp,user_gender,user_id,user_occupation_label,user_occupation_text,user_rating,user_zip_code | |
1.0,[7],b'150',140,b'Apollo 13 (1995)',b'Apollo 13 (1995)',978301777,False,b'1',17,b'K-12 student',5.0,b'48067' | |
1.0,[7],b'1193',133,"b""One Flew Over the Cuckoo's Nest (1975)""","b""One Flew Over the Cuckoo's Nest (1975)""",978300760,False,b'1',17,b'K-12 student',5.0,b'48067' | |
1.0,[ 2 3 12],b'1022',74,b'Cinderella (1950)',b'Cinderella (1950)',978300055,False,b'1',17,b'K-12 student',5.0,b'48067' | |
1.0,[ 2 3 12],b'595',84,b'Beauty and the Beast (1991)',b'Beauty and the Beast (1991)',978824268,False,b'1',17,b'K-12 student',5.0,b'48067' | |
1.0,[ 2 3 12 14],b'48',81,b'Pocahontas (1995)',b'Pocahontas (1995)',978824351,False,b'1',17,b'K-12 student',5.0,b'48067' | |
1.0,[ 2 3 12],b'1029',64,b'Dumbo (1941)',b'Dumbo (1941)',978302205,False,b'1',17,b'K-12 student',5.0,b'48067' | |
1.0,[12],b'1035',172,"b'Sound of Music, The (1965)'","b'Sound of Music |
This file contains hidden or 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
import argparse | |
import os | |
import numpy as np | |
import tensorflow as tf | |
import tensorflow_datasets as tfds | |
import tensorflow_recommenders as tfrs | |
import pickle | |
import plotly.graph_objects as go | |
import plotly.io as pio | |
import re |
This file contains hidden or 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
def get_user_sim_values(train_set): | |
users_age_gender = (users_df. | |
assign(inner_id=lambda df: df['user_id'].apply(lambda x: train_set.to_inner_uid(x)), | |
gender=lambda df: df['gender'].replace({'M': 0, 'F': 1}).astype('int')). | |
sort_values('inner_id'). | |
filter(items=['age', 'gender']) | |
) | |
user_values_np = StandardScaler().fit_transform(users_age_gender.to_numpy()) | |
cosine_sim_user_values = cosine_similarity(user_values_np, user_values_np) | |
return cosine_sim_user_values |
This file contains hidden or 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
import ast | |
from itertools import combinations | |
movies_df['genre_list'] = movies_df['genre'].apply(ast.literal_eval) | |
tf_genres = TfidfVectorizer(analyzer=lambda s: (c for i in range(1,4) for c in combinations(s, r=i))) | |
tfidf_genres = tf_genres.fit_transform(movies_df['genre_list']) | |
item_matrix_genres_trainset_loocv = get_item_matrix_with_inner_ids(tfidf_genres.todense(), movies_df, train_loocv) | |
cosine_sim_genres_trainset_loocv = cosine_similarity(item_matrix_genres_trainset_loocv, | |
item_matrix_genres_trainset_loocv) |