我使用了我自己创建的激活函数(通常不是),并用于我的 LSTM。一切顺利,我训练了我的模型并将其保存为.h5
文件。
这是我自定义的激活函数:
from keras import backend as k
def activate(ab):
a = k.exp(ab[:, 0])
b = k.softplus(ab[:, 1])
a = k.reshape(a, (k.shape(a)[0], 1))
b = k.reshape(b, (k.shape(b)[0], 1))
return k.concatenate((a, b), axis=1)
def weibull_loglik_discrete(y_true, ab_pred, name=None):
y_ = y_true[:, 0]
u_ = y_true[:, 1]
a_ = ab_pred[:, 0]
b_ = ab_pred[:, 1]
hazard0 = k.pow((y_ + 1e-35) / a_, b_)
hazard1 = k.pow((y_ + 1) / a_, b_)
return -1 * k.mean(u_ * k.log(k.exp(hazard1 - hazard0) - …
Run Code Online (Sandbox Code Playgroud) 我正在运行LSTM来为每位患者分类医疗记录.这就是说,对于每个病人(观察),我有一个CSV文件.整个数据集是多个CSV文件,每个文件都是时间序列的DataFrame.停止看这是显而易见的,因为LSTM与图像和时间序列之间存在一个小差异,它是序列的SIZE.图像大小相同但患者录音不是!
题:
如何使用我的培训数据为LSTM网络提供信息?
我相信如果你熟悉图像分类,你可以帮助解决我的问题,但这不仅仅是相同的方法.
例
对于一名患者,我有一个DataFrame,其中包含我想在LSTM中使用的所有记录.
df.shape
Out[29]: (5679000, 4)
# The 5679000 change from one patient to another but 4 columns are fixed
Run Code Online (Sandbox Code Playgroud)
看看这里:
df.head(4)
Out[30]:
AIRFLOW SaO2 ECG Target
0 -34.0 31145.0 304.0 0.0
1 -75.0 31145.0 272.0 0.0
2 -63.0 31145.0 254.0 0.0
3 -57.0 31145.0 251.0 1.0
4 -60.0 31145.0 229.0 0.0
Run Code Online (Sandbox Code Playgroud)
问题:
有什么建议可以喂我的网络吗?
请你帮我在闪亮的仪表板的左上角除了项目名称之外添加公司徽标。
我试图在 stackoverflow 上的其他答案中使用代码,但仍然无法解决我的问题。我对 HTML 和 css 一无所知。
这是我的代码:
library(shiny)
library(shinydashboard)
shinyApp(
ui = dashboardPage(skin = "green",
dashboardHeader(title = "Project name",
# this could show the logo but not where I wanted !
tags$li(a(href = 'http://www.company.com',
img(src = 'logo.jpg',
title = "Company Home", height = 30px"),
style = "padding-top:10px; padding-bottom:10px;"),
class = "dropdown"))),
dashboardSidebar(),
dashboardBody()
),
server = function(input, output) {}
)
Run Code Online (Sandbox Code Playgroud)
显示我想如何添加徽标的图片
谢谢
我尝试使用 Windows 操作系统在本地计算机上运行 xgboost。但出现以下错误:
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :
ERROR MESSAGE:
java.lang.AssertionError: Unregistered algorithm xgboost
Run Code Online (Sandbox Code Playgroud)
这是我的代码示例:
library(h2o)
h2o.init(enable_assertions = TRUE)
localH2O=h2o.init(nthreads = 8)
train.h2o <- h2o.importFile("train.csv")
test.h2o <- h2o.importFile("test.csv")
# Number of CV folds (to generate level-one data for stacking)
nfolds <- 5
y <- get_index(train.h2o,"loss")
x <- setdiff(1:length(train.h2o), y)
x=h2o.colnames(train.h2o[,x])
y=h2o.colnames(train.h2o[,y])
my_xgb1 <- h2o.xgboost(x = x,
y = y,
training_frame = train.h2o,
ntrees = 50,
max_depth = 3,
min_rows = 2,
learn_rate = 0.2,
nfolds …
Run Code Online (Sandbox Code Playgroud)