我在R中使用预测和lm函数时发现了特性.我对相同数据的数据帧和向量得到了不同的结果.
DataFrame代码:
data(mtcars)
fitCar<-lm(mtcars$mpg~mtcars$wt)
predict(fitCar,
data.frame(x=mean(mtcars$wt)),
interval="confidence")
Run Code Online (Sandbox Code Playgroud)
输出:
fit lwr upr
1 23.282611 21.988668 24.57655
2 21.919770 20.752751 23.08679
3 24.885952 23.383008 26.38890
4 20.102650 19.003004 21.20230
5 18.900144 17.771469 20.02882
6 18.793255 17.659216 19.92729
7 18.205363 17.034274 19.37645
8 20.236262 19.136179 21.33635
9 20.450041 19.347720 21.55236
10 18.900144 17.771469 20.02882
11 18.900144 17.771469 20.02882
12 15.533127 14.064349 17.00190
13 17.350247 16.104455 18.59604
14 17.083024 15.809403 18.35664
15 9.226650 6.658271 11.79503
16 8.296712 5.547468 11.04596
17 8.718926 6.052112 11.38574
18 …Run Code Online (Sandbox Code Playgroud) 我正在使用Keras,我想使用logloss作为培训指标.我怎么能把它传递给我的模特?
我的代码如下:
model = Sequential()
model.add(Dense(output_dim=1000, input_dim=390, init='uniform'))
model.add(Activation("relu"))
model.add(Dropout(0.5))
model.add(Dense(output_dim=500, input_dim=1000, init="lecun_uniform"))
model.add(Activation("relu"))
model.add(Dropout(0.5))
model.add(Dense(output_dim=10, input_dim=300, init="lecun_uniform"))
model.add(Activation("sigmoid"))
model.add(Dropout(0.5))
model.add(Dense(output_dim=200, input_dim=10, init="lecun_uniform"))
model.add(Activation("relu"))
model.add(Dropout(0.5))
model.add(Dense(output_dim=100, input_dim=200, init ="glorot_normal"))
model.add(Activation("relu"))
model.add(Dropout(0.5))
model.add(Dense(output_dim=50, input_dim=100, init ="he_normal"))
model.add(Activation("sigmoid"))
model.add(Dropout(0.5))
model.add(Dense(output_dim=2, input_dim=50, init = "normal"))
model.add(Activation("softmax"))
model.compile(loss='binary_crossentropy',optimizer='rmsprop', metrics=['accuracy'])
model.fit(train.values, y1, nb_epoch=10,
batch_size=50000, verbose=2,validation_split=0.3, class_weight={1:0.96, 0:0.04})
proba = model.predict_proba(train.values)
log_loss(y, proba[:,1])
Run Code Online (Sandbox Code Playgroud)
如何通过log_loss代替准确性?
我刚开始使用apache气流.我试图从气流运行test.sh文件,但它不起作用.
以下是我的代码,文件名是test.py
import os
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2015, 6, 1),
'email': ['airflow@airflow.com'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=5),
# 'queue': 'bash_queue',
# 'pool': 'backfill',
# 'priority_weight': 10,
# 'end_date': datetime(2016, 1, 1),
}
dag = DAG('test', default_args=default_args)
# t1 and t2 are examples of tasks created by instantiating operators
t1 = BashOperator(
task_id='print_date',
bash_command='date',
dag=dag)
create_command = "sh home/ubuntu/test/inst/scripts/test.sh"
if …Run Code Online (Sandbox Code Playgroud) 我在手机和一台笔记本电脑中使用DataTables软件包在R中创建了闪亮的应用程序时收到了这样的错误.但是,它并没有引起其他笔记本电脑的错误,昨天同样的代码工作,前天.我没有更改代码,但它抛出了错误.
为什么某些设备存在问题但并非所有设备都存在问题.我用过其他设备,那些设备都没有抛出错误.
知道如何解决这个问题吗?这个问题的解决方案应该在这里解释http://datatables.net/manual/tech-notes/7
什么问题?
以下是抛出错误如下:
DataTables警告:table id = DataTables_Table_0 - Ajax错误.有关此错误的更多信息,请参阅http://datatables.net/tn/7
我正在尝试使用docker和rabbitMQ来建立我的气流.我正在使用rabbitmq:3管理图像.我可以访问rabbitMQ UI和API.
在气流中,我正在建造气流网络服务器,气流调度器,气流工作者和气流花.Airflow.cfg文件用于配置气流.
我在哪里使用broker_url = amqp://user:password@127.0.0.1:5672/和 celery_result_backend = amqp://user:password@127.0.0.1:5672/
我的docker撰写文件如下
version: '3'
services:
rabbit1:
image: "rabbitmq:3-management"
hostname: "rabbit1"
environment:
RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG"
RABBITMQ_DEFAULT_USER: "user"
RABBITMQ_DEFAULT_PASS: "password"
RABBITMQ_DEFAULT_VHOST: "/"
ports:
- "5672:5672"
- "15672:15672"
labels:
NAME: "rabbitmq1"
webserver:
build: "airflow/"
hostname: "webserver"
restart: always
environment:
- EXECUTOR=Celery
ports:
- "8080:8080"
depends_on:
- rabbit1
command: webserver
scheduler:
build: "airflow/"
hostname: "scheduler"
restart: always
environment:
- EXECUTOR=Celery
depends_on:
- webserver
- flower
- worker
command: scheduler
worker:
build: "airflow/"
hostname: "worker"
restart: …Run Code Online (Sandbox Code Playgroud) 我有以下清单
x = rep("a", 100)
Run Code Online (Sandbox Code Playgroud)
如果我使用下表
ifelse(x == "a", sample(c(1:100), 1), 0)
Run Code Online (Sandbox Code Playgroud)
当我第一次运行时,我得到以下输出。
[1] 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
[22] 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
[43] 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
[64] …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Dockerfile使用Docker.
我的Dockerfile如下,我在哪里使用debian linux系统.
FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive
ARG AIRFLOW_VERSION=1.7.1.3
ENV AIRFLOW_HOME /usr/local/airflow
..
..
COPY script/entrypoint.sh /entrypoint.sh
COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
..
..
USER airflow
WORKDIR ${AIRFLOW_HOME}
ENTRYPOINT ["/entrypoint.sh"]
Run Code Online (Sandbox Code Playgroud)
因此,当我运行时 docker build -t test .,它构建没有问题.
但是,当我跑docker run -p 8080:8080 test.
它抛出以下错误:
container_linux.go:247: starting container process caused "exec: \"/entrypoint.sh\": permission denied"
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/entrypoint.sh\": permission denied".
Run Code Online (Sandbox Code Playgroud)
我做错了什么?
我有curl请求是工作文件,如下所示:
curl -XGET "https://xxxx.com/xxx" -u "username:password"
我是怎么想用curlR中的包来做的
我有以下代码,
library(curl)
clCall <- new_handle(url = 'https://xxxx.com/xxx')
handle_setopt(clCall, customrequest = "XGET")
现在我不知道如何在这个curl请求中传递用户名和密码
我只是将 Angular 5.2 更新为 Angular 6。然后我跑了 ng generate universal --client-project my_project
现在我不能做ng build --prod,但是我能跑ng serve。我收到以下错误
错误:文件替换中的 src/environments/environment.tsng 更新 @angular/cli 路径不存在。
我在 src/environments/environment.tsng 文件中没有任何内容。
Angular Json 如下:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my_project": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/assets/sass/paper-kit.scss",
"src/assets/css/demo.css",
"src/assets/css/nucleo-icons.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.slim.min.js", …Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码创建 conda 环境
conda create --prefix r_venv_conda r=3.3 r-essentials r-base --y
Run Code Online (Sandbox Code Playgroud)
然后我通过以下方式激活这个环境
conda activate r_venv_conda/
Run Code Online (Sandbox Code Playgroud)
然后我尝试运行 Jupyter Notebook(通过运行jupyter notebook运行 jupyter 希望能连接 R env。但是,我收到以下错误
Traceback (most recent call last):
File "/home/Documents/project/r_venv_conda/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/home/Documents/project/r_venv_conda/lib/python3.6/site-packages/notebook/__init__.py", line 25, in <module>
from .nbextensions import install_nbextension
File "/home/Documents/project/r_venv_conda/lib/python3.6/site-packages/notebook/nbextensions.py", line 26, in <module>
from .config_manager import BaseJSONConfigManager
File "/home/Documents/project/r_venv_conda/lib/python3.6/site-packages/notebook/config_manager.py", line 14, in <module>
from traitlets.config import LoggingConfigurable
File "/home/Documents/project/r_venv_conda/lib/python3.6/site-packages/traitlets/config/__init__.py", line 6, in <module>
from .application import * …Run Code Online (Sandbox Code Playgroud) r ×5
airflow ×2
docker ×2
python ×2
angular ×1
conda ×1
curl ×1
if-statement ×1
keras ×1
lm ×1
prediction ×1
python-2.7 ×1
rabbitmq ×1
rstudio ×1
shiny ×1