{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Viewing inputs and outputs" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [], "source": [ "from fastai.basics import *\n", "from fastai.gen_doc.nbdoc import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this tutorial, we'll see how the same API allows you to get a look at the inputs and outputs of your model, whether in the vision, text or tabular application. We'll go over a lot of different tasks and each time, grab some data in a [`DataBunch`](/basic_data.html#DataBunch) with the [data block API](/data_block.html), see how to get a look at a few inputs with the `show_batch` method, train an appropriate [`Learner`](/basic_train.html#Learner) then use the `show_results` method to see what the outputs of our model actually look like." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "
epoch | \n", "train_loss | \n", "valid_loss | \n", "accuracy | \n", "time | \n", "
---|---|---|---|---|
0 | \n", "0.528842 | \n", "0.331977 | \n", "0.838340 | \n", "00:02 | \n", "
epoch | \n", "train_loss | \n", "valid_loss | \n", "time | \n", "
---|---|---|---|
0 | \n", "0.839076 | \n", "0.770665 | \n", "00:01 | \n", "
1 | \n", "0.804367 | \n", "0.775014 | \n", "00:00 | \n", "
2 | \n", "0.745942 | \n", "0.747781 | \n", "00:00 | \n", "
3 | \n", "0.699037 | \n", "0.675334 | \n", "00:00 | \n", "
4 | \n", "0.660945 | \n", "0.624810 | \n", "00:00 | \n", "
epoch | \n", "train_loss | \n", "valid_loss | \n", "
---|---|---|
1 | \n", "0.731514 | \n", "2.588722 | \n", "
2 | \n", "1.362930 | \n", "9.761332 | \n", "
3 | \n", "1.086815 | \n", "1.290175 | \n", "
4 | \n", "0.837007 | \n", "0.607458 | \n", "
5 | \n", "0.689935 | \n", "0.342040 | \n", "
epoch | \n", "train_loss | \n", "valid_loss | \n", "
---|---|---|
1 | \n", "8.229017 | \n", "3.061078 | \n", "
2 | \n", "5.269776 | \n", "39.258186 | \n", "
3 | \n", "5.350030 | \n", "2.359573 | \n", "
idx | \n", "text | \n", "
---|---|
0 | \n", "! ! ! xxmaj finally this was directed by the guy who did xxmaj big xxmaj xxunk ? xxmaj must be a replay of xxmaj jonestown - hollywood style . xxmaj xxunk ! xxbos xxmaj this is a extremely well - made film . xxmaj the acting , script and camera - work are all first - rate . xxmaj the music is good , too , though it is | \n", "
1 | \n", "that happened to me with \" xxmaj the xxmaj young xxmaj xxunk \" . xxmaj the cover of the video box , if you can find the video , is extremely xxunk . i 'd xxunk that the two women on the cover are n't even in the film . \\n \\n xxmaj anyway , i was either born a decade too late to appreciate the xxunk points of | \n", "
2 | \n", "about \" xxmaj xxunk \" . xxmaj on the plus side , the visuals are xxunk and the movie looks great for it 's type . xxmaj for those who like their horror movies gory there are a few nicely executed ( no pun intended ) murder scenes . xxmaj we also get a few good suspense sequences / set - pieces . \\n \\n xxmaj however , there | \n", "
3 | \n", "and xxmaj she xxmaj kills in xxmaj xxunk , but unfortunately his good films are just xxunk amongst xxunk of crap and xxmaj devil xxmaj hunter is very much a part of the crap . i saw this film purely because i want to be able to say i 've seen everything on the xxup dpp 's list ( just two more to go ! ) , and i 'm | \n", "
4 | \n", "the movie was more important than the planning . xxmaj because you have a camera does not mean you should make a movie right away ... come . xxmaj everyone can make a movie , but not all will be just as good . xxmaj so a word of advice to xxmaj xxunk xxmaj west are : stop and xxunk what you want . xxmaj use your time to start | \n", "
epoch | \n", "train_loss | \n", "valid_loss | \n", "accuracy | \n", "
---|---|---|---|
1 | \n", "4.643319 | \n", "3.866198 | \n", "0.289663 | \n", "
2 | \n", "4.367103 | \n", "3.814913 | \n", "0.292600 | \n", "
text | \n", "target | \n", "pred | \n", "
---|---|---|
xxbos xxmaj start of with the good bit : several times xxmaj xxunk talks xxmaj xxunk to his friends or | \n", "language is heard among the xxunk . xxmaj that 's a great plus , as normally xxup usa & xxup | \n", "of . a . the xxunk . xxmaj the 's why xxunk film . but the , xxunk xxmaj xxup | \n", "
fact , the characters are never really developed at all . xxmaj the xxunk are xxunk , xxunk xxunk , | \n", "the women merely xxunk beautiful . xxmaj if you go by this movie , you would think that \" air | \n", "xxunk xxunk are xxunk the xxunk xxmaj the you 're to the , , you 'll n't that the xxmaj | \n", "
as well ) . xxmaj peter xxunk plays the dying killer daddy and watch for funny man xxmaj xxunk xxmaj | \n", "who made me laugh more than anything in the entire film in his brief five xxunk feet ) . xxmaj | \n", ". is a laugh . than anyone else the movie film . the xxunk xxunk - . . . xxmaj | \n", "
a chance . xxmaj she xxunk deserved her xxmaj oscar . \\n \\n xxmaj this movie is in an | \n", "in the most xxunk xxunk . xxmaj all parts xxunk , necessary and perfect . xxmaj xxunk may walk away | \n", "xxunk xxunk of of xxmaj it the of . the , interesting . xxmaj the xxmaj be away from you | \n", "
xxunk ? ) , terrible cinematography , forgettable dialog , nothing funny or humorous , save the fact you just | \n", "your life for two hours , soundtrack ? , amateurish performances , uneven , disjointed , and often flat out | \n", "a time . the hours . and , xxmaj and xxunk , and acting xxunk acting and xxunk boring , | \n", "
text | \n", "target | \n", "
---|---|
xxbos xxmaj raising xxmaj victor xxmaj vargas : a xxmaj review \\n \\n xxmaj you know , xxmaj raising xxmaj victor xxmaj vargas is like sticking your hands into a big , xxunk bowl of xxunk . xxmaj it 's warm and xxunk , but you 're not sure if it feels right . xxmaj try as i might , no matter how warm and xxunk xxmaj raising xxmaj | \n", "negative | \n", "
xxbos xxup the xxup shop xxup around xxup the xxup corner is one of the xxunk and most feel - good romantic comedies ever made . xxmaj there 's just no getting around that , and it 's hard to actually put one 's feeling for this film into words . xxmaj it 's not one of those films that tries too hard , nor does it come up with | \n", "positive | \n", "
xxbos xxmaj now that xxmaj xxunk ) has finished its relatively short xxmaj australian cinema run ( extremely limited xxunk screen in xxmaj xxunk , after xxunk ) , i can xxunk join both xxunk of \" xxmaj at xxmaj the xxmaj movies \" in taking xxmaj steven xxmaj xxunk to task . \\n \\n xxmaj it 's usually satisfying to watch a film director change his style / | \n", "negative | \n", "
xxbos xxmaj this film sat on my xxmaj xxunk for weeks before i watched it . i xxunk a self - indulgent xxunk flick about relationships gone bad . i was wrong ; this was an xxunk xxunk into the xxunk - up xxunk of xxmaj new xxmaj xxunk . \\n \\n xxmaj the format is the same as xxmaj max xxmaj xxunk ' \" xxmaj la xxmaj xxunk | \n", "positive | \n", "
xxbos xxmaj many xxunk that this is n't just a classic due to the fact that it 's the first xxup 3d game , or even the first xxunk - up . xxmaj it 's also one of the first xxunk games , one of the xxunk definitely the first ) truly claustrophobic games , and just a pretty well - xxunk gaming experience in general . xxmaj with graphics | \n", "positive | \n", "
epoch | \n", "train_loss | \n", "valid_loss | \n", "accuracy | \n", "
---|---|---|---|
1 | \n", "0.713844 | \n", "0.674750 | \n", "0.620000 | \n", "
2 | \n", "0.695729 | \n", "0.655419 | \n", "0.645000 | \n", "
text | \n", "target | \n", "prediction | \n", "
---|---|---|
xxbos \\n \\n i 'm sure things did n't exactly go the same way in the real life of xxmaj xxunk xxmaj xxunk as they did in the film adaptation of his book , xxmaj rocket xxmaj boys , but the movie \" xxmaj xxunk xxmaj sky \" ( an xxunk of the book 's title ) is good enough to stand alone . i have not read xxmaj | \n", "positive | \n", "positive | \n", "
xxbos xxmaj to review this movie , i without any doubt would have to quote that memorable scene in xxmaj tarantino 's \" xxmaj pulp xxmaj fiction \" ( xxunk ) when xxmaj jules and xxmaj vincent are talking about xxmaj mia xxmaj wallace and what she does for a living . xxmaj jules tells xxmaj vincent that the \" xxmaj only thing she did worthwhile was pilot \" . | \n", "negative | \n", "negative | \n", "
xxbos xxmaj how viewers react to this new \" adaption \" of xxmaj shirley xxmaj jackson 's book , which was promoted as xxup not being a remake of the original 1963 movie ( true enough ) , will be based , i suspect , on the following : those who were big fans of either the book or original movie are not going to think much of this one | \n", "negative | \n", "negative | \n", "
xxbos xxmaj the trouble with the book , \" xxmaj memoirs of a xxmaj xxunk \" is that it had xxmaj japanese xxunk but underneath the xxunk it was all an xxmaj american man 's way of thinking . xxmaj reading the book is like watching a magnificent ballet with great music , sets , and costumes yet performed by xxunk animals dressed in those xxunk far from xxmaj japanese | \n", "negative | \n", "negative | \n", "
xxbos xxmaj bonanza had a great cast of wonderful actors . xxmaj xxunk xxmaj xxunk , xxmaj pernell xxmaj whitaker , xxmaj michael xxmaj xxunk , xxmaj dan xxmaj blocker , and even xxmaj guy xxmaj williams ( as the cousin who was brought in for several episodes during 1964 to replace xxmaj adam when he was leaving the series ) . xxmaj the cast had chemistry , and they | \n", "positive | \n", "negative | \n", "
workclass | \n", "education | \n", "marital-status | \n", "occupation | \n", "relationship | \n", "race | \n", "sex | \n", "native-country | \n", "education-num_na | \n", "education-num | \n", "hours-per-week | \n", "age | \n", "capital-loss | \n", "fnlwgt | \n", "capital-gain | \n", "target | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Private | \n", "Some-college | \n", "Never-married | \n", "Other-service | \n", "Own-child | \n", "White | \n", "Female | \n", "United-States | \n", "False | \n", "-0.0312 | \n", "-2.9515 | \n", "-1.4357 | \n", "-0.2164 | \n", "-1.5321 | \n", "-0.1459 | \n", "<50k | \n", "
Private | \n", "Some-college | \n", "Married-civ-spouse | \n", "Transport-moving | \n", "Husband | \n", "White | \n", "Male | \n", "United-States | \n", "False | \n", "-0.0312 | \n", "-0.0356 | \n", "0.5434 | \n", "-0.2164 | \n", "-1.4779 | \n", "0.2731 | \n", ">=50k | \n", "
Self-emp-not-inc | \n", "Bachelors | \n", "Married-civ-spouse | \n", "Exec-managerial | \n", "Husband | \n", "White | \n", "Male | \n", "United-States | \n", "False | \n", "1.1422 | \n", "1.5843 | \n", "0.2502 | \n", "-0.2164 | \n", "-0.8355 | \n", "-0.1459 | \n", ">=50k | \n", "
Private | \n", "HS-grad | \n", "Married-civ-spouse | \n", "Craft-repair | \n", "Husband | \n", "White | \n", "Male | \n", "United-States | \n", "False | \n", "-0.4224 | \n", "-0.0356 | \n", "0.8365 | \n", "-0.2164 | \n", "-1.4989 | \n", "-0.1459 | \n", ">=50k | \n", "
Private | \n", "HS-grad | \n", "Divorced | \n", "Machine-op-inspct | \n", "Not-in-family | \n", "White | \n", "Male | \n", "United-States | \n", "False | \n", "-0.4224 | \n", "-0.0356 | \n", "-0.4095 | \n", "-0.2164 | \n", "-0.5707 | \n", "-0.1459 | \n", "<50k | \n", "
epoch | train_loss | valid_loss | accuracy |
---|---|---|---|
1 | 0.336497 | 0.354954 | 0.840000 |
2 | 0.322417 | 0.356564 | 0.815000 |
3 | 0.316230 | 0.340134 | 0.850000 |
4 | 0.313944 | 0.354506 | 0.835000 |
5 | 0.330136 | 0.341288 | 0.850000 |
"
],
"text/plain": [
"\n",
" \n",
"
"
],
"text/plain": [
"\n",
" \n",
" \n",
" \n",
" workclass \n",
" education \n",
" marital-status \n",
" occupation \n",
" relationship \n",
" race \n",
" sex \n",
" native-country \n",
" education-num_na \n",
" education-num \n",
" hours-per-week \n",
" age \n",
" capital-loss \n",
" fnlwgt \n",
" capital-gain \n",
" target \n",
" prediction \n",
" \n",
" \n",
" Private \n",
" Some-college \n",
" Divorced \n",
" Handlers-cleaners \n",
" Unmarried \n",
" White \n",
" Female \n",
" United-States \n",
" True \n",
" -0.0312 \n",
" -0.0356 \n",
" 0.4701 \n",
" -0.2164 \n",
" -0.8793 \n",
" -0.1459 \n",
" <50k \n",
" <50k \n",
" \n",
" \n",
" Self-emp-inc \n",
" Prof-school \n",
" Married-civ-spouse \n",
" Prof-specialty \n",
" Husband \n",
" White \n",
" Male \n",
" United-States \n",
" True \n",
" -0.0312 \n",
" 1.5843 \n",
" 0.5434 \n",
" -0.2164 \n",
" 0.0290 \n",
" 1.8829 \n",
" >=50k \n",
" >=50k \n",
" \n",
" \n",
" Private \n",
" Assoc-voc \n",
" Divorced \n",
" #na# \n",
" Not-in-family \n",
" White \n",
" Male \n",
" United-States \n",
" True \n",
" -0.0312 \n",
" -0.1976 \n",
" -0.1896 \n",
" -0.2164 \n",
" 1.7704 \n",
" -0.1459 \n",
" <50k \n",
" <50k \n",
" \n",
" \n",
" Federal-gov \n",
" Bachelors \n",
" Never-married \n",
" Tech-support \n",
" Not-in-family \n",
" White \n",
" Male \n",
" United-States \n",
" True \n",
" -0.0312 \n",
" 0.3694 \n",
" -0.9959 \n",
" -0.2164 \n",
" -1.3242 \n",
" -0.1459 \n",
" <50k \n",
" <50k \n",
" \n",
" \n",
" \n",
"Private \n",
" Bachelors \n",
" Married-civ-spouse \n",
" #na# \n",
" Husband \n",
" White \n",
" Male \n",
" United-States \n",
" True \n",
" -0.0312 \n",
" -0.0356 \n",
" -0.1163 \n",
" -0.2164 \n",
" -0.2389 \n",
" -0.1459 \n",
" <50k \n",
" <50k \n",
"