This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Libraries: | |
https://www.tensorflow.org/ | |
Articles: | |
https://www.kaggle.com/c/titanic/details/getting-started-with-python | |
https://www.kaggle.com/c/titanic/details/getting-started-with-python-ii |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Using the words as features removing stopwords | |
""" | |
from sklearn.utils import check_random_state | |
from sklearn.datasets import load_files | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.feature_extraction.text import HashingVectorizer | |
from sklearn.naive_bayes import MultinomialNB | |
from sklearn.feature_extraction.text import CountVectorizer | |
from sklearn.metrics import accuracy_score, average_precision_score, f1_score, precision_score, recall_score |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
""" | |
NltkSentTokenize Class for all nltk sent tokenize | |
""" | |
class NltkSentTokenize(object): | |
""" | |
Initialization function of NltkSentTokenize Class | |
""" | |
def __init__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Read basics about Python - http://www.tutorialspoint.com/python/python_overview.htm | |
Tutorials | |
http://www.tutorialspoint.com/python/index.htm | |
http://askpython.com/ | |
More resources | |
https://wiki.python.org/moin/BeginnersGuide/Programmers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install build-essential | |
wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz | |
tar -xf Python-2.7.6.tar.xz | |
cd Python-2.7.6 | |
./configure | |
make | |
make install | |
sudo apt-get install build-essential python-dev python-setuptools python-numpy python-scipy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nltk | |
from nltk.corpus import stopwords | |
text = raw_input("Enter the text please ...") | |
print text | |
sentence_re = r'(?:(?:[A-Z])(?:.[A-Z])+.?)|(?:\w+(?:-\w+)*)|(?:\$?\d+(?:.\d+)?%?)|(?:...|)(?:[][.,;"\'?():-_`])' | |
lemmatizer = nltk.WordNetLemmatizer() | |
stemmer = nltk.stem.porter.PorterStemmer() | |
grammar = r""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Function to read xlsx files | |
def readExcel(self): | |
from xlrd import open_workbook | |
wb = open_workbook('Shortlisted Rumours Jan to June 2016.xlsx') | |
for s in wb.sheets(): | |
for row in range(1, s.nrows): | |
# pdb.set_trace() | |
col_names = s.row(0) | |
col_value = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nltk | |
from nltk.corpus import stopwords | |
class PhraseExtractor(object): | |
def __init__(self): | |
self.sentence_re = r'(?:(?:[A-Z])(?:.[A-Z])+.?)|(?:\w+(?:-\w+)*)|(?:\$?\d+(?:.\d+)?%?)|(?:...|)(?:[][.,;"\'?():-_`])' | |
self.lemmatizer = nltk.WordNetLemmatizer() | |
self.stemmer = nltk.stem.porter.PorterStemmer() | |
self.grammar = r""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is difference between SVM and Neural Network? Is it true that linear svm is same NN, and for non-linear separable problems, NN uses adding hidden layers and SVM uses changing space dimensions? | |
There are two parts to this question. The first part is "what is the form of function learned by these methods?" For NN and SVM this is typically the same. For example, a single hidden layer neural network uses exactly the same form of model as an SVM. That is: | |
Given an input vector x, the output is: output(x) = sum_over_all_i weight_i * nonlinear_function_i(x) | |
Generally the nonlinear functions will also have some parameters. So these methods need to learn how many nonlinear functions should be used, what their parameters are, and what the value of all the weight_i weights should be. | |
Therefore, the difference between a SVM and a NN is in how they decide what these parameters should be set to. Usually when someone says they are using a neural network they mean they are trying to find the parameters which minimiz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is Chatbot? | |
Types of Chatbot - Open domain vs Closed domain, Rules based vs General AI | |
Different approaches to build chatbots | |
Existing frameworks | |
Machine learning and NLP Based | |
AIML (Artificial Intelligence Markup Language) | |
How does each approach works. | |
IBM Watson, The most intelligent chatbot - Introduction | |
Modules to build open domain chatbot using NLP and Machine learning | |
Question Analysis |