Cross-entropy loss trains classification models by combining class-logit normalization with negative log-likelihood. It is appropriate when the target represents categories such as 0 or 1, rather than a continuous value. section 8.2.1
Diagnosing the wrong loss
Suppose a model predicts whether an Airbnb listing's price is above or below the median. If the target remains numeric, fastai may infer regression and select MSELoss(), producing disappointing accuracy. Converting the target with merged_data['target'] = merged_data.target.astype(str) lets fastai treat it as classification; inspecting learn.loss_func then shows CrossEntropyLoss(). section 8.2.1
Listing 8.8 Statement to show the loss function used in model training
learn.loss_func #1 FlattenedLoss of CrossEntropyLoss() #2
Inspect the configured fastai loss function and verify that classification uses CrossEntropyLoss() rather than MSELoss(). section 8.2.1


















