Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109698 > unrolled thread
| Started by | meInvent bbird <jobmattcon@gmail.com> |
|---|---|
| First post | 2016-06-08 23:02 -0700 |
| Last post | 2016-06-10 08:03 -0700 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.python
run code error with numpy and scipy meInvent bbird <jobmattcon@gmail.com> - 2016-06-08 23:02 -0700
Re: run code error with numpy and scipy Ben Finney <ben+python@benfinney.id.au> - 2016-06-09 16:27 +1000
Re: run code error with numpy and scipy MRAB <python@mrabarnett.plus.com> - 2016-06-09 14:52 +0100
Re: run code error with numpy and scipy meInvent bbird <jobmattcon@gmail.com> - 2016-06-10 08:03 -0700
| From | meInvent bbird <jobmattcon@gmail.com> |
|---|---|
| Date | 2016-06-08 23:02 -0700 |
| Subject | run code error with numpy and scipy |
| Message-ID | <62df152e-8fc6-47c5-aa44-f2da4094c140@googlegroups.com> |
when i run code in window has an error not a valid win32 dll then i install scipy first in this site, then install numpy-mkl all python 2.7 and win32 http://www.lfd.uci.edu/~gohlke/pythonlibs/ then i run code below, got error , and captured screen in this link https://drive.google.com/file/d/0Bxs_ao6uuBDUQXROd2VqSURGa00/view?usp=sharing import numpy as np from scipy.sparse.linalg import svds from functools import partial from scipy.sparse import csr_matrix def emsvd(Y, k=None, tol=1E-3, maxiter=None): if k is None: svdmethod = partial(np.linalg.svd, full_matrices=False) else: svdmethod = partial(svds, k=k) if maxiter is None: maxiter = np.inf muhat = np.nanmean(Y, axis=0, keepdims=1) valid = np.isfinite(Y) Y_hat = np.where(valid, Y, muhat) halt = False ii = 1 v_prev = 0 while not halt: U, s, Vt = svdmethod(Y_hat - muhat) Y_hat[~valid] = (U.dot(np.diag(s)).dot(Vt) + muhat)[~valid] muhat = Y_hat.mean(axis=0, keepdims=1) v = s.sum() if ii >= maxiter or ((v - v_prev) / v_prev) < tol: halt = True ii += 1 v_prev = v return Y_hat, muhat, U, s, Vt A = csr_matrix([[1, 2, 0], [0, 0, 3], [4, 0, 5]]) emsvd(A) np.nanmean(A, axis=0, keepdims=1)
[toc] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2016-06-09 16:27 +1000 |
| Message-ID | <mailman.89.1465453692.2306.python-list@python.org> |
| In reply to | #109698 |
meInvent bbird <jobmattcon@gmail.com> writes: > when i run code in window has an error not a valid win32 dll Simplify the example, to diagnose it. What is the *simplest* example code that shows the problem? In other words, remove statements from the example until the problem no longer happens. Then add back *one* statement to make it happen, and present that example. -- \ “I have had a perfectly wonderful evening, but this wasn't it.” | `\ —Groucho Marx | _o__) | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2016-06-09 14:52 +0100 |
| Message-ID | <mailman.114.1465480350.2306.python-list@python.org> |
| In reply to | #109698 |
On 2016-06-09 07:02, meInvent bbird wrote: > when i run code in window has an error not a valid win32 dll > > then i install scipy first in this site, then install numpy-mkl > all python 2.7 and win32 > > http://www.lfd.uci.edu/~gohlke/pythonlibs/ > > then i run code below, got error , and captured screen in this link > > https://drive.google.com/file/d/0Bxs_ao6uuBDUQXROd2VqSURGa00/view?usp=sharing > [snip] You're entering it at the interactive Python prompt. When it sees the blank line, it thinks you've finished entering the function, so it complains when the next line is indented. (Things are slightly different when working interactively than when running from a file.) You should put the code into a file and then run that.
[toc] | [prev] | [next] | [standalone]
| From | meInvent bbird <jobmattcon@gmail.com> |
|---|---|
| Date | 2016-06-10 08:03 -0700 |
| Message-ID | <8bfd6ba6-b3c8-427a-bc22-734e49a24318@googlegroups.com> |
| In reply to | #109747 |
On Thursday, June 9, 2016 at 9:52:43 PM UTC+8, MRAB wrote: > On 2016-06-09 07:02, meInvent bbird wrote: > > when i run code in window has an error not a valid win32 dll > > > > then i install scipy first in this site, then install numpy-mkl > > all python 2.7 and win32 > > > > http://www.lfd.uci.edu/~gohlke/pythonlibs/ > > > > then i run code below, got error , and captured screen in this link > > > > https://drive.google.com/file/d/0Bxs_ao6uuBDUQXROd2VqSURGa00/view?usp=sharing > > > [snip] > You're entering it at the interactive Python prompt. > > When it sees the blank line, it thinks you've finished entering the > function, so it complains when the next line is indented. (Things are > slightly different when working interactively than when running from a > file.) > > You should put the code into a file and then run that. thank you i will try it.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web