微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

scipy.minimize ValueError:用户提供的目标函数必须返回标量值

如何解决scipy.minimize ValueError:用户提供的目标函数必须返回标量值

我已阅读文档并试图了解如何使用scipy.optimize.minimize(),但我做不到。

         [
             'label' => "Select Country",'name' => 'company_country','type' => 'select2_from_ajax','entity'   =>'country',//method
             'attribute' => 'name',//showing to user
             'model' => "App\Models\Country",//foreign key
             'data_source' => url('getCountry'),'placeholder' => 'Select country','minimum_input_length' => 3,'wrapperAttributes'=>['class'=>'form-group col-md-8'],] ```
In my controller i have this method for country

 ```
    public function getCountry($id)
    {
      return Country::find($id);
     } ``` 

What should go in Model and in the routes for that?
if someone provides a demo for the country,state and city,It is appreciatable. 


输出 ValueError:用户提供的目标函数必须返回标量值。” 或类似的东西

解决方法

我已经解决了:x0应该是数字或(1,)数组

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。