# Can we apply to GridSearchCV to Logistic regression .?

When I apply GridSearchCV to my model Logistic Regression, it's continuously throwing below error. I understand that it's trying to convert string to float. But that's was my data. So how can I convert my x value to float? Can any please hep me with this issue. Thank you.

Error: could not convert string to float: 'great im readi go home'


Sample data

Airline_sentiment text

0     said <br/>
1     plu youv ad commerci experi tacki <br/>
2     didnt today must mean need take anoth trip<br/>

penalty = ['l1', 'l2']<br/>
C = np.logspace(0, 4, 10)<br/>
hyperparameters = dict(C=C, penalty=penalty)<br/>
gs = **GridSearchCV**(lr,hyperparameters,cv=5)<br/>

• Yes you can apply it, refer the docs please.; ML models can only take in "number or numeral representations" of the same, they generally don't take raw strings as such directly, so go for a tf-idf+log reg baseline! Dec 29 '19 at 18:11
• Do you mean, instead of a string of do I need to apply tfidf x matrix value .?
– venu
Dec 29 '19 at 18:51
• Yep, I would recommend checking out scikit learn examples first.. They are very well written with reusable code blocks to get you started. Your error code is very clear imho Dec 29 '19 at 18:52
• Okay..Thank you.
– venu
Dec 29 '19 at 18:53