正如自我指南所说,我已经安装了它(conda 环境)
conda install -c conda-forge spacy
python -m spacy download en_core_web_trf
Run Code Online (Sandbox Code Playgroud)
我spacy-transformers已经安装了。但是当我简单地这样做时:
import spacy
spacy.load("en_core_web_trf")
Run Code Online (Sandbox Code Playgroud)
它向我显示了这个错误:
ValueError: [E002] Can't find factory for 'transformer' for language English (en). This usually happens when spaCy calls `nlp.create_pipe` with a custom component name that's not registered on the current language class. If you're using a Transformer, make sure to install 'spacy-transformers'. If you're using a custom component, make sure you've added the decorator `@Language.component` (for function components) or `@Language.factory` (for class …Run Code Online (Sandbox Code Playgroud) 我正在尝试安装sentence-transformers库。但是当我导入它时,会弹出这个错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-c9f0b8c65221> in <module>
----> 1 import h5py
~\Anaconda3\envs\custom_env\lib\site-packages\h5py\__init__.py in <module>
32 raise
33
---> 34 from . import version
35
36 if version.hdf5_version_tuple != version.hdf5_built_version_tuple:
~\Anaconda3\envs\custom_env\lib\site-packages\h5py\version.py in <module>
15
16 from collections import namedtuple
---> 17 from . import h5 as _h5
18 import sys
19 import numpy
h5py\h5.pyx in init h5py.h5()
ImportError: DLL load failed while importing defs: The specified procedure could not be found.
Run Code Online (Sandbox Code Playgroud)
我已经安装了h5py库。我缺少什么?
我来自那里Python,beautiful soup您可以解析整个内容,而无需在外部网页html tree中创建get请求。我正在寻找相同的内容,但我只找到了and (似乎未使用),如果我是正确的,它们只允许您提出请求。我想要一个库,它允许我解析整个内容而不会出现策略错误,也就是说,无需发出请求,只需解析它。javascriptjsdomjssoupjshtml treeCORS
我怎样才能做到这一点?
我不知道为什么我在尝试使用时会收到该错误 decision_function()
model_1 = BaggingClassifier(base_estimator=MLPClassifier())
model_1.fit(Xtrain, ytrain)
model_1.decision_function(Xtrain)
Run Code Online (Sandbox Code Playgroud)
我也遇到了这个错误 DecisionTreeClassifier()
有没有办法一次替换字符串中的多个字符,而不是这样做:
"foo_faa:fee,fii".replace("_", "").replace(":", "").replace(",", "")
Run Code Online (Sandbox Code Playgroud)
只是类似(与str.replace())
"foo_faa:fee,fii".replace(["_", ":", ","], "")
Run Code Online (Sandbox Code Playgroud) 我正在尝试访问df-chips.
然而,乍一看并没有加载,所以我尝试使用asyng / await. 但是......我不擅长javascript,所以我做错了一些事情,而且我不知道是什么。
这是我的代码:
// Function to catch asynchronous that node
const asyncQuerySelector = async (node, query) => {
try {
if (node.querySelector(query)){
return await node.querySelector(query);
}
} catch (error) {
console.error(`Cannot find ${query ? `${query} in`: ''} ${node}.`, error);
return null;
}
};
const root = document.querySelector('#messageList')
const foo = asyncQuerySelector(root, 'df-chips')
Run Code Online (Sandbox Code Playgroud)
但我得到了一个null承诺的结果:
我有这个输出:
[[[-0.015, -0.1533, 1. ]]
[[-0.0069, 0.1421, 1. ]]
...
[[ 0.1318, -0.4406, 1. ]]
[[ 0.2059, -0.3854, 1. ]]]
Run Code Online (Sandbox Code Playgroud)
但我想删除剩余的方括号,如下所示:
[[-0.015 -0.1533 1. ]
[-0.0069 0.1421 1. ]
...
[ 0.1318 -0.4406 1. ]
[ 0.2059 -0.3854 1. ]]
Run Code Online (Sandbox Code Playgroud)
我的代码是这样的:
XY = []
for i in range(4000):
Xy_1 = [round(random.uniform(-0.5, 0.5), 4), round(random.uniform(-0.5, 0.5), 4), 1]
Xy_0 = [round(random.uniform(-0.5, 0.5), 4), round(random.uniform(-0.5, 0.5), 4), 0]
Xy.append(random.choices(population=(Xy_0, Xy_1), weights=(0.15, 0.85)))
Xy = np.asarray(Xy)
Run Code Online (Sandbox Code Playgroud) 我正面临一个实时问题,它有 4 个特征:
Vmean, Vmedian, Vnow, VV。我想要做的是:
for i in range(len(X)):
model.fit(X[i], X[i+1])
model.predict(X[i+1])
Run Code Online (Sandbox Code Playgroud)
也就是说,我试图预测X[i+2]throughX[i+1]和的值X[i],因为一行与下一行相关,依此类推。这是我的模型:
def kerasModel():
input_layer = keras.layers.Input(shape=(4, 1), name='input_shape')
x = keras.layers.LSTM(100, name='lstm_0')(input_layer)
x = keras.layers.Dropout(0.2, name='lstm_dropout')(x)
x = keras.layers.Dense(64, name='x2')(x)
output = keras.layers.Dense(4, activation='linear', name='x3')(x)
model = keras.Model(inputs=input_layer, outputs=output)
adam = keras.optimizers.Nadam(lr=0.005)
model.compile(optimizer=adam, loss='mse')
return model
Run Code Online (Sandbox Code Playgroud)
但它不起作用。它没有像它应该做的那样预测下一个值。我的问题是:是否有任何论文或规则可以根据您的特征制作一个好的深度学习模型?另外,基于这个问题,哪个可能是一个好的模型?
python ×7
javascript ×2
python-3.x ×2
async-await ×1
flatten ×1
h5py ×1
html-parsing ×1
keras ×1
list ×1
node.js ×1
replace ×1
scikit-learn ×1
spacy ×1
spacy-3 ×1
str-replace ×1
string ×1
tensorflow ×1