Porosity prediction from seismic data in carbonate reservoirs is challenging because the common presence of heterogeneities in carbonates makes it difficult to establish a clear physical relationship between reservoir properties and elastic responses. Regarding the strong nonlinearities underlying the relationship, machine learning is considered to be a good alternative to traditional methods. We compare several representative supervised machine learning algorithms (light gradient boosting machine [LightGBM], extreme gradient boosting, categorical boosting, random forest, multilayer perceptron, and convolutional neural network) in terms of predictive accuracy and runtime for crosswell blind tests and seismic prediction in a heterogeneous carbonate reservoir, offshore Brazil. The machine learning models are trained with the porosity and elastic parameters (P-impedance and ratio) from the smoothed and standardized logging data. Then, we apply the trained model on the inverted elastic properties to predict the porosity profile from seismic data. In the crosswell blind tests for the studied reservoir, LightGBM clearly stands out from the compared machine learning methods with the highest predictive accuracy and the shortest runtime, showing potential for fast and reliable porosity prediction from seismic data. In addition, we analyze the geologic factors (clay content, oil saturation, and relative depth) that possibly affect the predictive accuracy. We find that, with the constraints from clay content and fluids saturation, the performance of porosity prediction from elastic parameters can be further improved to a certain degree.