movies = pd.read_csv(path/'u.item', delimiter='|', encoding='latin-1', header=None,
names=[item,'title','date','N','url',*[f'g{i}'for i inrange(19)]])
movies.head()
<div>
<style>
/* Turns off some styling */
progress {
/* gets rid of default border in Firefox and Opera. */
border: none;
/* Needs to be in here for Safari polyfill so background images work as expected. */
background-size: auto;
}
.progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {
background: #F44336;
}
</style>
<progress value='0' class='' max='1', style='width:300px; height:20px; vertical-align: middle;'></progress>
0.00% [0/1 00:00<00:00]
</div>
epoch
train_loss
valid_loss
time
<div>
<style>
/* Turns off some styling */
progress {
/* gets rid of default border in Firefox and Opera. */
border: none;
/* Needs to be in here for Safari polyfill so background images work as expected. */
background-size: auto;
}
.progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {
background: #F44336;
}
</style>
<progress value='99' class='' max='1406', style='width:300px; height:20px; vertical-align: middle;'></progress>
7.04% [99/1406 00:23<05:13 3.0871]
</div>
LR Finder is complete, type {learner_name}.recorder.plot() to see the graph.
g = rating_movie.groupby(title)['rating'].count()
top_movies = g.sort_values(ascending=False).index.values[:1000]
top_movies[:10]
array(['Star Wars (1977)', 'Contact (1997)', 'Fargo (1996)', 'Return of the Jedi (1983)', 'Liar Liar (1997)',
'English Patient, The (1996)', 'Scream (1996)', 'Toy Story (1995)', 'Air Force One (1997)',
'Independence Day (ID4) (1996)'], dtype=object)
[(tensor(1.2644), 'Home Alone 3 (1997)'),
(tensor(1.2343), 'Jungle2Jungle (1997)'),
(tensor(1.1393), 'Leave It to Beaver (1997)'),
(tensor(1.1283), "McHale's Navy (1997)"),
(tensor(1.0802), 'Bio-Dome (1996)'),
(tensor(1.0767), 'D3: The Mighty Ducks (1996)'),
(tensor(1.0556), 'Grease 2 (1982)'),
(tensor(1.0416), 'Children of the Corn: The Gathering (1996)'),
(tensor(1.0365), 'Batman & Robin (1997)'),
(tensor(1.0237), 'Free Willy 3: The Rescue (1997)')]
sorted(movie_comp, key=itemgetter(0))[:10]
[(tensor(-1.0996), 'Casablanca (1942)'),
(tensor(-1.0553), 'Wrong Trousers, The (1993)'),
(tensor(-1.0370), 'Lawrence of Arabia (1962)'),
(tensor(-1.0336), 'When We Were Kings (1996)'),
(tensor(-1.0198), 'Close Shave, A (1995)'),
(tensor(-1.0137), 'Shall We Dance? (1996)'),
(tensor(-1.0088), 'Chinatown (1974)'),
(tensor(-0.9817), 'Some Folks Call It a Sling Blade (1993)'),
(tensor(-0.9786),
'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb (1963)'),
(tensor(-0.9571), 'Citizen Kane (1941)')]
[(tensor(0.8437), 'Ready to Wear (Pret-A-Porter) (1994)'),
(tensor(0.7802), 'Keys to Tulsa (1997)'),
(tensor(0.7405), 'Trainspotting (1996)'),
(tensor(0.7400), 'Jude (1996)'),
(tensor(0.7397), 'Big Night (1996)'),
(tensor(0.7165), 'Brazil (1985)'),
(tensor(0.7136), 'Exotica (1994)'),
(tensor(0.7030), 'Nosferatu (Nosferatu, eine Symphonie des Grauens) (1922)'),
(tensor(0.7022), 'Sweet Hereafter, The (1997)'),
(tensor(0.6906), 'Cable Guy, The (1996)')]
sorted(movie_comp, key=itemgetter(0))[:10]
[(tensor(-1.1935), 'Braveheart (1995)'),
(tensor(-1.1555), 'Raiders of the Lost Ark (1981)'),
(tensor(-1.0948), 'Titanic (1997)'),
(tensor(-0.8792), 'Independence Day (ID4) (1996)'),
(tensor(-0.8687), "It's a Wonderful Life (1946)"),
(tensor(-0.8572), 'Return of the Jedi (1983)'),
(tensor(-0.8526), 'Hunt for Red October, The (1990)'),
(tensor(-0.8456), 'Star Wars (1977)'),
(tensor(-0.8433), 'Forrest Gump (1994)'),
(tensor(-0.8419), 'Shawshank Redemption, The (1994)')]
绘图
idxs = np.random.choice(len(top_movies),50, replace=False)
idxs =list(range(50))
X = fac0[idxs]
Y = fac2[idxs]
plt.figure(figsize=(15,15))
plt.scatter(X, Y)for i, x, y inzip(top_movies[idxs], X, Y):
plt.text(x,y,i, color=np.random.rand(3)*0.7, fontsize=11)
plt.show()