一个库,它统一了Python生态系统中最常用库的API和时间序列预测的建模技术。

hcrystalball的Python项目详细描述


CICDDocumentation StatusPyPI VersionConda VersionCode CoverageBinderLicenseContributorsCode style: black

H晶体球

HCrystal Ball由两个主要部分组成:

  • Wrappers—它们带来了不同的第三方 与时间序列兼容的sklearn API库
  • Model Selection—启用包装器、通用或定制变压器的网格搜索 并在整个过程中添加方便的图层(访问结果、绘图、存储等)

文件

请参阅文档site上的示例、教程、贡献、API和更多内容site尝试使用binder上的笔记本或直接浏览docs/examples中的示例笔记本。在

堆芯安装

如果你想要最小限度的安装,你可以从pip或conda forge安装

pip install hcrystalball
^{pr2}$

典型安装

通常您需要使用更多的包装器,而不仅仅是Sklearn,在jupyterlab中运行示例,或者并行执行模型选择。让这些依赖项很好地一起运行可能会很麻烦,所以检查envrionment.yml可能会让您更快地开始。在

# get dependencies file, e.g. using curl
curl -O https://raw.githubusercontent.com/heidelbergcement/hcrystalball/master/environment.yml
# check comments in environment.yml, keep or remove as requested, than create environment using
conda env create -f environment.yml
# activate the environment
conda activate hcrystalball
# if you want to see progress bar in jupyterlab, execute also
jupyter labextension install @jupyter-widgets/jupyterlab-manager
# install the library from pip
pip install hcrystalball
# or from conda
conda install -c conda-forge hcrystalball

开发安装:

要准备好一切,包括文档构建或执行测试,请执行以下代码

git clone https://github.com/heidelbergcement/hcrystalball
cd hcrystalball
conda env create -f environment.yml
conda activate hcrystalball
# ensures interactive progress bar will work in example notebooks
jupyter labextension install @jupyter-widgets/jupyterlab-manager
python setup.py develop

示例用法

包装器

fromhcrystalball.utilsimportgenerate_tsdatafromhcrystalball.wrappersimportProphetWrapperX,y=generate_tsdata(n_dates=365*2)X_train,y_train,X_test,y_test=X[:-10],y[:-10],X[-10:],y[-10:]model=ProphetWrapper()y_pred=model.fit(X_train,y_train).predict(X_test)y_predprophet2018-12-226.0669992018-12-236.0500762018-12-246.1056202018-12-256.1419532018-12-266.1502292018-12-276.1636152018-12-286.1474202018-12-296.0486332018-12-306.0317112018-12-316.087255

选型

importpandasaspdimportmatplotlib.pyplotaspltplt.style.use('seaborn')plt.rcParams['figure.figsize']=[12,6]fromhcrystalball.utilsimportget_sales_datafromhcrystalball.model_selectionimportModelSelectordf=get_sales_data(n_dates=200,n_assortments=1,n_states=2,n_stores=2)ms=ModelSelector(horizon=10,frequency="D",country_code_column="HolidayCode",)ms.create_gridsearch(n_splits=2,sklearn_models=True,prophet_models=False,exog_cols=["Open","Promo","SchoolHoliday","Promo2"],)ms.select_model(df=df,target_col_name="Sales",partition_columns=["Assortment","State","Store"],)ms.plot_results(plot_from="2015-06-01",partitions=[{"Assortment":"a","State":"NW","Store":335}])

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java将Scanner对象作为构造函数参数传递给UserInterface类   spring未能启动bean“subtocolWebSocketHandler”;嵌套的例外是java。lang.IllegalArgumentException:没有处理程序   Java EE应用程序中后台服务的多线程Java线程(设置守护进程和优先级)?   java Pull to refresh返回列表的第一个位置   无法将comparator类转换为java。可比的   java将json从servlet传递到dojo   JavaHibernate:将子类实例转换为超类实例   java警告调用servlet类时非法反射访问   java静态变量值   java@Entity和@embeddeble之间有什么区别   java将作业配置导入公共作业配置类(注释配置)   sql公共表表达式(以values语句开头)在java中给出错误   java在ImageJ中使用ImageProcessor   java PostgreSQL executeBatch()会随着时间的推移而变慢   java在安卓中以表格形式排列sqllite表数据?   java中SVG的swing定制呈现   java删除与另一个实体映射的实体   java何时/如何添加ListView适配器,使用back按钮恢复它?(片段)   java为什么IBinder和Binder之间的类型转换不是非法的?   java在方法参数列表中使用ArrayList或List