W
W
Wade2k2017-08-28 14:36:40
Python
Wade2k, 2017-08-28 14:36:40

How to understand machine learning in python?

Greetings.
I want to try machine learning - where do I start?
Preferably in python and preferably for text analysis)
Maybe there are some books on this topic or where is it better to look right away?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-08-28
@LazyTalent

In short:
1. db corpus of texts with labels (for example, positive tweet, negative tweet)
2. Remove punctuation marks
3. Remove stop words (prepositions, etc. that have no semantic load)
4. Do stemming
5. From each tweet you make a set of n-grams
6. From n-grams you make a TF-IDF dictionary
7. You split the resulting dictionary into data for training and data for tests
8. You put all this into your favorite algorithm for ML, for example, like this:

clf = RandomForestClassifier(n_jobs=-1)
clf.fit(X_train, y_train)

9. Save the resulting model as a pickle and then use it for texts that need to be classified.
predict = clf.predict(tfidf_predict.toarray())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question