Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
683 views
in Technique[技术] by (71.8m points)

python - OSError: [Errno 9] Bad file descriptor using GridSearchCV

I'm having little hard times figure out what's the problem with my code. I'm a newbie in the fabulous world of python, so forgive me for any kind of syntax problem. Thanks to anyone who's gonna spend his time to help me. Here's my code:

X_train=np.random.randn(4000,400)

y_train=np.random.randn(4000)

parameters={
    "solver":("auto", "svd", "cholesky", "lsqr", "sparse_cg", "sag", "saga"),

    "tol":[1e-3,1e-5,1e-8],

    "alpha":[1,1.2,1.4,1.5],

    "random_state":[42]

}

reg= Ridge()

clf = GridSearchCV(reg, parameters,scoring="r2", n_jobs=-1,cv=5)

clf.fit(X_train,y_train) **here's where troubles happen**

print(clf.best_score_)

print(clf.best_params_)

And here is the error:

File"/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 290, in _on_run

r = self.sock.recv(1024)

OSError: [Errno 9] Bad file descriptor
question from:https://stackoverflow.com/questions/65893369/oserror-errno-9-bad-file-descriptor-using-gridsearchcv

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...