Re: [Numpy-discussion] Using numpy on hadoop streaming: ImportError: cannot import name multiarray
Hi David, Thanks for your response. But I can't install anything on cluster. *Could anyone please help me understand how the file 'multiarray.so' is used by the tagger. I mean how it is loaded( I assume its some sort of DLL for windows and shared library for unix based systems). Is it a module or what?* Right now what I did is I packaged numpy so that numpy will be present at the current working directory for mapper and reducer. So now control goes into numpy packaged alongwith mapper. But still right now I see such error: *File "glossextractionengine.mod/nltk/tag/__init__.py", line 123, in pos_tag File "glossextractionengine.mod/pickle.py", line 1380, in load return doctest.testmod() File "glossextractionengine.mod/pickle.py", line 860, in load return stopinst.value File "glossextractionengine.mod/pickle.py", line 1092, in load_global dispatch[GLOBAL] = load_global File "glossextractionengine.mod/pickle.py", line 1126, in find_class klass = getattr(mod, name) File "numpy.mod/numpy/__init__.py", line 137, in File "numpy.mod/numpy/add_newdocs.py", line 13, in File "numpy.mod/numpy/lib/__init__.py", line 4, in File "numpy.mod/numpy/lib/type_check.py", line 21, in File "numpy.mod/numpy/core/__init__.py", line 9, in ImportError: No module named multiarray* In this case the file 'multiarray.so' is present in within core package only, but it is still not found. Can anyone throw some light on it. Thanks! Kartik On Wed, Feb 11, 2015 at 7:17 AM, Daπid wrote: > On 11 February 2015 at 08:06, Kartik Kumar Perisetla > wrote: > > Thanks David. But do I need to install virtualenv on every node in hadoop > > cluster? Actually I am not very sure whether same namenodes are assigned > for > > my every hadoop job. So how shall I proceed on such scenario. > > I have never used hadoop, but in the clusters I have used, you have a > home folder on the central node, and each and every computing node has > access to it. You can then install Python in your home folder and make > every node run that, or pull a local copy. > > Probably the cluster support can clear this up further and adapt it to > your particular case. > > /David. > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > -- Regards, Kartik Perisetla ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
Colin, I currently use Py3.4 and Numpy 1.9.1. However, I built a quick test conda environment with Python2.7 and Numpy 1.7.0, and I get the same: Python 2.7.9 |Continuum Analytics, Inc.| (default, Dec 18 2014, 16:57:52) [MSC v .1500 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. IPython 2.3.1 -- An enhanced Interactive Python. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://binstar.org ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: import numpy as np In [2]: np.__version__ Out[2]: '1.7.0' In [3]: np.mat([4,'5',6]) Out[3]: matrix([['4', '5', '6']], dtype='|S1') In [4]: np.mat([4,'5',6], dtype=int) Out[4]: matrix([[4, 5, 6]]) ### As to your comment about coordinating with Statsmodels, you should see the links in the thread that Alan posted: http://permalink.gmane.org/gmane.comp.python.numeric.general/56516 http://permalink.gmane.org/gmane.comp.python.numeric.general/56517 Josef's comments at the time seem to echo the issues the devs (and others) have with the matrix class. Maybe things have changed with Statsmodels. I know I mentioned Sage and SageMathCloud before. I'll just point out that there are folks that use this for real research problems, not just as a pedagogical tool. They have a Matrix/vector/column_matrix class that do what you were expecting from your problems posted above. Indeed below is a (truncated) cut and past from a Sage Worksheet. (See http://www.sagemath.org/doc/tutorial/tour_linalg.html) ## In : Matrix([1,'2',3]) Error in lines 1-1 Traceback (most recent call last): TypeError: unable to find a common ring for all elements In : Matrix([[1,2,3],[4,5]]) ValueError: List of rows is not valid (rows are wrong types or lengths) In : vector([1,2,3]) (1, 2, 3) In : column_matrix([1,2,3]) [1] [2] [3] ## Large portions of the custom code and wrappers in Sage are written in Python. I don't think their Matrix object is a subclass of ndarray, so perhaps you could strip out the Matrix stuff from here to make a separate project with just the Matrix stuff, if you don't want to go through the Sage interface. On Wed, Feb 11, 2015 at 11:54 AM, cjw wrote: > > On 11-Feb-15 10:21 AM, Ryan Nelson wrote: > > So: > > In [2]: np.mat([4,'5',6]) > Out[2]: > matrix([['4', '5', '6']], dtype=' > In [3]: np.mat([4,'5',6], dtype=int) > Out[3]: matrix([[4, 5, 6]]) > > > Thanks Ryan, > > We are not singing from the same hymn book. > > Using PyScripter, I get: > > *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit > (AMD64)] on win32. *** > >>> import numpy as np > >>> print('Numpy version: ', np.__version__) > ('Numpy version: ', '1.9.0') > >>> > > Could you say which version you are using please? > > Colin W > > > On Tue, Feb 10, 2015 at 5:07 PM, cjw wrote: > > > It seems to be agreed that there are weaknesses in the existing Numpy > Matrix > Class. > > Some problems are illustrated below. > > I'll try to put some suggestions over the coming weeks and would appreciate > comments. > > Colin W. > > Test Script: > > if __name__ == '__main__': > a= mat([4, 5, 6]) # Good > print('a: ', a) > b= mat([4, '5', 6]) # Not the expected result > print('b: ', b) > c= mat([[4, 5, 6], [7, 8]]) # Wrongly accepted as rectangular > print('c: ', c) > d= mat([[1, 2, 3]]) > try: > d[0, 1]= 'b'# Correctly flagged, not numeric > except ValueError: > print("d[0, 1]= 'b' # Correctly flagged, not numeric", > ' > ValueError') > print('d: ', d) > > Result: > > *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit > (AMD64)] on win32. *** > > a: [[4 5 6]] > b: [['4' '5' '6']] > c: [[[4, 5, 6] [7, 8]]] > d[0, 1]= 'b' # Correctly flagged, not numeric ValueError > d: [[1 2 3]] > > > > > > -- > View this message in > context:http://numpy-discussion.10968.n7.nabble.com/Matrix-Class-tp39719.html > Sent from the Numpy-discussion mailing list archive at Nabble.com. > ___ > NumPy-Discussion mailing > listNumPy-Discussion@scipy.orghttp://mail.scipy.org/mailman/listinfo/numpy-discussion > > > > ___ > NumPy-Discussion mailing > listNumPy-Discussion@scipy.orghttp://mail.scipy.org/mailman/listinfo/numpy-discussion > > > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
11.02.2015, 21:57, Alan G Isaac kirjoitti: [clip] > I think gains could be in lazy evaluation structures (e.g., > a KroneckerProduct object that never actually produces the product > unless forced to.) This sounds like an abstract linear operator interface. Several attempts have been made to this direction in Python world, but I think none of them has really gained traction so far. One is even in Scipy. Unfortunately, that one's design has grown organically, and it's mostly suited just for specifying inputs to sparse solvers etc. rather than abstract manipulations. If there was a popular way to deal with these objects, it could become even more popular reasonably quickly. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
On 2/11/2015 2:25 PM, cjw wrote: > I think of the matrix as a numeric object. What would the case be for having > a Boolean matrix? It's one of my primary uses: https://en.wikipedia.org/wiki/Adjacency_matrix Numpy alread provides SVD: http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.svd.html A lot of core linear algebra is in `numpy.linalg`, and SciPy has much more. Remember for matrix `M` you can always apply any numpy function to `M.A`. I think gains could be in lazy evaluation structures (e.g., a KroneckerProduct object that never actually produces the product unless forced to.) Cheers, Alan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
On 11-Feb-15 12:13 PM, Alan G Isaac wrote: Just recalling the one-year-ago discussion: http://comments.gmane.org/gmane.comp.python.numeric.general/56494 Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion Thanks Alan, I've kept a pointer. My interest is not oriented towards tuition but in exploring the possibility of making Matrix as efficient as possible. Others have suggested Sage Maths for tuition. What methods should be included? You have suggested adding the Hermitian. I think of the matrix as a numeric object. What would the case be for having a Boolean matrix? The Hat matrix and SVD are suggested. Possible coordination with stats models. I'll try to put a first draft specification over the next few weeks. Colin W. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
Thanks Sebastian, This would appear to make a case for considering not having Matrix as a sub-class of an np array. On the other hand, so much work has gone into np, and there is some commonality between the needs of Matrix and Array. Colin W. On 11-Feb-15 12:19 PM, Sebastian Berg wrote: On Mi, 2015-02-11 at 11:38 -0500, cjw wrote: On 11-Feb-15 10:47 AM, Sebastian Berg wrote: On Di, 2015-02-10 at 15:07 -0700, cjw wrote: It seems to be agreed that there are weaknesses in the existing Numpy Matrix Class. Some problems are illustrated below. Not to delve deeply into a discussion, but unfortunately, there seem far more fundamental problems because of the always 2-D thing and the simple fact that matrix is more of a second class citizen in numpy (or in other words a lot of this is just the general fact that it is an ndarray subclass). Thanks Sebastian, We'll have to see what comes out of the discussion. I would be grateful if you could expand on the "always 2D thing". Is there a need for a collection of matrices, where a function is applied to each component of the collection? No, I just mean the fact that a matrix is always 2D. This makes some things like some indexing operations awkward and some functions that expect a numpy array (but think they can handle subclasses fine) may just plain brake. And then ndarray subclasses are just a bit problematic In short, you cannot generally expect a function which works great with arrays to also work great with matrices, I believe. this is true for some things within numpy and certainly for third party libraries I am sure. - Sebastian Colin W. I think some of these issues were summarized in the discussion about the @ operator. I am not saying that a matrix class separate from numpy cannot solve these, but within numpy it seems hard. I'll try to put some suggestions over the coming weeks and would appreciate comments. Colin W. Test Script: if __name__ == '__main__': a= mat([4, 5, 6]) # Good print('a: ', a) b= mat([4, '5', 6]) # Not the expected result print('b: ', b) c= mat([[4, 5, 6], [7, 8]]) # Wrongly accepted as rectangular print('c: ', c) d= mat([[1, 2, 3]]) try: d[0, 1]= 'b'# Correctly flagged, not numeric except ValueError: print("d[0, 1]= 'b' # Correctly flagged, not numeric", ' ValueError') print('d: ', d) Result: *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32. *** a: [[4 5 6]] b: [['4' '5' '6']] c: [[[4, 5, 6] [7, 8]]] d[0, 1]= 'b' # Correctly flagged, not numeric ValueError d: [[1 2 3]] -- View this message in context: http://numpy-discussion.10968.n7.nabble.com/Matrix-Class-tp39719.html Sent from the Numpy-discussion mailing list archive at Nabble.com. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
On 11 February 2015 at 18:22, Stephan Hoyer wrote: > In my opinion, a "fixed" version of np.matrix should (1) not be a > np.ndarray subclass and (2) exist in a third party library not numpy itself. > +1 for both of those ... but especially the first. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
On Wed, Feb 11, 2015 at 9:19 AM, Sebastian Berg wrote: > On Mi, 2015-02-11 at 11:38 -0500, cjw wrote: > No, I just mean the fact that a matrix is always 2D. This makes some > things like some indexing operations awkward and some functions that > expect a numpy array (but think they can handle subclasses fine) may > just plain brake. And then ndarray subclasses are just a bit > problematic > Indeed. In my opinion, a "fixed" version of np.matrix should (1) not be a np.ndarray subclass and (2) exist in a third party library not numpy itself. I don't think it's really feasible to fix np.matrix in its current state as an ndarray subclass, but even a fixed matrix class doesn't really belong in numpy itself, which has too long release cycles and compatibility guarantees for experimentation -- not to mention that the mere existence of the matrix class in numpy leads new users astray. If you're really excited about using matrix objects, I really would recommend starting a new project to implement the functionality (or maybe such a project already exists -- I don't know). Numpy has some excellent hooks for non-ndarray ndarray-like objects, so it's pretty straightforward to integrate with numpy ufuncs, etc. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
On Mi, 2015-02-11 at 11:38 -0500, cjw wrote: > > On 11-Feb-15 10:47 AM, Sebastian Berg wrote: > > > On Di, 2015-02-10 at 15:07 -0700, cjw wrote: > > > It seems to be agreed that there are weaknesses in the existing Numpy > > > Matrix > > > Class. > > > > > > Some problems are illustrated below. > > > > > Not to delve deeply into a discussion, but unfortunately, there seem far > > more fundamental problems because of the always 2-D thing and the simple > > fact that matrix is more of a second class citizen in numpy (or in other > > words a lot of this is just the general fact that it is an ndarray > > subclass). > Thanks Sebastian, > > We'll have to see what comes out of the discussion. > > I would be grateful if you could expand on the "always 2D thing". Is > there a need for a collection of matrices, where a function is applied > to each component of the collection? > No, I just mean the fact that a matrix is always 2D. This makes some things like some indexing operations awkward and some functions that expect a numpy array (but think they can handle subclasses fine) may just plain brake. And then ndarray subclasses are just a bit problematic In short, you cannot generally expect a function which works great with arrays to also work great with matrices, I believe. this is true for some things within numpy and certainly for third party libraries I am sure. - Sebastian > Colin W. > > > > I think some of these issues were summarized in the discussion about the > > @ operator. I am not saying that a matrix class separate from numpy > > cannot solve these, but within numpy it seems hard. > > > > > > > I'll try to put some suggestions over the coming weeks and would > > > appreciate > > > comments. > > > > > > Colin W. > > > > > > Test Script: > > > > > > if __name__ == '__main__': > > > a= mat([4, 5, 6]) # Good > > > print('a: ', a) > > > b= mat([4, '5', 6]) # Not the expected result > > > print('b: ', b) > > > c= mat([[4, 5, 6], [7, 8]]) # Wrongly accepted as rectangular > > > print('c: ', c) > > > d= mat([[1, 2, 3]]) > > > try: > > > d[0, 1]= 'b'# Correctly flagged, not numeric > > > except ValueError: > > > print("d[0, 1]= 'b' # Correctly flagged, not > > > numeric", ' > > > ValueError') > > > print('d: ', d) > > > > > > Result: > > > > > > *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit > > > (AMD64)] on win32. *** > > > a: [[4 5 6]] > > > b: [['4' '5' '6']] > > > c: [[[4, 5, 6] [7, 8]]] > > > d[0, 1]= 'b' # Correctly flagged, not numeric ValueError > > > d: [[1 2 3]] > > > > > > > > > > > > > > > -- > > > View this message in context: > > > http://numpy-discussion.10968.n7.nabble.com/Matrix-Class-tp39719.html > > > Sent from the Numpy-discussion mailing list archive at Nabble.com. > > > ___ > > > NumPy-Discussion mailing list > > > NumPy-Discussion@scipy.org > > > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > > > > > > > > ___ > > NumPy-Discussion mailing list > > NumPy-Discussion@scipy.org > > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion signature.asc Description: This is a digitally signed message part ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
Just recalling the one-year-ago discussion: http://comments.gmane.org/gmane.comp.python.numeric.general/56494 Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
On 11-Feb-15 10:21 AM, Ryan Nelson wrote: So: In [2]: np.mat([4,'5',6]) Out[2]: matrix([['4', '5', '6']], dtype=' Thanks Ryan, We are not singing from the same hymn book. Using PyScripter, I get: *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32. *** >>> import numpy as np >>> print('Numpy version: ', np.__version__) ('Numpy version: ', '1.9.0') >>> Could you say which version you are using please? Colin W On Tue, Feb 10, 2015 at 5:07 PM, cjw wrote: It seems to be agreed that there are weaknesses in the existing Numpy Matrix Class. Some problems are illustrated below. I'll try to put some suggestions over the coming weeks and would appreciate comments. Colin W. Test Script: if __name__ == '__main__': a= mat([4, 5, 6]) # Good print('a: ', a) b= mat([4, '5', 6]) # Not the expected result print('b: ', b) c= mat([[4, 5, 6], [7, 8]]) # Wrongly accepted as rectangular print('c: ', c) d= mat([[1, 2, 3]]) try: d[0, 1]= 'b'# Correctly flagged, not numeric except ValueError: print("d[0, 1]= 'b' # Correctly flagged, not numeric", ' ValueError') print('d: ', d) Result: *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32. *** a: [[4 5 6]] b: [['4' '5' '6']] c: [[[4, 5, 6] [7, 8]]] d[0, 1]= 'b' # Correctly flagged, not numeric ValueError d: [[1 2 3]] -- View this message in context: http://numpy-discussion.10968.n7.nabble.com/Matrix-Class-tp39719.html Sent from the Numpy-discussion mailing list archive at Nabble.com. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
On 11-Feb-15 10:47 AM, Sebastian Berg wrote: On Di, 2015-02-10 at 15:07 -0700, cjw wrote: It seems to be agreed that there are weaknesses in the existing Numpy Matrix Class. Some problems are illustrated below. Not to delve deeply into a discussion, but unfortunately, there seem far more fundamental problems because of the always 2-D thing and the simple fact that matrix is more of a second class citizen in numpy (or in other words a lot of this is just the general fact that it is an ndarray subclass). Thanks Sebastian, We'll have to see what comes out of the discussion. I would be grateful if you could expand on the "always 2D thing". Is there a need for a collection of matrices, where a function is applied to each component of the collection? Colin W. I think some of these issues were summarized in the discussion about the @ operator. I am not saying that a matrix class separate from numpy cannot solve these, but within numpy it seems hard. I'll try to put some suggestions over the coming weeks and would appreciate comments. Colin W. Test Script: if __name__ == '__main__': a= mat([4, 5, 6]) # Good print('a: ', a) b= mat([4, '5', 6]) # Not the expected result print('b: ', b) c= mat([[4, 5, 6], [7, 8]]) # Wrongly accepted as rectangular print('c: ', c) d= mat([[1, 2, 3]]) try: d[0, 1]= 'b'# Correctly flagged, not numeric except ValueError: print("d[0, 1]= 'b' # Correctly flagged, not numeric", ' ValueError') print('d: ', d) Result: *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32. *** a: [[4 5 6]] b: [['4' '5' '6']] c: [[[4, 5, 6] [7, 8]]] d[0, 1]= 'b' # Correctly flagged, not numeric ValueError d: [[1 2 3]] -- View this message in context: http://numpy-discussion.10968.n7.nabble.com/Matrix-Class-tp39719.html Sent from the Numpy-discussion mailing list archive at Nabble.com. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
On Di, 2015-02-10 at 15:07 -0700, cjw wrote: > It seems to be agreed that there are weaknesses in the existing Numpy Matrix > Class. > > Some problems are illustrated below. > Not to delve deeply into a discussion, but unfortunately, there seem far more fundamental problems because of the always 2-D thing and the simple fact that matrix is more of a second class citizen in numpy (or in other words a lot of this is just the general fact that it is an ndarray subclass). I think some of these issues were summarized in the discussion about the @ operator. I am not saying that a matrix class separate from numpy cannot solve these, but within numpy it seems hard. > I'll try to put some suggestions over the coming weeks and would appreciate > comments. > > Colin W. > > Test Script: > > if __name__ == '__main__': > a= mat([4, 5, 6]) # Good > print('a: ', a) > b= mat([4, '5', 6]) # Not the expected result > print('b: ', b) > c= mat([[4, 5, 6], [7, 8]]) # Wrongly accepted as rectangular > print('c: ', c) > d= mat([[1, 2, 3]]) > try: > d[0, 1]= 'b'# Correctly flagged, not numeric > except ValueError: > print("d[0, 1]= 'b' # Correctly flagged, not numeric", ' > ValueError') > print('d: ', d) > > Result: > > *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit > (AMD64)] on win32. *** > >>> > a: [[4 5 6]] > b: [['4' '5' '6']] > c: [[[4, 5, 6] [7, 8]]] > d[0, 1]= 'b' # Correctly flagged, not numeric ValueError > d: [[1 2 3]] > >>> > > > > > > -- > View this message in context: > http://numpy-discussion.10968.n7.nabble.com/Matrix-Class-tp39719.html > Sent from the Numpy-discussion mailing list archive at Nabble.com. > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > signature.asc Description: This is a digitally signed message part ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Matrix Class
So: In [2]: np.mat([4,'5',6]) Out[2]: matrix([['4', '5', '6']], dtype=' wrote: > It seems to be agreed that there are weaknesses in the existing Numpy > Matrix > Class. > > Some problems are illustrated below. > > I'll try to put some suggestions over the coming weeks and would appreciate > comments. > > Colin W. > > Test Script: > > if __name__ == '__main__': > a= mat([4, 5, 6]) # Good > print('a: ', a) > b= mat([4, '5', 6]) # Not the expected result > print('b: ', b) > c= mat([[4, 5, 6], [7, 8]]) # Wrongly accepted as rectangular > print('c: ', c) > d= mat([[1, 2, 3]]) > try: > d[0, 1]= 'b'# Correctly flagged, not numeric > except ValueError: > print("d[0, 1]= 'b' # Correctly flagged, not numeric", > ' > ValueError') > print('d: ', d) > > Result: > > *** Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit > (AMD64)] on win32. *** > >>> > a: [[4 5 6]] > b: [['4' '5' '6']] > c: [[[4, 5, 6] [7, 8]]] > d[0, 1]= 'b' # Correctly flagged, not numeric ValueError > d: [[1 2 3]] > >>> > > > > > > -- > View this message in context: > http://numpy-discussion.10968.n7.nabble.com/Matrix-Class-tp39719.html > Sent from the Numpy-discussion mailing list archive at Nabble.com. > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] 3D array and the right hand rule
Ok, thanks for the reply! Indeed, I know about the use of transformation matrices to manipulate points in space. That's all matrix manipulation anyway But, (and perhaps this is not the right place to ask the following question): But are there no known mathmatical algorithms which involve the use of 3n arrays (or higher dimensions) to transform an object between one state and the other? This is an open question, as my knowledge of math is lacking on this area. I'm currently limited to 3D object manipulation and some statistics which all rely on matrix calculus... kind regards, Dieter On Fri, Jan 30, 2015 at 2:32 AM, Alexander Belopolsky wrote: > > On Mon, Jan 26, 2015 at 6:06 AM, Dieter Van Eessen < > dieter.van.ees...@gmail.com> wrote: > >> I've read that numpy.array isn't arranged according to the >> 'right-hand-rule' (right-hand-rule => thumb = +x; index finger = +y, bend >> middle finder = +z). This is also confirmed by an old message I dug up from >> the mailing list archives. (see message below) >> > > Dieter, > > It looks like you are confusing dimensionality of the array with the > dimensionality of a vector that it might store. If you are interested in > using numpy for 3D modeling, you will likely only encounter 1-dimensional > arrays (vectors) of size 3 and 2-dimensional arrays (matrices) of size 9 > or shape (3, 3). > > A 3-dimensional array is a stack of matrices and the 'right-hand-rule' > does not really apply. The notion of C/F-contiguous deals with the order > of axes (e.g. width first or depth first) while the right-hand-rule is > about the direction of the axes (if you "flip" the middle finger right hand > becomes left.) In the case of arrays this would probably correspond to > little-endian vs. big-endian: is a[0] stored at a higher or lower address > than a[1]. However, whatever the answer to this question is for a > particular system, it is the same for all axes in the array, so right-hand > - left-hand distinction does not apply. > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > -- gtz, Dieter VE ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Using numpy on hadoop streaming: ImportError: cannot import name multiarray
On 11 February 2015 at 08:06, Kartik Kumar Perisetla wrote: > Thanks David. But do I need to install virtualenv on every node in hadoop > cluster? Actually I am not very sure whether same namenodes are assigned for > my every hadoop job. So how shall I proceed on such scenario. I have never used hadoop, but in the clusters I have used, you have a home folder on the central node, and each and every computing node has access to it. You can then install Python in your home folder and make every node run that, or pull a local copy. Probably the cluster support can clear this up further and adapt it to your particular case. /David. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion