File "e:\anaconda3\experiment\未命名0.py", line 87, in <module> lin_reg = LinearRegression(normalize = True) TypeError: __init__() got an unexpected keyword argument 'normalize'
时间: 2023-04-09 11:04:13 浏览: 138
这个错误是因为 LinearRegression 类没有 normalize 参数。可能是因为你使用的是旧版本的 scikit-learn 库,或者你的代码有误。你可以尝试更新 scikit-learn 库或者检查你的代码是否正确。
相关问题
E:\anaconda\ruanjianbenti\python.exe E:\shouyanbioading\nengrundedaima\球心拟合平面再求法向量.py Traceback (most recent call last): File "E:\shouyanbioading\nengrundedaima\球心拟合平面再求法向量.py", line 32, in <module> sphere_centers = [fit_sphere(pcd) for pcd in point_clouds] File "E:\shouyanbioading\nengrundedaima\球心拟合平面再求法向量.py", line 32, in <listcomp> sphere_centers = [fit_sphere(pcd) for pcd in point_clouds] File "E:\shouyanbioading\nengrundedaima\球心拟合平面再求法向量.py", line 8, in fit_sphere sphere = pcd.compute_fit_sphere() AttributeError: 'open3d.cpu.pybind.geometry.PointCloud' object has no attribute 'compute_fit_sphere' 这个报错应该如何解决,或者如何修改代码?
这个错误提示是因为 `open3d.cpu.pybind.geometry.PointCloud` 对象没有 `compute_fit_sphere` 方法。
你需要使用 `open3d.geometry` 模块里的 `PointCloud` 对象。可以修改代码如下:
```python
import numpy as np
import open3d as o3d
def fit_sphere(pcd):
sphere = o3d.geometry.TriangleMesh.create_sphere(radius=1.0)
sphere.compute_vertex_normals()
pcd.estimate_normals(search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=0.1, max_nn=30))
distances = pcd.compute_nearest_neighbor_distance()
avg_dist = np.mean(distances)
radius = 1.5 * avg_dist
sphere = sphere.scale(radius, center=sphere.get_center())
o3d.io.write_triangle_mesh("sphere.ply", sphere)
pcd.paint_uniform_color([1, 0.706, 0])
sphere.translate(pcd.get_center())
o3d.visualization.draw_geometries([pcd, sphere])
return sphere.get_center()
point_clouds = []
# ... 读取点云数据到 point_clouds ...
sphere_centers = [fit_sphere(o3d.geometry.PointCloud(pcd)) for pcd in point_clouds]
```
这里使用 `o3d.geometry.PointCloud` 将 `open3d.cpu.pybind.geometry.PointCloud` 转换成 `open3d.geometry.PointCloud`,从而调用 `compute_fit_sphere` 方法。
Traceback (most recent call last): File "F:\pythonproject\ARIMA-GRACH\3.py", line 27, in <module> arima_result = arima_model.fit(disp=False) File "E:\anaconda\lib\site-packages\statsmodels\base\wrapper.py", line 34, in __getattribute__ obj = getattr(results, attr) AttributeError: 'ARIMAResults' object has no attribute 'fit'
这个错误提示表明你在一个`ARIMAResults`对象上调用了`fit()`方法,但是`ARIMAResults`类并没有该方法。`ARIMAResults`对象是通过对`ARIMA`模型进行拟合后生成的结果对象,而拟合过程实际上是在`ARIMA`模型对象上进行的。因此,你需要使用`ARIMA`对象的`fit()`方法来拟合模型,而不是在`ARIMAResults`对象上调用该方法。