python中有一个库可以进行分段线性回归吗?我想自动为我的数据添加多行来得到这样的东西:

顺便说一句.我知道细分的数量.
我正在尝试构建slycot,一个围绕fortran库SLICOT的python包装器.我在Anaconda-2.0.1-Windows-x86_6464位Windows 7上使用anaconda python发行版.
第一个天真的python setup.py build命令导致了
NotImplementedError("Only MS compiler supported with gfortran on win64")
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.谷歌搜索了一段时间后,有人建议只是在numpy中评论该行.这似乎有效.调用gfortran并编译所有库,但是在链接以下消息时失败
The command line is too long
Run Code Online (Sandbox Code Playgroud)
似乎列出所有*.o文件会生成一个无法处理的巨大命令字符串.
有什么建议?
如何使用statsmodels ARMA过程来拟合表单的差分方程.
y[k] = - a1 * y[k-1] + b0 * u[k] + b1 * u[k-1] + c0 * e[k] + c1 * e[k-1]
Run Code Online (Sandbox Code Playgroud)
我不知道如何设置exog矩阵.例如
import statsmodels.api as sm
# some stupid data
y = np.random.randn(100)
u = np.ones((100,2))
armax = sm.tsa.ARMA(y, order=(1, 1), exog=u).fit()
Run Code Online (Sandbox Code Playgroud)
结果是
ValueError: could not broadcast input array from shape (2) into shape (3)
Run Code Online (Sandbox Code Playgroud)
它可能很容易解决,但我是该领域的新手.
谢谢.
(我正在使用statsmodels 0.6)
有没有处理坐标系转换的Python库?我正在使用 numpy 网格网格,但有时切换坐标系很有用。由于我不想重新发明轮子,是否有任何库可以处理:
我正在尝试学习boost :: statechart.
我想制作一个加载文件的小应用程序.
// --------------------------------
// | |
// | O Project |
// | | |
// | v |
// | ---------------------------- |
// | | | |
// | | Unloaded | |
// | ---------------------------- |
// | | ^ |
// | | EvLoad | EvUnload |<-----O
// | v | |
// | ---------------------------- |
// | | | |
// | | Loaded | |
// | ---------------------------- |
// | | …Run Code Online (Sandbox Code Playgroud) 我正在将PyVisa从Python 2.6迁移到Python 3.2.我可以安装模块.它列在C:\Python32\Lib\site-packages\pyvisa
该__init__.py文件vpp43.py从该文件夹导入module().在这一行,我得到以下错误:
Run Code Online (Sandbox Code Playgroud)Traceback (most recent call last): File "D:\Documents and Settings\grknbl16\My Documents\PatternControl.py", line 2, in <module> from taborAwg import configTabor File "D:\Documents and Settings\grknbl16\My Documents\taborAwg.py", line 1, in <module> from visa import Instrument, vpp43 File "C:\Python32\lib\site-packages\visa.py", line 1, in <module> from pyvisa.visa import * File "C:\Python32\lib\site-packages\pyvisa\__init__.py", line 34, in <module> import configparser, os, sys, vpp43 ImportError: No module named vpp43
哪里出错了?
我想在QtCreator中使用boost.我正在使用Windows 7并使用mingw安装了QtSDK.当我执行时,bootstrap.bat我得到以下错误
C:\boost\boost_1_49_0>bootstrap
Building Boost.Build engine
'cl' is not recognized as an internal or external command,
operable program or batch file.
Failed to build Boost.Build engine.
Please consult bootstrap.log for furter diagnostics.
You can try to obtain a prebuilt binary from
http://sf.net/project/showfiles.php?group_id=7586&package_id=72941
Also, you can file an issue at http://svn.boost.org
Please attach bootstrap.log in that case.
Run Code Online (Sandbox Code Playgroud)
bootstrap.log包含以下内容
###
### Using 'msvc' toolset.
###
C:\boost\boost_1_49_0\tools\build\v2\engine>if exist bootstrap rd /S /Q bootstrap
C:\boost\boost_1_49_0\tools\build\v2\engine>md bootstrap
C:\boost\boost_1_49_0\tools\build\v2\engine>cl /nologo /GZ /Zi /MLd /Fobootstrap/ …Run Code Online (Sandbox Code Playgroud) 如何捕获所有路径,只处理目录和处理文件的路径?
下面是一个简单的例子
from flask import Flask
app = Flask(__name__)
@app.route('/foo')
def foo_file():
return 'Queried: foo file'
@app.route('/foo/')
def foo_dir():
return 'Queried: foo dir'
@app.route('/<path:path>')
def file(path):
return 'Queried file: {0}'.format(path)
@app.route('/')
@app.route('/<path:path>/')
def folder(path):
return 'Queried folder: {0}'.format(path)
if __name__ == '__main__':
app.run()
Run Code Online (Sandbox Code Playgroud)
当我访问http:\\127.0.0.1:5000\foo它的电话foo_file()和http:\\127.0.0.1:5000\foo\它的电话foo_dir().但查询http:\\127.0.0.1:5000\bar和http:\\127.0.0.1:5000\bar\两个电话
file().我怎么能改变呢?
我知道我可以检查尾随斜线并手动重新路由,我只是想知道是否还有另一种方法.
我想使用boost :: transform_iterator和boost :: bind来返回成员函数的结果.
例如
class Foo
{
public:
//...
Bar& getBar();
const Bar& getBar() const;
};
Run Code Online (Sandbox Code Playgroud)
我有一个一元的Function对象来选择getBar()函数
struct getBar: public std::unary_function<Foo&,Bar&>
{
getBar::result_type operator()(getBar::argument_type arg ) const {
return arg.getBar()
}
};
Run Code Online (Sandbox Code Playgroud)
并且假设我已经在std :: vector中存储了几个Foo对象,我使用了类似的tranform_iterator
int main()
{
typedef std::vector<Foo> VEC;
typedef boost::transform_iterator<getBar,VEC::iterator> iterator;
VEC vec;
vec.push_back( Foo ());
iterator i( vec.begin() );
//...
Bar = *i;
return 0;
};
Run Code Online (Sandbox Code Playgroud)
但是,如果我想使用boost :: bind而不是getBar仿函数,我该怎么做呢.我不确定我必须将哪个模板参数传递给transform_iterator.
编辑:
使用boost :: function的解决方案是一个很好的开始,但我并不完全满意,所以尝试了一下并查看了boost :: mem_fn的返回类型
typedef boost::transform_iterator<boost::_mfi::mf0<Bar&,Foo>,VEC::iterator> iter;
typedef boost::transform_iterator<boost::_mfi::cmf0<const Bar&,Foo>,VEC::const_iterator> citer;
Run Code Online (Sandbox Code Playgroud)
但这个解决方案有另一个问题.因为
iter …Run Code Online (Sandbox Code Playgroud) 我正在使用pyvisa来控制信号恢复sr7225锁定放大器.几乎一切都按预期工作.只有一个问题,当查询的值正好为零并且在浮点模式下进行一次查询时,将返回以下内容
>>>import visa
>>>lockin = visa.instrument('GPIB::08')
>>>lockin.ask('X.') # Query X value in floating point mode
0.0E+00\x00
Run Code Online (Sandbox Code Playgroud)
ascii值附加到响应字符串.我想附加的ascii值\x00是一个bug,但它意味着我不能用于float()将字符串响应转换为float.你会怎么处理这个?