1.How could multi-label classification improve the usability of the bear classifier?
可以对不存在的熊进行分类
2.How do we encode the dependent variable in a multi-label classification problem?
One-hot encoding: Using a vector of zeros, with a one in each location that is represented in the data, to encode a list of integers.
3.How do you access the rows and columns of a DataFrame as if it was a matrix?
df.iloc
4.How do you get a column by name from a DataFrame?
df[‘name’]
5.What is the difference between a Dataset and DataLoader?
Dataset:: A collection that returns a tuple of your independent and dependent variable for a single item
DataLoader:: An iterator that provides a stream of mini-batches, where each mini-batch is a tuple of a batch of independent variables and a batch of dependent variables
6.What does a Datasets object normally contain?
training set and valid set
7. What does a DataLoaders object normally contain?
training dataloader and valid dataloader
8. What does lambda do in Python?
一种简写函数的方式
9.What are the methods to customize how the independent and dependent variables are created with the data block API?
get_x:自变量
get_y:因变量
10.Why is softmax not an appropriate output activation function when using a one hot encoded target?
softmax只能预测一个结果,无法满足多标签需求
11.Why is nll_loss not an appropriate loss function when using a one-hot-encoded target?
nll_loss只能返回一个激活值
12.What is the difference between nn.BCELoss and nn.BCEWithLogitsLoss?
F.binary_cross_entropy and its module equivalent nn.BCELoss calculate cross-entropy on a one-hot-encoded target, but do not include the initial sigmoid. Normally for one-hot-encoded targets you’ll want F.binary_cross_entropy_with_logits (or nn.BCEWithLogitsLoss), which do both sigmoid and binary cross-entropy in a single function.
13.Why can’t we use regular accuracy in a multi-label problem?
常规准确性函数假设最终预测结果为可能性做的多类别,但是在多标签问题中,需要设置激活阈值,以选择最终预测结果,以便于分类目标比较。
14.When is it okay to tune a hyperparameter on the validation set?
In this case, we’re using the validation set to pick a hyperparameter (the threshold), which is the purpose of the validation set. Sometimes students have expressed their concern that we might be overfitting to the validation set, since we’re trying lots of values to see which is the best. However, as you see in the plot, changing the threshold in this case results in a smooth curve, so we’re clearly not picking some inappropriate outlier. This is a good example of where you have to be careful of the difference between theory (don’t try lots of hyperparameter values or you might overfit the validation set) versus practice (if the relationship is smooth, then it’s fine to do this).
当组成的曲线是平滑的时,可以
15.How is y_range implemented in fastai? (See if you can implement it yourself and test it without peeking!)
def sigmod(x, hi, lo):
return x.sigmod()*(hi-lo)+lo
16.What is a regression problem? What loss function should you use for such a problem?
预测连续型结果,mse
17.What do you need to do to make sure the fastai library applies the same data augmentation to your input images and your target point coordinates?
PointBlock.
The only other difference from the previous data block examples is that the second block is a PointBlock. This is necessary so that fastai knows that the labels represent coordinates; that way, it knows that when doing data augmentation, it should do the same augmentation to these coordinates as it does to the images: