我想增加整个boxplot的大胆度,以便在硬拷贝上更加醒目.从这里看来"胖"参数改变了唯一中线的厚度.是否还有其他参数可以控制整个箱形图的厚度/宽度?
require(reshape)
require(ggplot2)
cars_melt = melt(cars)
ggplot(aes(x = variable, y = value), data = cars_melt) +
geom_boxplot(fatten = 2)
Run Code Online (Sandbox Code Playgroud) Traceback (most recent call last):\n File "C:\\Users\\gutolinPC\\Desktop\\tensorflow.py", line 3, in <module>\n from keras.datasets import mnist\n File "C:\\Program Files\\Python37\\lib\\site-packages\\keras\\__init__.py", line 3,in <module>\n from . import utils\n File "C:\\Program Files\\Python37\\lib\\site-packages\\keras\\utils\\__init__.py", \n line 6, in <module>\n from . import conv_utils\n File "C:\\Program Files\\Python37\\lib\\site-packages\\keras\\utils\\conv_utils.py", \n line 9, in <module>\n from .. import backend as K\n File "C:\\Program Files\\Python37\\lib\\site-packages\\keras\\backend\\__init__.py", \n line 89, in <module>\n from .tensorflow_backend import *\n File "C:\\Program Files\\Python37\\lib\\site- \n packages\\keras\\backend\\tensorflow_backend.py", line 5, in <module>\n import tensorflow as tf\n File "C:\\Users\\gutolinPC\\Desktop\\tensorflow.py", line 3, …Run Code Online (Sandbox Code Playgroud) 我已经为我的数据拟合了逻辑回归模型。想象一下,我有四个特征:1)参与者收到的条件,2)参与者是否对所测试的现象有任何先验知识/背景(实验后问卷中的二元反应),3)在实验任务上花费的时间,以及4) 参与者年龄。我试图预测参与者最终是选择选项 A 还是选项 B。我的逻辑回归输出以下特征系数 clf.coef_:
[[-0.68120795 -0.19073737 -2.50511774 0.14956844]]
Run Code Online (Sandbox Code Playgroud)
如果选项 A 是我的正类,这个输出是否意味着特征 3 是二元分类中最重要的特征,并且与选择选项 A 的参与者有负相关(注意:我没有标准化/重新缩放我的数据)?我想确保我对系数的理解以及我可以从中提取的信息是正确的,因此我不会在我的分析中做出任何概括或错误假设。
谢谢你的帮助!
python feature-selection scikit-learn logistic-regression coefficients
我想编写一个脚本来从我的mongoDB数据库生成一个CSV文件,我想知道最方便的版本!
首先让我从集合的结构开始.
MyDataBase -> setting
users
fruits
Run Code Online (Sandbox Code Playgroud)
在设置我有类似的东西
setting -> _id
data
_tenant
Run Code Online (Sandbox Code Playgroud)
我所追求的是,用数据 中的个人资料制作一个CSV文件,他们有一些字段/属性,如"姓名","地址","邮政编码","电子邮件",年龄等,而不是必要的全部这些配置文件具有所有文件/属性,甚至其中一些看起来像集合(有子分支),我根本不感兴趣!
所以,我的代码是python到目前为止看起来像这些
myquery = db.settings.find() # I am getting everything !
output = csv.writer(open('some.csv', 'wt')) # writng in this file
for items in myquery[0:10]: # first 11 entries
a = list(items['data']['Profile'].values()) # collections are importent as dictionary and I am making them as list
tt = list()
for chiz in a:
if chiz is not None:
tt.append(chiz.encode('ascii', 'ignore')) #encoding
else:
tt.append("none")
output.writerow(tt)
Run Code Online (Sandbox Code Playgroud)
这些字段/属性没有必要的所有字段,甚至其中一些是集合(带子分支),并将作为字典导入!所以,我必须将它们转换为列表,所有这一切,在这样的过程中很少有事情需要注意,并且看起来并不是那么简单!
我的问题可能听起来很普遍,但这是一种典型的报道方式吗?如果没有,你能有人说清楚吗?!
我想用kernlab中的ipop函数求解下面的二次规划方程:
min 0.5*x'*H*x + f'*x
subject to: A*x <= b
Aeq*x = beq
LB <= x <= UB
Run Code Online (Sandbox Code Playgroud)
在我们的例子中,H 3x3矩阵,f是3x1,A是2x3,b是2x1,LB和UB都是3x1.
编辑1 我的R代码是:
library(kernlab)
H <- rbind(c(1,0,0),c(0,1,0),c(0,0,1))
f = rbind(0,0,0)
A = rbind(c(1,1,1), c(-1,-1,-1))
b = rbind(4.26, -1.73)
LB = rbind(0,0,0)
UB = rbind(100,100,100)
> ipop(f,H,A,b,LB,UB,0)
Error in crossprod(r, q) : non-conformable arguments
Run Code Online (Sandbox Code Playgroud)
我从matlab知道这是这样的:
H = eye(3);
f = [0,0,0];
nsamples=3;
eps = (sqrt(nsamples)-1)/sqrt(nsamples);
A=ones(1,nsamples);
A(2,:)=-ones(1,nsamples);
b=[nsamples*(eps+1); nsamples*(eps-1)];
Aeq = [];
beq = [];
LB = zeros(nsamples,1);
UB = ones(nsamples,1).*1000;
[beta,FVAL,EXITFLAG] …Run Code Online (Sandbox Code Playgroud) 在 LSTM 上用于对 IMDB 序列数据建模的 keras 示例中(https://github.com/fchollet/keras/blob/master/examples/imdb_lstm.py),在输入到 LSTM 层之前有一个嵌入层:
model.add(Embedding(max_features,128)) #max_features=20000
model.add(LSTM(128))
Run Code Online (Sandbox Code Playgroud)
嵌入层的真正作用是什么?在这种情况下,这是否意味着进入 LSTM 层的输入序列的长度是 128?如果是这样,我可以将 LSTM 层写为:
model.add(LSTM(128,input_shape=(128,1))
Run Code Online (Sandbox Code Playgroud)
但也注意到输入X_train已经过pad_sequences处理:
print('Pad sequences (samples x time)')
X_train = sequence.pad_sequences(X_train, maxlen=maxlen) #maxlen=80
X_test = sequence.pad_sequences(X_test, maxlen=maxlen) #maxlen=80
Run Code Online (Sandbox Code Playgroud)
好像输入序列长度是80?
我正在尝试将数据框从熊猫写入红移。
这是代码
df = pd.DataFrame({'num_legs': [2, 4, 8, 0],
'num_wings': [2, 0, 0, 0],
'num_specimen_seen': [10, 2, 1, 8]},
index=['falcon', 'dog', 'spider', 'fish'])
from sqlalchemy import create_engine
import sqlalchemy
sql_engine = create_engine('postgresql://username:password@host:port/dbname')
conn = sql_engine.raw_connection()
df.to_sql('tmp_table', conn, index = False, if_exists = 'replace')
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下错误
---------------------------------------------------------------------------
UndefinedTable Traceback (most recent call last)
~/opt/anaconda3/envs/UserExperience/lib/python3.7/site-packages/pandas/io/sql.py in execute(self, *args, **kwargs)
1594 else:
-> 1595 cur.execute(*args)
1596 return cur
UndefinedTable: relation "sqlite_master" does not exist
...
...
...
1593 cur.execute(*args, **kwargs)
1594 else:
-> 1595 …Run Code Online (Sandbox Code Playgroud) 我的仓库目录看起来像
src/
notebooks/
web/
one/
two/
app/
Run Code Online (Sandbox Code Playgroud)
当我在下面时,two我可以fastapi使用我的应用程序午餐
uvicorn app.app:app --reload --host=0.0.0.0 --port=7000
Run Code Online (Sandbox Code Playgroud)
但是,我将在 heorku 上部署我的模型,Procfile 应该位于主路径。我知道我必须创建一个 Procfile 并添加
web: uvicorn app.app:app --reload --host=0.0.0.0 --port=7000
Run Code Online (Sandbox Code Playgroud)
但我无法从其他文件夹运行该应用程序。它会给出错误
ModuleNotFoundError: No module named 'app'
Run Code Online (Sandbox Code Playgroud)
更新
所以当我跑步时 uvicorn web.two.app.app:app --reload --port=7000
我有一个很大的文本文件,我想只提取某些短语/单词后面的数字。
这个巨大的文本文件中有几十行,格式如下:
汽车的最佳 CV 模型:15778 的顺序:2 阈值:0,AUC 为:0.7185 基因 aau_roc:0.466281
一种解决方案是只查看“for car: X”、“is order: X”、“threshold: X”、“Ygene aau_roc: X”之后的数字!
最后我希望每行有 15778, 2, 0, 0.7185, 0.466281。
python ×3
keras ×2
r ×2
boxplot ×1
coefficients ×1
embedding ×1
fastapi ×1
ggplot2 ×1
heroku ×1
histogram ×1
lstm ×1
matlab ×1
mongodb ×1
pandas ×1
pymongo ×1
python-3.x ×1
regex ×1
scikit-learn ×1
tensorflow ×1