I am getting this error when trying our rasa_nlu with spacy
AttributeError: 'sklearn_crfsuite' object has no attribute 'CRF'
rasa_nlu was importing this way
import sklearn_crfsuite
So I tried importing like below before calling rasa_nlu
from sklearn_crfsuite import CRF
But getting a different
error - cannot import name 'CRF'
Looking for some suggestions.
If you want to do sklearn_crfsuite.CRF, then do import sklearn_crfsuite to import it. If you're importing with from sklearn_crfsuite import CRF, then just use CRF by itself.
Related
I tried the below line of code, but it is giving me the below error
y = rnn_cell_impl._linear(slot_inputs, attn_size, True)
AttributeError: module 'tensorflow.python.ops.rnn_cell_impl' has no attribute '_linear'
I am currently using Tensorflow version 2.10, I tried with all possible solutions by using
#from tensorflow.contrib.rnn.python.ops import core_rnn_cell
or
#from tensorflow.keras.layers import RNN
still no solution.
Can someone help me with the same?
I have imported norm as:
from scipy.stats import norm
I want to find out the version using:
print(scipy.__version__)
but it is raising an error called:
NameError: name 'scipy' is not defined
if i am using this:
print(norm.__version__)
but it is raising another error called:
AttributeError: 'norm_gen' object has no attribute '__version__'
Please help me to solve this issue.
Thanks
The line from scipy.stats import norm doesn't make the name scipy available in your current namespace. To use scipy.__version__, you must first import scipy.
In [57]: import scipy
In [58]: print(scipy.__version__)
1.4.1
I import a text file from the desktop to do with gensim model on jupyter notebook. However, it return that:
"AttributeError Traceback (most recent call last)
in
----> 1 model = word2vec.load(r'C:\Users\qlm\Desktop\globalwarming.txt')
AttributeError: module 'gensim.models.word2vec' has no attribute
'load'"
How can I fix this problem
import numpy as np
import pandas as pd
import gensim
from matplotlib import pyplot as plt
from gensim.models import word2vec
from collections import defaultdict
from sklearn.cluster import KMeans
model = word2vec.Text8Corpus(r'C:\Users\qlm\Desktop\globalwarming.txt')
model = word2vec.load(r'C:\Users\qlm\Desktop\globalwarming.txt')
There is a module named word2vec and inside it a class named Word2Vec, since the Word2Vec class is imported in __init__.py of gensim.models you can import it as you tried before:
from gensim.models import Word2Vec
Then you'll have access to the load method.
You can also use the full namespace too.
So:
# Will work as long as models.__init__ keep it available
from gensim.models import Word2Vec
But:
# Will always work as long as the namespace is not altered
from gensim.models.word2vec import Word2Vec
I personally prefer the second choice.
I am using MLPClassifier in python and I am trying to use the loss_curve_ attribute but I have this error "'MLPClassifier' object has no attribute 'loss_curve_' ". Any ideas of what import I need? I have already tried the "from sklearn import metrics" but it didnt work.
Following code gives me an import error.
from keras.layers.embeddings import DropoutEmbedding
What did DropoutEmbedding change its name to? Or what substitute should I use?
There is no "DropoutEmbedding" layer in Keras. I think you are looking for "Dropout" and "Embedding" layers. Import them like this:
from keras.layers import Dropout,Embedding