You likely need to import numobs
import MLUtils: numobs
or name it explicitly
MLUtils.numobs(data::my_dataset) = size(data.data_arr)[end]
By implementing it without importing or namespacing, you are defining a new function in the current module rather than adding a new method to the existing function.