ogrisel / parallel_ml_tutorial Goto Github PK
View Code? Open in Web Editor NEWTutorial on scikit-learn and IPython for parallel machine learning
Tutorial on scikit-learn and IPython for parallel machine learning
Thanks for making this available!!
Going through "01 - An Introduction to Predictive Modeling in Python L..."
Below, "Let us not forget to imput the median age for passengers without age information:", I found a typo.
rich_features_final = features.fillna(features.dropna().median())
should be
rich_features_final = rich_features.fillna(rich_features.dropna().median())
rich_features_final.head(5)
When running the line
X_train = vectorizer.fit_transform(twenty_train_small.data)
I get a ValueError thrown. Is this a general issue in this notebook or is it just me. I have attached the stack trace as well.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-3cf347c25e00> in <module>()
17 # Turn the text documents into vectors of word frequencies
18 vectorizer = TfidfVectorizer(min_df=2)
---> 19 X_train = vectorizer.fit_transform(twenty_train_small.data)
20 y_train = twenty_train_small.target
21
/Users/adamwalz/.virtualenvs/scikit_learn/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/feature_extraction/text.pyc in fit_transform(self, raw_documents, y)
1236 # X is already a transformed view of raw_documents so
1237 # we set copy to False
-> 1238 return self._tfidf.transform(X, copy=False)
1239
1240 def transform(self, raw_documents, copy=True):
/Users/adamwalz/.virtualenvs/scikit_learn/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/feature_extraction/text.pyc in transform(self, X, copy)
1008
1009 if self.norm:
-> 1010 X = normalize(X, norm=self.norm, copy=False)
1011
1012 return X
/Users/adamwalz/.virtualenvs/scikit_learn/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/preprocessing/data.pyc in normalize(X, norm, axis, copy)
540 inplace_csr_row_normalize_l1(X)
541 elif norm == 'l2':
--> 542 inplace_csr_row_normalize_l2(X)
543 else:
544 if norm == 'l1':
/Users/adamwalz/.virtualenvs/scikit_learn/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/utils/sparsefuncs.so in sklearn.utils.sparsefuncs.inplace_csr_row_normalize_l2 (sklearn/utils/sparsefuncs.c:2714)()
ValueError: Buffer dtype mismatch, expected 'int' but got 'long'
Code:
import IPython.parallel
Warning:
C:\anaconda\lib\site-packages\IPython\parallel.py:13: ShimWarning: The `IPython.parallel` package has been deprecated. You should import from ipyparallel instead.
"You should import from ipyparallel instead.", ShimWarning)
Code:
# Import the example plot from the figures directory
from figures import plot_sgd_separator
plot_sgd_separator()
Gives the warning:
C:\anaconda\lib\site-packages\sklearn\utils\validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)
The error is repeated many times. The figure does load properly despite these warnings.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.