I am aware that there are algorithms to fit, say, an ellipse to a bunch of given points on a plane. For instance, this SO question has answers which feature both literature on the algorithms and implementations in python. However, suppose our data doesn't look like an ellipse, and instead of an ellipse, we want to fit a more general shape. Obviously that's a little bit too general, because "convex shape" is too broad a category, so I guess what I'm really looking for is for a way to fit a convex shape that is, in an appropriate sense, smooth.
My question arose after trying to calculate the area included inside a hysteresis loop which was given by a lot of noisy data, and they weren't given in proper order either. If I could just fit that somewhat weird shape, then I could use one of the many algorithms available to calculate the area enclosed by the curve I would be given. I guess one solution would be to find a way to do some kind of least squares fit of this specific shape, but I'm wondering whether there's some more general way.