我在python中使用H2o包运行xgboost。我设置为使用机器的所有32个内核。分类器位于for循环中,可为不同的参数运行分类。我正在启动h2o并在循环中将其关闭。它在循环中运行2-3回合,并返回一些运行错误“无法执行加速器操作:节点/127.0.0.1:54321上的updater处于非活动状态”。
任何人都知道为什么我会收到这样的错误?
谢谢,
尔纳兹
`for dates in start_end_dates:
for window_size in window_sizes:
print dates[0], dates[1], dates[2], window_size
model_string = str(dates[0])+ '_'+ str(dates[1]) + ':'+ str(dates[2])+ ':'+ str(window_size)
## load daily transaction types
## this function runs in parallel on all cpus
daily_transactions_type_df = transform_transactions_types.transform(dates[0], dates[1], window_size)
##load daily transactions
## this function runs in parallel on all cpus
daily_transactions_df = transfrom_daily_transactions.transform(dates[0], dates[1], window_size, max_number_of_instrument)
snapshot_date = dates[1]
## user status list
user_status_list = Classification_helpers.load_user_status_data_from_gbq(snapshot_date)
user_status_list
## Normalize the data
numeric_columns = daily_transactions_type_df.iloc[:,1:].columns.tolist()
other_columns = []
daily_transactions_type_df_norm = Classification_helpers.normalize_data_without_outliers(daily_transactions_type_df, numeric_columns, other_columns)
## Normalize the data
numeric_columns = daily_transactions_df.iloc[:,1:-6].columns.tolist()
other_columns = daily_transactions_df.iloc[:,-5:].columns.tolist()
daily_transactions_df_norm = Classification_helpers.normalize_data_without_outliers(daily_transactions_df,numeric_columns,other_columns)
data_frames = [daily_transactions_type_df_norm, daily_transactions_df_norm, user_status_list[['USER_ID', 'label']]]
df = Classification_helpers.create_labelled_data(data_frames)
numeric_columns = df.iloc[:,1:-6].columns.tolist()
other_columns = df.iloc[:,-6:-1].columns.tolist()
nthreads = -1
Classification_helpers.init_h2o(nthreads)
model, performance, predictions = Classification_helpers.train_XGboost(df, numeric_columns, other_columns, model_string)
print performance.auc()`
参考方案
使用Flow接口:http://127.0.0.1:54321观看操作,并注意内存的使用。
看到
http://docs.h2o.ai/h2o/latest-stable/h2o-docs/flow.html#viewing-cluster-status表示您应该观看的屏幕。您将看到实时更新的每个节点上的可用内存量。
如果没有更多信息,可能会猜测您的内存不足,因为您在for循环的每次迭代中都使用了更多的内存。
如果是这样,那么很难在不了解您在for循环中正在做什么的情况下给出建议。但是,如果训练数据相同,请确保将其加载到for循环之外。在最坏的情况下,您应该在for循环中进行H2O初始化和关闭(并在每次迭代结束时保存模型,以备后用)。
哦,还有一种可能(您没有提到):在h2o.init()调用中明确指定要提供H2O的内存量。您可能会发现,除了提供默认值以外,您还可以提供更多功能。 (但不要给H2O机器的所有内存,否则一切都会变得不稳定!)
Python sqlite3数据库已锁定 - python我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…
Python:集群作业管理 - python我在具有两个阶段的计算群集(Slurm)上运行python脚本,它们是顺序的。我编写了两个python脚本,一个用于阶段1,另一个用于阶段2。每天早上,我检查所有第1阶段的工作是否都以视觉方式完成。只有这样,我才开始第二阶段。通过在单个python脚本中组合所有阶段和作业管理,是否有一种更优雅/自动化的方法?我如何知道工作是否完成?工作流程类似于以下内容:w…
Python:传递记录器是个好主意吗? - python我的Web服务器的API日志如下:started started succeeded failed 那是同时收到的两个请求。很难说哪一个成功或失败。为了彼此分离请求,我为每个请求创建了一个随机数,并将其用作记录器的名称logger = logging.getLogger(random_number) 日志变成[111] started [222] start…
Python-Excel导出 - python我有以下代码:import pandas as pd import requests from bs4 import BeautifulSoup res = requests.get("https://www.bankier.pl/gielda/notowania/akcje") soup = BeautifulSoup(res.cont…
Python pytz时区函数返回的时区为9分钟 - python由于某些原因,我无法从以下代码中找出原因:>>> from pytz import timezone >>> timezone('America/Chicago') 我得到:<DstTzInfo 'America/Chicago' LMT-1 day, 18:09:00 STD…