error using loss_curve_ attribute of MLPClassifier in python - python-3.x

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.

Related

getting error 'tensorflow.python.ops.rnn_cell_impl' has no attribute '_linear'

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?

Not able to find out the version of a module

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

type object 'DataFrame' has no attribute 'sparse'

import pandas as pd
import scipy.sparse
_vectorized = count_vectorizer.transform(data['text'])
_dataframe = pd.DataFrame.sparse.from_spmatrix(_vectorized)
Why is the error occuring. I'm working on Jupyter based environment kaggle and azure notebook. Error shows up both of the place. But On spyder it's working perfectly. What am I missing?
Try this:
_dataframe = pd.SparseDataFrame(_vectorized)

How to fix ''PosixPath' object has no attribute 'encode'" error using librosa.load?

I'm starting learning basic feature extraction with librosa and was trying reading and storing ten kick drums with pathlib, but it doesn't work since I always getting an encoding error, where as there is no error without pathlib.
I tried changing the path, updating every imported library very often, using wav instead of mp3 but had no further idea.
My code:
%matplotlib inline
from pathlib import Path
import numpy, scipy, matplotlib.pyplot as plt, sklearn, urllib, IPython.display as ipd
import librosa, librosa.display
kick_signals = [
librosa.load(p)[0] for p in Path().glob('audio/drum_samples/train/kick_*.mp3')
]
Error messages:
RuntimeError: Error opening 'audio/techno-nine_o_three.mp3': File contains data in an unknown format.
and
AttributeError: 'PosixPath' object has no attribute 'encode'
I would be very thankful, if you would and could help me.
You can convert the PossixPath object to a string, using p.as_posix()
Example:
p = Path(file_path)
p.as_posix()
Try:
kick_signals = [
librosa.load(p.absolute())[0] for p in Path().glob('audio/drum_samples/train/kick_*.mp3')
]
That way you pass a string instead of a PosixPath to librosa.
If that does not fix it, check your mp3 file. Does it play in a regular player? If not, please post the whole error message (stacktrace). Perhaps librosa's dependencies aren't installed properly.

AttributeError in sklearn_crfsuite has no attribute CRF arror

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.

Resources