<p dir="auto">When I run <code class="notranslate">SparseCoder</code> with n_jobs &gt; 1, there is a chance to raise exception <code class="notranslate">ValueError: assignment destination is read-only</code>. The code is shown as follow:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from sklearn.decomposition import SparseCoder
import numpy as np

data_dims = 4103
init_dict = np.random.rand(500, 64)
data = np.random.rand(data_dims, 64)
c = SparseCoder(init_dict , transform_algorithm='omp', n_jobs=8).fit_transform(data)"><pre class="notranslate"><code class="notranslate">from sklearn.decomposition import SparseCoder
import numpy as np

data_dims = 4103
init_dict = np.random.rand(500, 64)
data = np.random.rand(data_dims, 64)
c = SparseCoder(init_dict , transform_algorithm='omp', n_jobs=8).fit_transform(data)
</code></pre></div>
<p dir="auto">The bigger <code class="notranslate">data_dims</code> is, the higher chance get. When <code class="notranslate">data_dims</code> is small (lower than 2000, I verified), everything works fine. Once <code class="notranslate">data_dims</code> is bigger than 2000, there is a chance to get the exception. When <code class="notranslate">data_dims</code> is bigger than 5000, it is 100% raised.</p>
<p dir="auto">My version infor:</p>
<p dir="auto">OS: OS X 10.11.1<br>
python: Python 2.7.10 |Anaconda 2.2.0<br>
numpy: 1.10.1<br>
sklearn: 0.17</p>
<p dir="auto">The full error information is shown as follow</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
JoblibValueError                          Traceback (most recent call last)
&lt;ipython-input-24-d745e5de1eae&gt; in &lt;module&gt;()
----&gt; 1 learned_dict = dict_learn(init_dict, patches)

&lt;ipython-input-23-50e8dab30ec4&gt; in dict_learn(dictionary, data)
      6         # Sparse coding stage
      7         coder = SparseCoder(dictionary, transform_algorithm='omp', n_jobs=8, transform_n_nonzero_coefs=3)
----&gt; 8         code = coder.fit_transform(data)
      9         #print iteration, ' ', linalg.norm(data - np.dot(code, dictionary)), ' +',
     10         # update stage

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/base.pyc in fit_transform(self, X, y, **fit_params)
    453         if y is None:
    454             # fit method of arity 1 (unsupervised transformation)
--&gt; 455             return self.fit(X, **fit_params).transform(X)
    456         else:
    457             # fit method of arity 2 (supervised transformation)

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.pyc in transform(self, X, y)
    816             X, self.components_, algorithm=self.transform_algorithm,
    817             n_nonzero_coefs=self.transform_n_nonzero_coefs,
--&gt; 818             alpha=self.transform_alpha, n_jobs=self.n_jobs)
    819 
    820         if self.split_sign:

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.pyc in sparse_encode(X, dictionary, gram, cov, algorithm, n_nonzero_coefs, alpha, copy_cov, init, max_iter, n_jobs, check_input, verbose)
    298             max_iter=max_iter,
    299             check_input=False)
--&gt; 300         for this_slice in slices)
    301     for this_slice, this_view in zip(slices, code_views):
    302         code[this_slice] = this_view

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self, iterable)
    810                 # consumption.
    811                 self._iterating = False
--&gt; 812             self.retrieve()
    813             # Make sure that we get a last message telling us we are done
    814             elapsed_time = time.time() - self._start_time

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in retrieve(self)
    760                         # a working pool as they expect.
    761                         self._initialize_pool()
--&gt; 762                 raise exception
    763 
    764     def __call__(self, iterable):

JoblibValueError: JoblibValueError
___________________________________________________________________________
Multiprocessing exception:
...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/runpy.py in _run_module_as_main(mod_name='IPython.kernel.__main__', alter_argv=1)
    157     pkg_name = mod_name.rpartition('.')[0]
    158     main_globals = sys.modules[&quot;__main__&quot;].__dict__
    159     if alter_argv:
    160         sys.argv[0] = fname
    161     return _run_code(code, main_globals, None,
--&gt; 162                      &quot;__main__&quot;, fname, loader, pkg_name)
        fname = '/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py'
        loader = &lt;pkgutil.ImpLoader instance&gt;
        pkg_name = 'IPython.kernel'
    163 
    164 def run_module(mod_name, init_globals=None,
    165                run_name=None, alter_sys=False):
    166     &quot;&quot;&quot;Execute a module's code without importing it

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/runpy.py in _run_code(code=&lt;code object &lt;module&gt; at 0x10596bdb0, file &quot;/Use...ite-packages/IPython/kernel/__main__.py&quot;, line 1&gt;, run_globals={'__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__doc__': None, '__file__': '/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py', '__loader__': &lt;pkgutil.ImpLoader instance&gt;, '__name__': '__main__', '__package__': 'IPython.kernel', 'app': &lt;module 'IPython.kernel.zmq.kernelapp' from '/Us.../site-packages/IPython/kernel/zmq/kernelapp.pyc'&gt;}, init_globals=None, mod_name='__main__', mod_fname='/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py', mod_loader=&lt;pkgutil.ImpLoader instance&gt;, pkg_name='IPython.kernel')
     67         run_globals.update(init_globals)
     68     run_globals.update(__name__ = mod_name,
     69                        __file__ = mod_fname,
     70                        __loader__ = mod_loader,
     71                        __package__ = pkg_name)
---&gt; 72     exec code in run_globals
        code = &lt;code object &lt;module&gt; at 0x10596bdb0, file &quot;/Use...ite-packages/IPython/kernel/__main__.py&quot;, line 1&gt;
        run_globals = {'__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__doc__': None, '__file__': '/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py', '__loader__': &lt;pkgutil.ImpLoader instance&gt;, '__name__': '__main__', '__package__': 'IPython.kernel', 'app': &lt;module 'IPython.kernel.zmq.kernelapp' from '/Us.../site-packages/IPython/kernel/zmq/kernelapp.pyc'&gt;}
     73     return run_globals
     74 
     75 def _run_module_code(code, init_globals=None,
     76                     mod_name=None, mod_fname=None,

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py in &lt;module&gt;()
      1 
      2 
----&gt; 3 
      4 if __name__ == '__main__':
      5     from IPython.kernel.zmq import kernelapp as app
      6     app.launch_new_instance()
      7 
      8 
      9 
     10 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/config/application.py in launch_instance(cls=&lt;class 'IPython.kernel.zmq.kernelapp.IPKernelApp'&gt;, argv=None, **kwargs={})
    569         
    570         If a global instance already exists, this reinitializes and starts it
    571         &quot;&quot;&quot;
    572         app = cls.instance(**kwargs)
    573         app.initialize(argv)
--&gt; 574         app.start()
        app.start = &lt;bound method IPKernelApp.start of &lt;IPython.kernel.zmq.kernelapp.IPKernelApp object&gt;&gt;
    575 
    576 #-----------------------------------------------------------------------------
    577 # utility functions, for convenience
    578 #-----------------------------------------------------------------------------

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelapp.py in start(self=&lt;IPython.kernel.zmq.kernelapp.IPKernelApp object&gt;)
    369     def start(self):
    370         if self.poller is not None:
    371             self.poller.start()
    372         self.kernel.start()
    373         try:
--&gt; 374             ioloop.IOLoop.instance().start()
    375         except KeyboardInterrupt:
    376             pass
    377 
    378 launch_new_instance = IPKernelApp.launch_instance

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py in start(self=&lt;zmq.eventloop.ioloop.ZMQIOLoop object&gt;)
    146             PollIOLoop.configure(ZMQIOLoop)
    147         return PollIOLoop.instance()
    148     
    149     def start(self):
    150         try:
--&gt; 151             super(ZMQIOLoop, self).start()
        self.start = &lt;bound method ZMQIOLoop.start of &lt;zmq.eventloop.ioloop.ZMQIOLoop object&gt;&gt;
    152         except ZMQError as e:
    153             if e.errno == ETERM:
    154                 # quietly return on ETERM
    155                 pass

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/tornado/ioloop.py in start(self=&lt;zmq.eventloop.ioloop.ZMQIOLoop object&gt;)
    835                 self._events.update(event_pairs)
    836                 while self._events:
    837                     fd, events = self._events.popitem()
    838                     try:
    839                         fd_obj, handler_func = self._handlers[fd]
--&gt; 840                         handler_func(fd_obj, events)
        handler_func = &lt;function null_wrapper&gt;
        fd_obj = &lt;zmq.sugar.socket.Socket object&gt;
        events = 1
    841                     except (OSError, IOError) as e:
    842                         if errno_from_exception(e) == errno.EPIPE:
    843                             # Happens when the client closes the connection
    844                             pass

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/tornado/stack_context.py in null_wrapper(*args=(&lt;zmq.sugar.socket.Socket object&gt;, 1), **kwargs={})
    270         # Fast path when there are no active contexts.
    271         def null_wrapper(*args, **kwargs):
    272             try:
    273                 current_state = _state.contexts
    274                 _state.contexts = cap_contexts[0]
--&gt; 275                 return fn(*args, **kwargs)
        args = (&lt;zmq.sugar.socket.Socket object&gt;, 1)
        kwargs = {}
    276             finally:
    277                 _state.contexts = current_state
    278         null_wrapper._wrapped = True
    279         return null_wrapper

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _handle_events(self=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;, fd=&lt;zmq.sugar.socket.Socket object&gt;, events=1)
    428             # dispatch events:
    429             if events &amp; IOLoop.ERROR:
    430                 gen_log.error(&quot;got POLLERR event on ZMQStream, which doesn't make sense&quot;)
    431                 return
    432             if events &amp; IOLoop.READ:
--&gt; 433                 self._handle_recv()
        self._handle_recv = &lt;bound method ZMQStream._handle_recv of &lt;zmq.eventloop.zmqstream.ZMQStream object&gt;&gt;
    434                 if not self.socket:
    435                     return
    436             if events &amp; IOLoop.WRITE:
    437                 self._handle_send()

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _handle_recv(self=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;)
    460                 gen_log.error(&quot;RECV Error: %s&quot;%zmq.strerror(e.errno))
    461         else:
    462             if self._recv_callback:
    463                 callback = self._recv_callback
    464                 # self._recv_callback = None
--&gt; 465                 self._run_callback(callback, msg)
        self._run_callback = &lt;bound method ZMQStream._run_callback of &lt;zmq.eventloop.zmqstream.ZMQStream object&gt;&gt;
        callback = &lt;function null_wrapper&gt;
        msg = [&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;]
    466                 
    467         # self.update_state()
    468         
    469 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _run_callback(self=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;, callback=&lt;function null_wrapper&gt;, *args=([&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;],), **kwargs={})
    402         close our socket.&quot;&quot;&quot;
    403         try:
    404             # Use a NullContext to ensure that all StackContexts are run
    405             # inside our blanket exception handler rather than outside.
    406             with stack_context.NullContext():
--&gt; 407                 callback(*args, **kwargs)
        callback = &lt;function null_wrapper&gt;
        args = ([&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;],)
        kwargs = {}
    408         except:
    409             gen_log.error(&quot;Uncaught exception, closing connection.&quot;,
    410                           exc_info=True)
    411             # Close the socket on an uncaught exception from a user callback

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/tornado/stack_context.py in null_wrapper(*args=([&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;],), **kwargs={})
    270         # Fast path when there are no active contexts.
    271         def null_wrapper(*args, **kwargs):
    272             try:
    273                 current_state = _state.contexts
    274                 _state.contexts = cap_contexts[0]
--&gt; 275                 return fn(*args, **kwargs)
        args = ([&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;],)
        kwargs = {}
    276             finally:
    277                 _state.contexts = current_state
    278         null_wrapper._wrapped = True
    279         return null_wrapper

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelbase.py in dispatcher(msg=[&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;])
    247         if self.control_stream:
    248             self.control_stream.on_recv(self.dispatch_control, copy=False)
    249 
    250         def make_dispatcher(stream):
    251             def dispatcher(msg):
--&gt; 252                 return self.dispatch_shell(stream, msg)
        msg = [&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;]
    253             return dispatcher
    254 
    255         for s in self.shell_streams:
    256             s.on_recv(make_dispatcher(s), copy=False)

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelbase.py in dispatch_shell(self=&lt;IPython.kernel.zmq.ipkernel.IPythonKernel object&gt;, stream=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;, msg={'buffers': [], 'content': {u'allow_stdin': True, u'code': u'learned_dict = dict_learn(init_dict, patches)', u'silent': False, u'stop_on_error': True, u'store_history': True, u'user_expressions': {}}, 'header': {u'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', u'msg_type': u'execute_request', u'session': u'21C58290AD9A4368BCFCB05D17E87C41', u'username': u'username', u'version': u'5.0'}, 'metadata': {}, 'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', 'msg_type': u'execute_request', 'parent_header': {}})
    208         else:
    209             # ensure default_int_handler during handler call
    210             sig = signal(SIGINT, default_int_handler)
    211             self.log.debug(&quot;%s: %s&quot;, msg_type, msg)
    212             try:
--&gt; 213                 handler(stream, idents, msg)
        handler = &lt;bound method IPythonKernel.execute_request of &lt;IPython.kernel.zmq.ipkernel.IPythonKernel object&gt;&gt;
        stream = &lt;zmq.eventloop.zmqstream.ZMQStream object&gt;
        idents = ['21C58290AD9A4368BCFCB05D17E87C41']
        msg = {'buffers': [], 'content': {u'allow_stdin': True, u'code': u'learned_dict = dict_learn(init_dict, patches)', u'silent': False, u'stop_on_error': True, u'store_history': True, u'user_expressions': {}}, 'header': {u'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', u'msg_type': u'execute_request', u'session': u'21C58290AD9A4368BCFCB05D17E87C41', u'username': u'username', u'version': u'5.0'}, 'metadata': {}, 'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', 'msg_type': u'execute_request', 'parent_header': {}}
    214             except Exception:
    215                 self.log.error(&quot;Exception in message handler:&quot;, exc_info=True)
    216             finally:
    217                 signal(SIGINT, sig)

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelbase.py in execute_request(self=&lt;IPython.kernel.zmq.ipkernel.IPythonKernel object&gt;, stream=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;, ident=['21C58290AD9A4368BCFCB05D17E87C41'], parent={'buffers': [], 'content': {u'allow_stdin': True, u'code': u'learned_dict = dict_learn(init_dict, patches)', u'silent': False, u'stop_on_error': True, u'store_history': True, u'user_expressions': {}}, 'header': {u'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', u'msg_type': u'execute_request', u'session': u'21C58290AD9A4368BCFCB05D17E87C41', u'username': u'username', u'version': u'5.0'}, 'metadata': {}, 'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', 'msg_type': u'execute_request', 'parent_header': {}})
    357         if not silent:
    358             self.execution_count += 1
    359             self._publish_execute_input(code, parent, self.execution_count)
    360         
    361         reply_content = self.do_execute(code, silent, store_history,
--&gt; 362                                         user_expressions, allow_stdin)
        user_expressions = {}
        allow_stdin = True
    363 
    364         # Flush output before sending the reply.
    365         sys.stdout.flush()
    366         sys.stderr.flush()

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py in do_execute(self=&lt;IPython.kernel.zmq.ipkernel.IPythonKernel object&gt;, code=u'learned_dict = dict_learn(init_dict, patches)', silent=False, store_history=True, user_expressions={}, allow_stdin=True)
    176 
    177         reply_content = {}
    178         # FIXME: the shell calls the exception handler itself.
    179         shell._reply_content = None
    180         try:
--&gt; 181             shell.run_cell(code, store_history=store_history, silent=silent)
        shell.run_cell = &lt;bound method ZMQInteractiveShell.run_cell of &lt;I....kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;&gt;
        code = u'learned_dict = dict_learn(init_dict, patches)'
        store_history = True
        silent = False
    182         except:
    183             status = u'error'
    184             # FIXME: this code right now isn't being used yet by default,
    185             # because the run_cell() call above directly fires off exception

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_cell(self=&lt;IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;, raw_cell=u'learned_dict = dict_learn(init_dict, patches)', store_history=True, silent=False, shell_futures=True)
   2863                 self.displayhook.exec_result = result
   2864 
   2865                 # Execute the user code
   2866                 interactivity = &quot;none&quot; if silent else self.ast_node_interactivity
   2867                 self.run_ast_nodes(code_ast.body, cell_name,
-&gt; 2868                    interactivity=interactivity, compiler=compiler, result=result)
        interactivity = 'last_expr'
        compiler = &lt;IPython.core.compilerop.CachingCompiler instance&gt;
   2869 
   2870                 # Reset this so later displayed values do not modify the
   2871                 # ExecutionResult
   2872                 self.displayhook.exec_result = None

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_ast_nodes(self=&lt;IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;, nodelist=[&lt;_ast.Assign object&gt;], cell_name='&lt;ipython-input-24-d745e5de1eae&gt;', interactivity='none', compiler=&lt;IPython.core.compilerop.CachingCompiler instance&gt;, result=&lt;IPython.core.interactiveshell.ExecutionResult object&gt;)
   2967 
   2968         try:
   2969             for i, node in enumerate(to_run_exec):
   2970                 mod = ast.Module([node])
   2971                 code = compiler(mod, cell_name, &quot;exec&quot;)
-&gt; 2972                 if self.run_code(code, result):
        self.run_code = &lt;bound method ZMQInteractiveShell.run_code of &lt;I....kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;&gt;
        code = &lt;code object &lt;module&gt; at 0x10abcef30, file &quot;&lt;ipython-input-24-d745e5de1eae&gt;&quot;, line 1&gt;
        result = &lt;IPython.core.interactiveshell.ExecutionResult object&gt;
   2973                     return True
   2974 
   2975             for i, node in enumerate(to_run_interactive):
   2976                 mod = ast.Interactive([node])

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_code(self=&lt;IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;, code_obj=&lt;code object &lt;module&gt; at 0x10abcef30, file &quot;&lt;ipython-input-24-d745e5de1eae&gt;&quot;, line 1&gt;, result=&lt;IPython.core.interactiveshell.ExecutionResult object&gt;)
   3027         outflag = 1  # happens in more places, so it's easier as default
   3028         try:
   3029             try:
   3030                 self.hooks.pre_run_code_hook()
   3031                 #rprint('Running code', repr(code_obj)) # dbg
-&gt; 3032                 exec(code_obj, self.user_global_ns, self.user_ns)
        code_obj = &lt;code object &lt;module&gt; at 0x10abcef30, file &quot;&lt;ipython-input-24-d745e5de1eae&gt;&quot;, line 1&gt;
        self.user_global_ns = {'In': ['', u'import skimage\nimport skimage.data as data\ni...klearn.preprocessing import normalize\nimport os', u&quot;get_ipython().magic(u'matplotlib inline')&quot;, u&quot;data_path = '/Users/fengyuyao/Research/experim...th) if '.png' in i])\n\ndata = data.mean(axis=3)&quot;, u'img = data[0, ...]\n#img = sktrans.resize(img, (150, 150))', u&quot;pimg = extract_patches_2d(img, (8,8))\nnimg = ...#ccc =reconstruct_from_patches_2d(bbb, (50, 50))&quot;, u'pimg = normalize(pimg)\nnpimg = normalize(npimg)', u&quot;pimg = extract_patches_2d(img, (8,8))\nnimg = ...#ccc =reconstruct_from_patches_2d(bbb, (50, 50))&quot;, u'patches = np.array([extract_patches_2d(d, (8,8)) for d in data[:10,...]]).reshape(-1, 64)', u'init_dict = patches[np.random.choice(np.arange... = np.ones(64)\ninit_dict = normalize(init_dict)', u&quot;def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary&quot;, u'learned_dict = dict_learn(init_dict, patches)', u&quot;def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary&quot;, u'init_dict = patches[np.random.choice(np.arange... = np.ones(64)\ninit_dict = normalize(init_dict)', u'learned_dict = dict_learn(init_dict, patches)', u&quot;def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary&quot;, u'learned_dict = dict_learn(init_dict, patches)', u'patches = np.array([extract_patches_2d(d, (8,8)) for d in data[:10,...]]).reshape(-1, 64)', u'index = np.arange(patches.shape[0])\nnp.random.shuffle(index)\nindex = index[:20000]', u'patches = patches[index]', ...], 'Out': {20: (20000, 64)}, 'SparseCoder': &lt;class 'sklearn.decomposition.dict_learning.SparseCoder'&gt;, '_': (20000, 64), '_20': (20000, 64), '__': '', '___': '', '__builtin__': &lt;module '__builtin__' (built-in)&gt;, '__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__doc__': 'Automatically created module for IPython interactive environment', ...}
        self.user_ns = {'In': ['', u'import skimage\nimport skimage.data as data\ni...klearn.preprocessing import normalize\nimport os', u&quot;get_ipython().magic(u'matplotlib inline')&quot;, u&quot;data_path = '/Users/fengyuyao/Research/experim...th) if '.png' in i])\n\ndata = data.mean(axis=3)&quot;, u'img = data[0, ...]\n#img = sktrans.resize(img, (150, 150))', u&quot;pimg = extract_patches_2d(img, (8,8))\nnimg = ...#ccc =reconstruct_from_patches_2d(bbb, (50, 50))&quot;, u'pimg = normalize(pimg)\nnpimg = normalize(npimg)', u&quot;pimg = extract_patches_2d(img, (8,8))\nnimg = ...#ccc =reconstruct_from_patches_2d(bbb, (50, 50))&quot;, u'patches = np.array([extract_patches_2d(d, (8,8)) for d in data[:10,...]]).reshape(-1, 64)', u'init_dict = patches[np.random.choice(np.arange... = np.ones(64)\ninit_dict = normalize(init_dict)', u&quot;def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary&quot;, u'learned_dict = dict_learn(init_dict, patches)', u&quot;def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary&quot;, u'init_dict = patches[np.random.choice(np.arange... = np.ones(64)\ninit_dict = normalize(init_dict)', u'learned_dict = dict_learn(init_dict, patches)', u&quot;def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary&quot;, u'learned_dict = dict_learn(init_dict, patches)', u'patches = np.array([extract_patches_2d(d, (8,8)) for d in data[:10,...]]).reshape(-1, 64)', u'index = np.arange(patches.shape[0])\nnp.random.shuffle(index)\nindex = index[:20000]', u'patches = patches[index]', ...], 'Out': {20: (20000, 64)}, 'SparseCoder': &lt;class 'sklearn.decomposition.dict_learning.SparseCoder'&gt;, '_': (20000, 64), '_20': (20000, 64), '__': '', '___': '', '__builtin__': &lt;module '__builtin__' (built-in)&gt;, '__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__doc__': 'Automatically created module for IPython interactive environment', ...}
   3033             finally:
   3034                 # Reset our crash handler in place
   3035                 sys.excepthook = old_excepthook
   3036         except SystemExit as e:

...........................................................................
/Users/fengyuyao/Research/ppts/dictionary_learning_2015.11.25/code/&lt;ipython-input-24-d745e5de1eae&gt; in &lt;module&gt;()
----&gt; 1 
      2 
      3 
      4 
      5 
      6 learned_dict = dict_learn(init_dict, patches)
      7 
      8 
      9 
     10 

...........................................................................
/Users/fengyuyao/Research/ppts/dictionary_learning_2015.11.25/code/&lt;ipython-input-23-50e8dab30ec4&gt; in dict_learn(dictionary=array([[ 0.125     ,  0.125     ,  0.125     , ....  0.10416518,
         0.06896773,  0.0757119 ]]), data=array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]]))
      3     iteration = 0
      4     last_iter_norm = 1e5
      5     while True:
      6         # Sparse coding stage
      7         coder = SparseCoder(dictionary, transform_algorithm='omp', n_jobs=8, transform_n_nonzero_coefs=3)
----&gt; 8         code = coder.fit_transform(data)
      9         #print iteration, ' ', linalg.norm(data - np.dot(code, dictionary)), ' +',
     10         # update stage
     11         for i in range(dictionary.shape[0]):
     12             _dictionary = dictionary.copy()

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/base.py in fit_transform(self=SparseCoder(dictionary=None, n_jobs=8, split_sig...rm_alpha=None,
      transform_n_nonzero_coefs=3), X=array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]]), y=None, **fit_params={})
    450         &quot;&quot;&quot;
    451         # non-optimized default implementation; override when a better
    452         # method is possible for a given clustering algorithm
    453         if y is None:
    454             # fit method of arity 1 (unsupervised transformation)
--&gt; 455             return self.fit(X, **fit_params).transform(X)
        self.fit = &lt;bound method SparseCoder.fit of SparseCoder(dic...m_alpha=None,
      transform_n_nonzero_coefs=3)&gt;
        X = array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]])
        fit_params.transform = undefined
    456         else:
    457             # fit method of arity 2 (supervised transformation)
    458             return self.fit(X, y, **fit_params).transform(X)
    459 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.py in transform(self=SparseCoder(dictionary=None, n_jobs=8, split_sig...rm_alpha=None,
      transform_n_nonzero_coefs=3), X=array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]]), y=None)
    813         n_samples, n_features = X.shape
    814 
    815         code = sparse_encode(
    816             X, self.components_, algorithm=self.transform_algorithm,
    817             n_nonzero_coefs=self.transform_n_nonzero_coefs,
--&gt; 818             alpha=self.transform_alpha, n_jobs=self.n_jobs)
        self.transform_alpha = None
        self.n_jobs = 8
    819 
    820         if self.split_sign:
    821             # feature vector is split into a positive and negative side
    822             n_samples, n_features = code.shape

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.py in sparse_encode(X=array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]]), dictionary=array([[ 0.125     ,  0.125     ,  0.125     , ....  0.10416518,
         0.06896773,  0.0757119 ]]), gram=array([[ 1.        ,  0.99706708,  0.8669373 , ....  0.94511259,
         0.93221472,  1.        ]]), cov=array([[ 3.49867539,  1.93651123,  2.05015994, ....  4.82561002,
         0.62133361,  2.87358633]]), algorithm='omp', n_nonzero_coefs=3, alpha=None, copy_cov=False, init=None, max_iter=1000, n_jobs=8, check_input=True, verbose=0)
    295             algorithm,
    296             regularization=regularization, copy_cov=copy_cov,
    297             init=init[this_slice] if init is not None else None,
    298             max_iter=max_iter,
    299             check_input=False)
--&gt; 300         for this_slice in slices)
        this_slice = undefined
        slices = [slice(0, 2500, None), slice(2500, 5000, None), slice(5000, 7500, None), slice(7500, 10000, None), slice(10000, 12500, None), slice(12500, 15000, None), slice(15000, 17500, None), slice(17500, 20000, None)]
    301     for this_slice, this_view in zip(slices, code_views):
    302         code[this_slice] = this_view
    303     return code
    304 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.py in __call__(self=Parallel(n_jobs=8), iterable=&lt;generator object &lt;genexpr&gt;&gt;)
    807             if pre_dispatch == &quot;all&quot; or n_jobs == 1:
    808                 # The iterable was consumed all at once by the above for loop.
    809                 # No need to wait for async callbacks to trigger to
    810                 # consumption.
    811                 self._iterating = False
--&gt; 812             self.retrieve()
        self.retrieve = &lt;bound method Parallel.retrieve of Parallel(n_jobs=8)&gt;
    813             # Make sure that we get a last message telling us we are done
    814             elapsed_time = time.time() - self._start_time
    815             self._print('Done %3i out of %3i | elapsed: %s finished',
    816                         (len(self._output), len(self._output),

---------------------------------------------------------------------------
Sub-process traceback:
---------------------------------------------------------------------------
ValueError                                         Fri Dec  4 10:21:33 2015
PID: 35032              Python 2.7.10: /Users/fengyuyao/anaconda/bin/python
...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self=&lt;sklearn.externals.joblib.parallel.BatchedCalls object&gt;)
     67     def __init__(self, iterator_slice):
     68         self.items = list(iterator_slice)
     69         self._size = len(self.items)
     70 
     71     def __call__(self):
---&gt; 72         return [func(*args, **kwargs) for func, args, kwargs in self.items]
     73 
     74     def __len__(self):
     75         return self._size
     76 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.pyc in _sparse_encode(X=memmap([[ 0.50559053,  0.49227671,  0.48265361, ...  0.99596078,
         0.99738562,  1.        ]]), dictionary=array([[ 0.125     ,  0.125     ,  0.125     , ....  0.10416518,
         0.06896773,  0.0757119 ]]), gram=memmap([[ 1.        ,  0.99706708,  0.8669373 , ...  0.94511259,
         0.93221472,  1.        ]]), cov=memmap([[ 3.49867539,  1.93651123,  2.05015994, ...  5.77883725,
         3.55803798,  7.21968383]]), algorithm='omp', regularization=3, copy_cov=False, init=None, max_iter=1000, check_input=False, verbose=0)
    147     elif algorithm == 'omp':
    148         # TODO: Should verbose argument be passed to this?
    149         new_code = orthogonal_mp_gram(
    150             Gram=gram, Xy=cov, n_nonzero_coefs=int(regularization),
    151             tol=None, norms_squared=row_norms(X, squared=True),
--&gt; 152             copy_Xy=copy_cov).T
        algorithm = 'omp'
        alpha = undefined
    153     else:
    154         raise ValueError('Sparse coding method must be &quot;lasso_lars&quot; '
    155                          '&quot;lasso_cd&quot;,  &quot;lasso&quot;, &quot;threshold&quot; or &quot;omp&quot;, got %s.'
    156                          % algorithm)

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/linear_model/omp.pyc in orthogonal_mp_gram(Gram=array([[ 1.        ,  0.99706708,  0.8669373 , ....  0.94511259,
         0.93221472,  1.        ]]), Xy=array([[ 3.49867539,  1.93651123,  2.05015994, ....  5.77883725,
         3.55803798,  7.21968383]]), n_nonzero_coefs=3, tol=None, norms_squared=array([ 12.37032493,   4.36747488,   4.2134112 ,... 37.00901994,
        16.6505497 ,  58.97107498]), copy_Gram=True, copy_Xy=False, return_path=False, return_n_iter=False)
    518     for k in range(Xy.shape[1]):
    519         out = _gram_omp(
    520             Gram, Xy[:, k], n_nonzero_coefs,
    521             norms_squared[k] if tol is not None else None, tol,
    522             copy_Gram=copy_Gram, copy_Xy=copy_Xy,
--&gt; 523             return_path=return_path)
    524         if return_path:
    525             _, idx, coefs, n_iter = out
    526             coef = coef[:, :, :len(idx)]
    527             for n_active, x in enumerate(coefs.T):

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/linear_model/omp.pyc in _gram_omp(Gram=array([[ 1.        ,  0.99010866,  0.82197346, ....  0.94511259,
         0.93221472,  1.        ]]), Xy=array([ 3.49867539,  3.48729003,  2.91977933,  3...4,  3.39029937,
        3.45356109,  3.35550344]), n_nonzero_coefs=3, tol_0=None, tol=None, copy_Gram=True, copy_Xy=False, return_path=False)
    240                 break
    241             L[n_active, n_active] = np.sqrt(1 - v)
    242         Gram[n_active], Gram[lam] = swap(Gram[n_active], Gram[lam])
    243         Gram.T[n_active], Gram.T[lam] = swap(Gram.T[n_active], Gram.T[lam])
    244         indices[n_active], indices[lam] = indices[lam], indices[n_active]
--&gt; 245         Xy[n_active], Xy[lam] = Xy[lam], Xy[n_active]
        return_path = False
    246         n_active += 1
    247         # solves LL'x = y as a composition of two triangular systems
    248         gamma, _ = potrs(L[:n_active, :n_active], Xy[:n_active], lower=True,
    249                          overwrite_b=False)

ValueError: assignment destination is read-only
___________________________________________________________________________
"><pre class="notranslate"><code class="notranslate">---------------------------------------------------------------------------
JoblibValueError                          Traceback (most recent call last)
&lt;ipython-input-24-d745e5de1eae&gt; in &lt;module&gt;()
----&gt; 1 learned_dict = dict_learn(init_dict, patches)

&lt;ipython-input-23-50e8dab30ec4&gt; in dict_learn(dictionary, data)
      6         # Sparse coding stage
      7         coder = SparseCoder(dictionary, transform_algorithm='omp', n_jobs=8, transform_n_nonzero_coefs=3)
----&gt; 8         code = coder.fit_transform(data)
      9         #print iteration, ' ', linalg.norm(data - np.dot(code, dictionary)), ' +',
     10         # update stage

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/base.pyc in fit_transform(self, X, y, **fit_params)
    453         if y is None:
    454             # fit method of arity 1 (unsupervised transformation)
--&gt; 455             return self.fit(X, **fit_params).transform(X)
    456         else:
    457             # fit method of arity 2 (supervised transformation)

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.pyc in transform(self, X, y)
    816             X, self.components_, algorithm=self.transform_algorithm,
    817             n_nonzero_coefs=self.transform_n_nonzero_coefs,
--&gt; 818             alpha=self.transform_alpha, n_jobs=self.n_jobs)
    819 
    820         if self.split_sign:

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.pyc in sparse_encode(X, dictionary, gram, cov, algorithm, n_nonzero_coefs, alpha, copy_cov, init, max_iter, n_jobs, check_input, verbose)
    298             max_iter=max_iter,
    299             check_input=False)
--&gt; 300         for this_slice in slices)
    301     for this_slice, this_view in zip(slices, code_views):
    302         code[this_slice] = this_view

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self, iterable)
    810                 # consumption.
    811                 self._iterating = False
--&gt; 812             self.retrieve()
    813             # Make sure that we get a last message telling us we are done
    814             elapsed_time = time.time() - self._start_time

/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in retrieve(self)
    760                         # a working pool as they expect.
    761                         self._initialize_pool()
--&gt; 762                 raise exception
    763 
    764     def __call__(self, iterable):

JoblibValueError: JoblibValueError
___________________________________________________________________________
Multiprocessing exception:
...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/runpy.py in _run_module_as_main(mod_name='IPython.kernel.__main__', alter_argv=1)
    157     pkg_name = mod_name.rpartition('.')[0]
    158     main_globals = sys.modules["__main__"].__dict__
    159     if alter_argv:
    160         sys.argv[0] = fname
    161     return _run_code(code, main_globals, None,
--&gt; 162                      "__main__", fname, loader, pkg_name)
        fname = '/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py'
        loader = &lt;pkgutil.ImpLoader instance&gt;
        pkg_name = 'IPython.kernel'
    163 
    164 def run_module(mod_name, init_globals=None,
    165                run_name=None, alter_sys=False):
    166     """Execute a module's code without importing it

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/runpy.py in _run_code(code=&lt;code object &lt;module&gt; at 0x10596bdb0, file "/Use...ite-packages/IPython/kernel/__main__.py", line 1&gt;, run_globals={'__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__doc__': None, '__file__': '/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py', '__loader__': &lt;pkgutil.ImpLoader instance&gt;, '__name__': '__main__', '__package__': 'IPython.kernel', 'app': &lt;module 'IPython.kernel.zmq.kernelapp' from '/Us.../site-packages/IPython/kernel/zmq/kernelapp.pyc'&gt;}, init_globals=None, mod_name='__main__', mod_fname='/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py', mod_loader=&lt;pkgutil.ImpLoader instance&gt;, pkg_name='IPython.kernel')
     67         run_globals.update(init_globals)
     68     run_globals.update(__name__ = mod_name,
     69                        __file__ = mod_fname,
     70                        __loader__ = mod_loader,
     71                        __package__ = pkg_name)
---&gt; 72     exec code in run_globals
        code = &lt;code object &lt;module&gt; at 0x10596bdb0, file "/Use...ite-packages/IPython/kernel/__main__.py", line 1&gt;
        run_globals = {'__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__doc__': None, '__file__': '/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py', '__loader__': &lt;pkgutil.ImpLoader instance&gt;, '__name__': '__main__', '__package__': 'IPython.kernel', 'app': &lt;module 'IPython.kernel.zmq.kernelapp' from '/Us.../site-packages/IPython/kernel/zmq/kernelapp.pyc'&gt;}
     73     return run_globals
     74 
     75 def _run_module_code(code, init_globals=None,
     76                     mod_name=None, mod_fname=None,

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/__main__.py in &lt;module&gt;()
      1 
      2 
----&gt; 3 
      4 if __name__ == '__main__':
      5     from IPython.kernel.zmq import kernelapp as app
      6     app.launch_new_instance()
      7 
      8 
      9 
     10 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/config/application.py in launch_instance(cls=&lt;class 'IPython.kernel.zmq.kernelapp.IPKernelApp'&gt;, argv=None, **kwargs={})
    569         
    570         If a global instance already exists, this reinitializes and starts it
    571         """
    572         app = cls.instance(**kwargs)
    573         app.initialize(argv)
--&gt; 574         app.start()
        app.start = &lt;bound method IPKernelApp.start of &lt;IPython.kernel.zmq.kernelapp.IPKernelApp object&gt;&gt;
    575 
    576 #-----------------------------------------------------------------------------
    577 # utility functions, for convenience
    578 #-----------------------------------------------------------------------------

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelapp.py in start(self=&lt;IPython.kernel.zmq.kernelapp.IPKernelApp object&gt;)
    369     def start(self):
    370         if self.poller is not None:
    371             self.poller.start()
    372         self.kernel.start()
    373         try:
--&gt; 374             ioloop.IOLoop.instance().start()
    375         except KeyboardInterrupt:
    376             pass
    377 
    378 launch_new_instance = IPKernelApp.launch_instance

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py in start(self=&lt;zmq.eventloop.ioloop.ZMQIOLoop object&gt;)
    146             PollIOLoop.configure(ZMQIOLoop)
    147         return PollIOLoop.instance()
    148     
    149     def start(self):
    150         try:
--&gt; 151             super(ZMQIOLoop, self).start()
        self.start = &lt;bound method ZMQIOLoop.start of &lt;zmq.eventloop.ioloop.ZMQIOLoop object&gt;&gt;
    152         except ZMQError as e:
    153             if e.errno == ETERM:
    154                 # quietly return on ETERM
    155                 pass

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/tornado/ioloop.py in start(self=&lt;zmq.eventloop.ioloop.ZMQIOLoop object&gt;)
    835                 self._events.update(event_pairs)
    836                 while self._events:
    837                     fd, events = self._events.popitem()
    838                     try:
    839                         fd_obj, handler_func = self._handlers[fd]
--&gt; 840                         handler_func(fd_obj, events)
        handler_func = &lt;function null_wrapper&gt;
        fd_obj = &lt;zmq.sugar.socket.Socket object&gt;
        events = 1
    841                     except (OSError, IOError) as e:
    842                         if errno_from_exception(e) == errno.EPIPE:
    843                             # Happens when the client closes the connection
    844                             pass

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/tornado/stack_context.py in null_wrapper(*args=(&lt;zmq.sugar.socket.Socket object&gt;, 1), **kwargs={})
    270         # Fast path when there are no active contexts.
    271         def null_wrapper(*args, **kwargs):
    272             try:
    273                 current_state = _state.contexts
    274                 _state.contexts = cap_contexts[0]
--&gt; 275                 return fn(*args, **kwargs)
        args = (&lt;zmq.sugar.socket.Socket object&gt;, 1)
        kwargs = {}
    276             finally:
    277                 _state.contexts = current_state
    278         null_wrapper._wrapped = True
    279         return null_wrapper

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _handle_events(self=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;, fd=&lt;zmq.sugar.socket.Socket object&gt;, events=1)
    428             # dispatch events:
    429             if events &amp; IOLoop.ERROR:
    430                 gen_log.error("got POLLERR event on ZMQStream, which doesn't make sense")
    431                 return
    432             if events &amp; IOLoop.READ:
--&gt; 433                 self._handle_recv()
        self._handle_recv = &lt;bound method ZMQStream._handle_recv of &lt;zmq.eventloop.zmqstream.ZMQStream object&gt;&gt;
    434                 if not self.socket:
    435                     return
    436             if events &amp; IOLoop.WRITE:
    437                 self._handle_send()

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _handle_recv(self=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;)
    460                 gen_log.error("RECV Error: %s"%zmq.strerror(e.errno))
    461         else:
    462             if self._recv_callback:
    463                 callback = self._recv_callback
    464                 # self._recv_callback = None
--&gt; 465                 self._run_callback(callback, msg)
        self._run_callback = &lt;bound method ZMQStream._run_callback of &lt;zmq.eventloop.zmqstream.ZMQStream object&gt;&gt;
        callback = &lt;function null_wrapper&gt;
        msg = [&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;]
    466                 
    467         # self.update_state()
    468         
    469 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py in _run_callback(self=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;, callback=&lt;function null_wrapper&gt;, *args=([&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;],), **kwargs={})
    402         close our socket."""
    403         try:
    404             # Use a NullContext to ensure that all StackContexts are run
    405             # inside our blanket exception handler rather than outside.
    406             with stack_context.NullContext():
--&gt; 407                 callback(*args, **kwargs)
        callback = &lt;function null_wrapper&gt;
        args = ([&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;],)
        kwargs = {}
    408         except:
    409             gen_log.error("Uncaught exception, closing connection.",
    410                           exc_info=True)
    411             # Close the socket on an uncaught exception from a user callback

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/tornado/stack_context.py in null_wrapper(*args=([&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;],), **kwargs={})
    270         # Fast path when there are no active contexts.
    271         def null_wrapper(*args, **kwargs):
    272             try:
    273                 current_state = _state.contexts
    274                 _state.contexts = cap_contexts[0]
--&gt; 275                 return fn(*args, **kwargs)
        args = ([&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;],)
        kwargs = {}
    276             finally:
    277                 _state.contexts = current_state
    278         null_wrapper._wrapped = True
    279         return null_wrapper

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelbase.py in dispatcher(msg=[&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;])
    247         if self.control_stream:
    248             self.control_stream.on_recv(self.dispatch_control, copy=False)
    249 
    250         def make_dispatcher(stream):
    251             def dispatcher(msg):
--&gt; 252                 return self.dispatch_shell(stream, msg)
        msg = [&lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;, &lt;zmq.sugar.frame.Frame object&gt;]
    253             return dispatcher
    254 
    255         for s in self.shell_streams:
    256             s.on_recv(make_dispatcher(s), copy=False)

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelbase.py in dispatch_shell(self=&lt;IPython.kernel.zmq.ipkernel.IPythonKernel object&gt;, stream=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;, msg={'buffers': [], 'content': {u'allow_stdin': True, u'code': u'learned_dict = dict_learn(init_dict, patches)', u'silent': False, u'stop_on_error': True, u'store_history': True, u'user_expressions': {}}, 'header': {u'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', u'msg_type': u'execute_request', u'session': u'21C58290AD9A4368BCFCB05D17E87C41', u'username': u'username', u'version': u'5.0'}, 'metadata': {}, 'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', 'msg_type': u'execute_request', 'parent_header': {}})
    208         else:
    209             # ensure default_int_handler during handler call
    210             sig = signal(SIGINT, default_int_handler)
    211             self.log.debug("%s: %s", msg_type, msg)
    212             try:
--&gt; 213                 handler(stream, idents, msg)
        handler = &lt;bound method IPythonKernel.execute_request of &lt;IPython.kernel.zmq.ipkernel.IPythonKernel object&gt;&gt;
        stream = &lt;zmq.eventloop.zmqstream.ZMQStream object&gt;
        idents = ['21C58290AD9A4368BCFCB05D17E87C41']
        msg = {'buffers': [], 'content': {u'allow_stdin': True, u'code': u'learned_dict = dict_learn(init_dict, patches)', u'silent': False, u'stop_on_error': True, u'store_history': True, u'user_expressions': {}}, 'header': {u'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', u'msg_type': u'execute_request', u'session': u'21C58290AD9A4368BCFCB05D17E87C41', u'username': u'username', u'version': u'5.0'}, 'metadata': {}, 'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', 'msg_type': u'execute_request', 'parent_header': {}}
    214             except Exception:
    215                 self.log.error("Exception in message handler:", exc_info=True)
    216             finally:
    217                 signal(SIGINT, sig)

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelbase.py in execute_request(self=&lt;IPython.kernel.zmq.ipkernel.IPythonKernel object&gt;, stream=&lt;zmq.eventloop.zmqstream.ZMQStream object&gt;, ident=['21C58290AD9A4368BCFCB05D17E87C41'], parent={'buffers': [], 'content': {u'allow_stdin': True, u'code': u'learned_dict = dict_learn(init_dict, patches)', u'silent': False, u'stop_on_error': True, u'store_history': True, u'user_expressions': {}}, 'header': {u'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', u'msg_type': u'execute_request', u'session': u'21C58290AD9A4368BCFCB05D17E87C41', u'username': u'username', u'version': u'5.0'}, 'metadata': {}, 'msg_id': u'D61C0C0F1F89441EB2C232BAE352E9B6', 'msg_type': u'execute_request', 'parent_header': {}})
    357         if not silent:
    358             self.execution_count += 1
    359             self._publish_execute_input(code, parent, self.execution_count)
    360         
    361         reply_content = self.do_execute(code, silent, store_history,
--&gt; 362                                         user_expressions, allow_stdin)
        user_expressions = {}
        allow_stdin = True
    363 
    364         # Flush output before sending the reply.
    365         sys.stdout.flush()
    366         sys.stderr.flush()

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py in do_execute(self=&lt;IPython.kernel.zmq.ipkernel.IPythonKernel object&gt;, code=u'learned_dict = dict_learn(init_dict, patches)', silent=False, store_history=True, user_expressions={}, allow_stdin=True)
    176 
    177         reply_content = {}
    178         # FIXME: the shell calls the exception handler itself.
    179         shell._reply_content = None
    180         try:
--&gt; 181             shell.run_cell(code, store_history=store_history, silent=silent)
        shell.run_cell = &lt;bound method ZMQInteractiveShell.run_cell of &lt;I....kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;&gt;
        code = u'learned_dict = dict_learn(init_dict, patches)'
        store_history = True
        silent = False
    182         except:
    183             status = u'error'
    184             # FIXME: this code right now isn't being used yet by default,
    185             # because the run_cell() call above directly fires off exception

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_cell(self=&lt;IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;, raw_cell=u'learned_dict = dict_learn(init_dict, patches)', store_history=True, silent=False, shell_futures=True)
   2863                 self.displayhook.exec_result = result
   2864 
   2865                 # Execute the user code
   2866                 interactivity = "none" if silent else self.ast_node_interactivity
   2867                 self.run_ast_nodes(code_ast.body, cell_name,
-&gt; 2868                    interactivity=interactivity, compiler=compiler, result=result)
        interactivity = 'last_expr'
        compiler = &lt;IPython.core.compilerop.CachingCompiler instance&gt;
   2869 
   2870                 # Reset this so later displayed values do not modify the
   2871                 # ExecutionResult
   2872                 self.displayhook.exec_result = None

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_ast_nodes(self=&lt;IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;, nodelist=[&lt;_ast.Assign object&gt;], cell_name='&lt;ipython-input-24-d745e5de1eae&gt;', interactivity='none', compiler=&lt;IPython.core.compilerop.CachingCompiler instance&gt;, result=&lt;IPython.core.interactiveshell.ExecutionResult object&gt;)
   2967 
   2968         try:
   2969             for i, node in enumerate(to_run_exec):
   2970                 mod = ast.Module([node])
   2971                 code = compiler(mod, cell_name, "exec")
-&gt; 2972                 if self.run_code(code, result):
        self.run_code = &lt;bound method ZMQInteractiveShell.run_code of &lt;I....kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;&gt;
        code = &lt;code object &lt;module&gt; at 0x10abcef30, file "&lt;ipython-input-24-d745e5de1eae&gt;", line 1&gt;
        result = &lt;IPython.core.interactiveshell.ExecutionResult object&gt;
   2973                     return True
   2974 
   2975             for i, node in enumerate(to_run_interactive):
   2976                 mod = ast.Interactive([node])

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py in run_code(self=&lt;IPython.kernel.zmq.zmqshell.ZMQInteractiveShell object&gt;, code_obj=&lt;code object &lt;module&gt; at 0x10abcef30, file "&lt;ipython-input-24-d745e5de1eae&gt;", line 1&gt;, result=&lt;IPython.core.interactiveshell.ExecutionResult object&gt;)
   3027         outflag = 1  # happens in more places, so it's easier as default
   3028         try:
   3029             try:
   3030                 self.hooks.pre_run_code_hook()
   3031                 #rprint('Running code', repr(code_obj)) # dbg
-&gt; 3032                 exec(code_obj, self.user_global_ns, self.user_ns)
        code_obj = &lt;code object &lt;module&gt; at 0x10abcef30, file "&lt;ipython-input-24-d745e5de1eae&gt;", line 1&gt;
        self.user_global_ns = {'In': ['', u'import skimage\nimport skimage.data as data\ni...klearn.preprocessing import normalize\nimport os', u"get_ipython().magic(u'matplotlib inline')", u"data_path = '/Users/fengyuyao/Research/experim...th) if '.png' in i])\n\ndata = data.mean(axis=3)", u'img = data[0, ...]\n#img = sktrans.resize(img, (150, 150))', u"pimg = extract_patches_2d(img, (8,8))\nnimg = ...#ccc =reconstruct_from_patches_2d(bbb, (50, 50))", u'pimg = normalize(pimg)\nnpimg = normalize(npimg)', u"pimg = extract_patches_2d(img, (8,8))\nnimg = ...#ccc =reconstruct_from_patches_2d(bbb, (50, 50))", u'patches = np.array([extract_patches_2d(d, (8,8)) for d in data[:10,...]]).reshape(-1, 64)', u'init_dict = patches[np.random.choice(np.arange... = np.ones(64)\ninit_dict = normalize(init_dict)', u"def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary", u'learned_dict = dict_learn(init_dict, patches)', u"def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary", u'init_dict = patches[np.random.choice(np.arange... = np.ones(64)\ninit_dict = normalize(init_dict)', u'learned_dict = dict_learn(init_dict, patches)', u"def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary", u'learned_dict = dict_learn(init_dict, patches)', u'patches = np.array([extract_patches_2d(d, (8,8)) for d in data[:10,...]]).reshape(-1, 64)', u'index = np.arange(patches.shape[0])\nnp.random.shuffle(index)\nindex = index[:20000]', u'patches = patches[index]', ...], 'Out': {20: (20000, 64)}, 'SparseCoder': &lt;class 'sklearn.decomposition.dict_learning.SparseCoder'&gt;, '_': (20000, 64), '_20': (20000, 64), '__': '', '___': '', '__builtin__': &lt;module '__builtin__' (built-in)&gt;, '__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__doc__': 'Automatically created module for IPython interactive environment', ...}
        self.user_ns = {'In': ['', u'import skimage\nimport skimage.data as data\ni...klearn.preprocessing import normalize\nimport os', u"get_ipython().magic(u'matplotlib inline')", u"data_path = '/Users/fengyuyao/Research/experim...th) if '.png' in i])\n\ndata = data.mean(axis=3)", u'img = data[0, ...]\n#img = sktrans.resize(img, (150, 150))', u"pimg = extract_patches_2d(img, (8,8))\nnimg = ...#ccc =reconstruct_from_patches_2d(bbb, (50, 50))", u'pimg = normalize(pimg)\nnpimg = normalize(npimg)', u"pimg = extract_patches_2d(img, (8,8))\nnimg = ...#ccc =reconstruct_from_patches_2d(bbb, (50, 50))", u'patches = np.array([extract_patches_2d(d, (8,8)) for d in data[:10,...]]).reshape(-1, 64)', u'init_dict = patches[np.random.choice(np.arange... = np.ones(64)\ninit_dict = normalize(init_dict)', u"def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary", u'learned_dict = dict_learn(init_dict, patches)', u"def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary", u'init_dict = patches[np.random.choice(np.arange... = np.ones(64)\ninit_dict = normalize(init_dict)', u'learned_dict = dict_learn(init_dict, patches)', u"def dict_learn(dictionary, data):\n    diction...        #yield dictionary\n    return dictionary", u'learned_dict = dict_learn(init_dict, patches)', u'patches = np.array([extract_patches_2d(d, (8,8)) for d in data[:10,...]]).reshape(-1, 64)', u'index = np.arange(patches.shape[0])\nnp.random.shuffle(index)\nindex = index[:20000]', u'patches = patches[index]', ...], 'Out': {20: (20000, 64)}, 'SparseCoder': &lt;class 'sklearn.decomposition.dict_learning.SparseCoder'&gt;, '_': (20000, 64), '_20': (20000, 64), '__': '', '___': '', '__builtin__': &lt;module '__builtin__' (built-in)&gt;, '__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__doc__': 'Automatically created module for IPython interactive environment', ...}
   3033             finally:
   3034                 # Reset our crash handler in place
   3035                 sys.excepthook = old_excepthook
   3036         except SystemExit as e:

...........................................................................
/Users/fengyuyao/Research/ppts/dictionary_learning_2015.11.25/code/&lt;ipython-input-24-d745e5de1eae&gt; in &lt;module&gt;()
----&gt; 1 
      2 
      3 
      4 
      5 
      6 learned_dict = dict_learn(init_dict, patches)
      7 
      8 
      9 
     10 

...........................................................................
/Users/fengyuyao/Research/ppts/dictionary_learning_2015.11.25/code/&lt;ipython-input-23-50e8dab30ec4&gt; in dict_learn(dictionary=array([[ 0.125     ,  0.125     ,  0.125     , ....  0.10416518,
         0.06896773,  0.0757119 ]]), data=array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]]))
      3     iteration = 0
      4     last_iter_norm = 1e5
      5     while True:
      6         # Sparse coding stage
      7         coder = SparseCoder(dictionary, transform_algorithm='omp', n_jobs=8, transform_n_nonzero_coefs=3)
----&gt; 8         code = coder.fit_transform(data)
      9         #print iteration, ' ', linalg.norm(data - np.dot(code, dictionary)), ' +',
     10         # update stage
     11         for i in range(dictionary.shape[0]):
     12             _dictionary = dictionary.copy()

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/base.py in fit_transform(self=SparseCoder(dictionary=None, n_jobs=8, split_sig...rm_alpha=None,
      transform_n_nonzero_coefs=3), X=array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]]), y=None, **fit_params={})
    450         """
    451         # non-optimized default implementation; override when a better
    452         # method is possible for a given clustering algorithm
    453         if y is None:
    454             # fit method of arity 1 (unsupervised transformation)
--&gt; 455             return self.fit(X, **fit_params).transform(X)
        self.fit = &lt;bound method SparseCoder.fit of SparseCoder(dic...m_alpha=None,
      transform_n_nonzero_coefs=3)&gt;
        X = array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]])
        fit_params.transform = undefined
    456         else:
    457             # fit method of arity 2 (supervised transformation)
    458             return self.fit(X, y, **fit_params).transform(X)
    459 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.py in transform(self=SparseCoder(dictionary=None, n_jobs=8, split_sig...rm_alpha=None,
      transform_n_nonzero_coefs=3), X=array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]]), y=None)
    813         n_samples, n_features = X.shape
    814 
    815         code = sparse_encode(
    816             X, self.components_, algorithm=self.transform_algorithm,
    817             n_nonzero_coefs=self.transform_n_nonzero_coefs,
--&gt; 818             alpha=self.transform_alpha, n_jobs=self.n_jobs)
        self.transform_alpha = None
        self.n_jobs = 8
    819 
    820         if self.split_sign:
    821             # feature vector is split into a positive and negative side
    822             n_samples, n_features = code.shape

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.py in sparse_encode(X=array([[ 0.50559053,  0.49227671,  0.48265361, ....  0.15035063,
         0.1782305 ,  0.19739984]]), dictionary=array([[ 0.125     ,  0.125     ,  0.125     , ....  0.10416518,
         0.06896773,  0.0757119 ]]), gram=array([[ 1.        ,  0.99706708,  0.8669373 , ....  0.94511259,
         0.93221472,  1.        ]]), cov=array([[ 3.49867539,  1.93651123,  2.05015994, ....  4.82561002,
         0.62133361,  2.87358633]]), algorithm='omp', n_nonzero_coefs=3, alpha=None, copy_cov=False, init=None, max_iter=1000, n_jobs=8, check_input=True, verbose=0)
    295             algorithm,
    296             regularization=regularization, copy_cov=copy_cov,
    297             init=init[this_slice] if init is not None else None,
    298             max_iter=max_iter,
    299             check_input=False)
--&gt; 300         for this_slice in slices)
        this_slice = undefined
        slices = [slice(0, 2500, None), slice(2500, 5000, None), slice(5000, 7500, None), slice(7500, 10000, None), slice(10000, 12500, None), slice(12500, 15000, None), slice(15000, 17500, None), slice(17500, 20000, None)]
    301     for this_slice, this_view in zip(slices, code_views):
    302         code[this_slice] = this_view
    303     return code
    304 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.py in __call__(self=Parallel(n_jobs=8), iterable=&lt;generator object &lt;genexpr&gt;&gt;)
    807             if pre_dispatch == "all" or n_jobs == 1:
    808                 # The iterable was consumed all at once by the above for loop.
    809                 # No need to wait for async callbacks to trigger to
    810                 # consumption.
    811                 self._iterating = False
--&gt; 812             self.retrieve()
        self.retrieve = &lt;bound method Parallel.retrieve of Parallel(n_jobs=8)&gt;
    813             # Make sure that we get a last message telling us we are done
    814             elapsed_time = time.time() - self._start_time
    815             self._print('Done %3i out of %3i | elapsed: %s finished',
    816                         (len(self._output), len(self._output),

---------------------------------------------------------------------------
Sub-process traceback:
---------------------------------------------------------------------------
ValueError                                         Fri Dec  4 10:21:33 2015
PID: 35032              Python 2.7.10: /Users/fengyuyao/anaconda/bin/python
...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self=&lt;sklearn.externals.joblib.parallel.BatchedCalls object&gt;)
     67     def __init__(self, iterator_slice):
     68         self.items = list(iterator_slice)
     69         self._size = len(self.items)
     70 
     71     def __call__(self):
---&gt; 72         return [func(*args, **kwargs) for func, args, kwargs in self.items]
     73 
     74     def __len__(self):
     75         return self._size
     76 

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/decomposition/dict_learning.pyc in _sparse_encode(X=memmap([[ 0.50559053,  0.49227671,  0.48265361, ...  0.99596078,
         0.99738562,  1.        ]]), dictionary=array([[ 0.125     ,  0.125     ,  0.125     , ....  0.10416518,
         0.06896773,  0.0757119 ]]), gram=memmap([[ 1.        ,  0.99706708,  0.8669373 , ...  0.94511259,
         0.93221472,  1.        ]]), cov=memmap([[ 3.49867539,  1.93651123,  2.05015994, ...  5.77883725,
         3.55803798,  7.21968383]]), algorithm='omp', regularization=3, copy_cov=False, init=None, max_iter=1000, check_input=False, verbose=0)
    147     elif algorithm == 'omp':
    148         # TODO: Should verbose argument be passed to this?
    149         new_code = orthogonal_mp_gram(
    150             Gram=gram, Xy=cov, n_nonzero_coefs=int(regularization),
    151             tol=None, norms_squared=row_norms(X, squared=True),
--&gt; 152             copy_Xy=copy_cov).T
        algorithm = 'omp'
        alpha = undefined
    153     else:
    154         raise ValueError('Sparse coding method must be "lasso_lars" '
    155                          '"lasso_cd",  "lasso", "threshold" or "omp", got %s.'
    156                          % algorithm)

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/linear_model/omp.pyc in orthogonal_mp_gram(Gram=array([[ 1.        ,  0.99706708,  0.8669373 , ....  0.94511259,
         0.93221472,  1.        ]]), Xy=array([[ 3.49867539,  1.93651123,  2.05015994, ....  5.77883725,
         3.55803798,  7.21968383]]), n_nonzero_coefs=3, tol=None, norms_squared=array([ 12.37032493,   4.36747488,   4.2134112 ,... 37.00901994,
        16.6505497 ,  58.97107498]), copy_Gram=True, copy_Xy=False, return_path=False, return_n_iter=False)
    518     for k in range(Xy.shape[1]):
    519         out = _gram_omp(
    520             Gram, Xy[:, k], n_nonzero_coefs,
    521             norms_squared[k] if tol is not None else None, tol,
    522             copy_Gram=copy_Gram, copy_Xy=copy_Xy,
--&gt; 523             return_path=return_path)
    524         if return_path:
    525             _, idx, coefs, n_iter = out
    526             coef = coef[:, :, :len(idx)]
    527             for n_active, x in enumerate(coefs.T):

...........................................................................
/Users/fengyuyao/anaconda/lib/python2.7/site-packages/sklearn/linear_model/omp.pyc in _gram_omp(Gram=array([[ 1.        ,  0.99010866,  0.82197346, ....  0.94511259,
         0.93221472,  1.        ]]), Xy=array([ 3.49867539,  3.48729003,  2.91977933,  3...4,  3.39029937,
        3.45356109,  3.35550344]), n_nonzero_coefs=3, tol_0=None, tol=None, copy_Gram=True, copy_Xy=False, return_path=False)
    240                 break
    241             L[n_active, n_active] = np.sqrt(1 - v)
    242         Gram[n_active], Gram[lam] = swap(Gram[n_active], Gram[lam])
    243         Gram.T[n_active], Gram.T[lam] = swap(Gram.T[n_active], Gram.T[lam])
    244         indices[n_active], indices[lam] = indices[lam], indices[n_active]
--&gt; 245         Xy[n_active], Xy[lam] = Xy[lam], Xy[n_active]
        return_path = False
    246         n_active += 1
    247         # solves LL'x = y as a composition of two triangular systems
    248         gamma, _ = potrs(L[:n_active, :n_active], Xy[:n_active], lower=True,
    249                          overwrite_b=False)

ValueError: assignment destination is read-only
___________________________________________________________________________

</code></pre></div>
<p dir="auto">PR <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="84423486" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/4807" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/4807/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/4807">#4807</a> reveals a variety of estimators that fails on memory mapped input, once we allow check_array to process a memory map without copying its content in memory.</p>
<p dir="auto">Estimators failing on read only memory maps :</p>
<ul dir="auto">
<li>the whole PLS family</li>
<li>Factor analysis</li>
<li>Incremental PCA</li>
<li>NuSVC</li>
</ul>
<p dir="auto">Transformers :</p>
<ul dir="auto">
<li>KernelCenterer</li>
<li>MaxAbsScaler</li>
<li>MinAbsScaler</li>
<li>RobustScaler</li>
<li>StandardScaler</li>
</ul>
<p dir="auto">Most of these should be easy to fix (e.g X -= X.mean should be replaced etc.)</p>