ScikitSpatial使用Plane.best_fit提供奇怪的最佳拟合平面

2024-05-17 12:14:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用scikit spatial为三维点列表找到最适合的平面。它通常适用于其他列表,但这一个给我带来了一些麻烦

代码(py):

from skspatial.objects import Plane
from skspatial.objects import Points
from skspatial.objects import Point
from skspatial.plotting import plot_3d

points_list = [[2018.0, 3.0, -3.0], [2016.0, 3.0, -7.0], [2014.0, 27.0, 7.0], [2013.0, 3.0, -1.5], [2012.0, 4.5, 2.0], [2012.0, 16.5, 3.5], [2012.0, 18.0, 5.5], [2010.0, 13.5, 1.0], [2010.0, 21.0, -3.0], [2009.0, 30.0, 4.5]]

plot_3d(
    Points(points_list).plotter(c='k',s=15,depthshade=True),
    Plane.best_fit(points_list).plotter(alpha=0.2, lims_x=(-5, 5), lims_y=(-5, 5))
)[0].show()

供参考:Resulting Plot

无论如何,数据列表几乎是平坦的,但是scikit spatial返回的平面是绝对不合理的。我只是做错了什么,还是发生了别的事情?我在网上四处寻找,但找不到任何类似的东西。谢谢


Tags: fromimport列表objectsplotscikitspatial平面