from fastai.gen_doc.nbdoc import * from fastai.vision import * from fastai import * show_doc(create_cnn, doc_string=False) path = untar_data(URLs.MNIST_SAMPLE) data = ImageDataBunch.from_folder(path) learner = create_cnn(data, models.resnet18, metrics=[accuracy]) learner.fit_one_cycle(1,1e-3) learner.save('one_epoch') show_doc(Learner.predict) img = learner.data.train_ds[0][0] learner.predict(img) data.export() empty_data = ImageDataBunch.load_empty(path, tfms=get_transforms()[1]).normalize(imagenet_stats) learn = create_cnn(empty_data, models.resnet18) learn = learn.load('one_epoch') show_doc(create_body) show_doc(create_head, doc_string=False) show_doc(ClassificationInterpretation) learn = create_cnn(data, models.resnet18) learn.fit(1) preds,y,losses = learn.get_preds(with_loss=True) interp = ClassificationInterpretation(data, preds, y, losses) show_doc(ClassificationInterpretation.from_learner) jekyll_warn('In both those methods `sigmoid` is a deprecated argument and will be removed in a future version.') show_doc(ClassificationInterpretation.plot_top_losses) interp.plot_top_losses(9, figsize=(7,7)) show_doc(ClassificationInterpretation.top_losses) interp.top_losses(9) show_doc(ClassificationInterpretation.plot_confusion_matrix) interp.plot_confusion_matrix() show_doc(ClassificationInterpretation.confusion_matrix) interp.confusion_matrix() show_doc(ClassificationInterpretation.most_confused) interp.confusion_matrix(slice_size=10) interp.plot_confusion_matrix(slice_size=10) interp.most_confused(slice_size=10) show_doc(create_cnn)